demo · v139
Silence Suppressor
One of the explainer's named use cases: skip transmitting encoded audio frames whose audioLevel falls under a silence threshold, without decoding. This demo simulates that pipeline against a live mic — sent frames go green, dropped frames go red.
This page simulates the WebRTC Encoded Transform pipeline using
getUserMedia + an AnalyserNode. The dropped/sent decision is the same one a real TransformStream over RTCEncodedAudioFrame would make, but no PeerConnection is opened. Open in Chrome 139+ and watch the bandwidth-saving math change with your voice.Click "Start" to grant mic permission. The threshold below is in dBov (lower number = louder; spec range is 0..127).
100
Frames whose audioLevel is greater than the threshold (quieter) are dropped.
frame sent
frame dropped (silence)
0
total frames
0
sent
0%
bandwidth saved
the code
const sender = pc.getSenders().find(s => s.track.kind === "audio");
const { readable, writable } = sender.createEncodedStreams();
const SILENCE = 100; // dBov
readable.pipeThrough(new TransformStream({
transform(frame, ctl) {
const md = frame.getMetadata();
// v139: audioLevel is on encoded-frame metadata, no decode needed
if (md.audioLevel > SILENCE) {
// Quieter than threshold — drop. Saves uplink bandwidth in mostly-silent calls.
return;
}
ctl.enqueue(frame);
}
})).pipeTo(writable);