#821·index-tts

WebUI: microphone recording leaves the mic open and freezes the page after a few recordings (gradio 5.45 recorder bug)

Author: zen-hamCreated Sep 27, 2026Updated Sep 27, 2026

Summary

Recording a voice reference with the microphone in the WebUI leaks browser resources on every recording. After a handful of recordings the tab sits at a full CPU core while idle and the page stops responding (clicks and hovers do nothing, "Page Unresponsive"). The mic also stays open after Stop. This comes from the gr.Audio recorder in the pinned gradio==5.45.0, not from IndexTTS code, and it is already fixed upstream in gradio 6.27+.

Measured (IndexTTS-2.5 WebUI, gradio 5.45.0, Windows 10, Chromium 138-based browser; page instrumented around getUserMedia and AudioContext), per single recording:

  • getUserMedia is called 3 times; after pressing Stop, 2 of those streams are still live (the mic stays open).
  • 9 AudioContexts are created and 5 are never closed. 3 of them belong to the waveform recorder's mic visualizer, which keeps a requestAnimationFrame loop redrawing a hidden waveform every frame, forever.
  • After 8 recordings the tab's renderer used about 104% of one CPU core while idle. The same thing showed up in a Gecko-based browser (1.6 cores, memory growing ~10 MB/s), so it is not browser-specific.

Upstream status

  • The visualizer leak is fixed in wavesurfer.js 7.10.2 ("fix(record): release mic resources after recording"); gradio 6 pins wavesurfer.js 7.11.0 (5.45 resolves to 7.4.2).
  • The two never-closed decode/encode AudioContexts were fixed in gradio PR #13806, first released in gradio 6.27.0.
  • With gradio 6.28.0 I measured 0 live mic streams and 0 open AudioContexts after each of 3 recordings, and no idle CPU growth.

Options

  1. Bump gradio to >= 6.27 (gradio 6 is a major version, so the WebUI likely needs migration work).
  2. As a stopgap on 5.45, a small script injected with gr.Blocks(head=...) that stops all mic tracks once a recording ends, closes the abandoned AudioContexts, and ends the stale redraw loops. I have a tested version (about 100 lines of plain JS, no changes to gradio itself) and can open a PR with it if that approach is welcome.

Found and measured with AI assistance (Claude Code) on my machine.