audio-to-audio Β· speech enhancement Β· WASM Β· ~0.5 MB
A different audio task from the ASR, TTS, and classifier demos: speech enhancement. GTCRN (Grouped Temporal Convolutional Recurrent Network) is a tiny real-time denoiser β ~48k parameters, a 0.5 MB ONNX β that takes the noisy speech spectrum frame by frame and predicts the clean spectrum, which we invert back to audio. Add noise to a clean clip (so the gain is measurable) or bring your own noisy recording, and hear it cleaned up β entirely on your device.
| Model | bitsydarel/gtcrn-onnx β gtcrn_simple.onnx (streaming) |
|---|---|
| Task | audio-to-audio β speech enhancement / denoising |
| Architecture | GTCRN: grouped temporal-conv recurrent net on the complex STFT (~48k params) |
| Pipeline | 512-pt STFT (hop 256, sqrt-Hann) β streaming GTCRN per frame (recurrent caches) β iSTFT (overlap-add) |
| I/O | 16 kHz mono in β 16 kHz mono out; input mix [1, 257, 1, 2] + 3 caches β enh [1, 257, 1, 2] + caches |
| Quantization | fp32 |
| Runtime | onnxruntime-web (raw ONNX Runtime Web) β no transformers.js speech-enhancement class exists |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) β faster than real time on CPU |
| Download | ~0.5 MB, cached after first load |
| License | Apache-2.0 (GTCRN, Xiaobin-Rong) |
| Web APIs | WebAssembly, Web Workers, Web Audio (decode/resample), Canvas β all Baseline widely available |
Pick a clean clip, add noise at a chosen level (so we can measure the gain), then Enhance. Or upload your own noisy recording.
The bundled JFK speech clip is an inaugural excerpt (20 January 1961), spoken by John F. Kennedy β public domain, U.S. government work Β· JFK audio source and attribution record.
Denoising shows up as a lower noise floor (the RMS of the quietest frames β the gaps between words, which should be near-silent) while the speech energy is preserved. This is the real measurement on the current clip.
| metric | noisy | enhanced | change |
|---|
A 0.5 MB denoiser that runs faster than real time on a CPU makes clean audio a local, private, offline primitive β no upload, no service, no GPU.
Add noise to a clean clip, enhance it, and hear + measure the before/after gain.
A voice-note cleaner: record or upload your own noisy audio and download the enhanced WAV.
Noise stress test: sweep the input SNR and watch how much GTCRN recovers at each level.
Denoise β Whisper: transcribe noisy vs enhanced audio and compare the two transcripts.
There's no transformers.js speech-enhancement class, so we run the ONNX graph directly and do the STFT/iSTFT ourselves:
import * as ort from "onnxruntime-web";
const gtcrn = await ort.InferenceSession.create(bytes); // ~0.5 MB
// per STFT frame (512-pt, hop 256, sqrt-Hann), carrying the recurrent caches:
let conv = zeros, tra = zeros, inter = zeros;
for (const frame of stftFrames(noisy16k)) { // frame = [1,257,1,2] real/imag
const o = await gtcrn.run({ mix: frame, conv_cache: conv, tra_cache: tra, inter_cache: inter });
conv = o.conv_cache_out; tra = o.tra_cache_out; inter = o.inter_cache_out;
pushEnhancedFrame(o.enh); // [1,257,1,2] β iSTFT overlap-add
}
This page runs exactly that in a Web Worker (STFT + streaming GTCRN + iSTFT all off the main thread), and transfers the enhanced PCM back for playback + download.