[LAD] Mixing audio: Noiseless volume changes

Fons Adriaensen fons at linuxaudio.org
Mon Mar 18 23:05:01 UTC 2013

On Mon, Mar 18, 2013 at 05:50:39PM -0400, Tim E. Real wrote:
> If I use a zero-crossing/zero-value detector and apply volume changes 
> only at these safe points, that's a much more desirable 'perfect' system.

Zero crossings are not 'safe'. You avoid a discontinuity in the signal
but there will still be one in the derivative of the signal. The spectrum
will be different, and noise will be reduced a bit, but it's by no means

The approach I use it to make a quick fade. There are two variations.
In both cases you select a 'period size', this could be Jack's period,
or a multiple of it close to some predetermined time, or it could be
entirely independent of the outer context.

In the simplest case, just make linear fade between the current and the
new gain. If the fade time is long enough this will do for non-critical
things such as a volume control in a player, but it's still not good enough
for e.g. a high quality mixer.

In the more complex version, you also limit the amount of gain change
per period. So the gain change may take several periods (which can be
shorter in this case). It requires a bit of logic and state machinery,
but nothing esoteric.



A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

More information about the Linux-audio-dev mailing list