[LAD] Mixing audio: Noiseless volume changes

Fons Adriaensen fons at linuxaudio.org
Mon Mar 18 23:58:48 UTC 2013

On Mon, Mar 18, 2013 at 07:43:32PM -0400, Tim E. Real wrote:
> Ah, I may have answered my own question when I said:
> "(One cannot simply wait for the current data value to be 'zero' because
>  for example with a perfect square wave signal the 'current' value will never 
>  approach zero, hence the zero-crossing detection requirement.)"

The analog waveform always 'approaches' zero - it's bandlimited and hence
continuous - it just may not happen at a sample point. In fact the chance
that it happens exactly at a sample point is zero.

> So having no choice but to apply the volume at this cross point the popping
>  noise might still be heard. I guess that's what Fons meant by 'reduced'...
>  and what Paul meant by... bogus. Right?

Imagine a signal slowly passing through zero, e.g. a low frequency
sine wave. If you switch gain at an arbitatry point there will be
a 'step', having a 1/F spectrum (just like a square wave). If you
switch at a zero crossing there will be 'sharp corner', and this
has a 1/(F^2) spectrum (like a triangular wave). So instead of a
sharp click there will be something more like a 'thump'. The only
real solution is to never switch the gain, but change it smoothly.



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