The Lab - Web Audio

Channel fader

One strip from a mixing desk: a fader with real gain behind it, a mute, and a level readout. Start the tone, ride it down.

gain: -1.9 dB
state: open

How it works

The fader is a plain vertical input type="range". Its value maps onto a GainNode on a dB scale - the slider position converts to 20 * log10(v), because human loudness perception is logarithmic and a linear gain slider sounds broken (everything happens at the top). Mute ramps gain to 0 over 30 ms with setTargetAtTime instead of snapping - the click you hear when a gain snaps to zero is the waveform discontinuing mid-cycle.

The production channel fader ships in rack.js with the EQ dock; this is the standalone version with the maths left visible.