[linux-audio-dev] 22050hz mono volume fading

Sampo Savolainen v2 at iki.fi
Sun Oct 23 11:42:07 UTC 2005


On Sun, 2005-10-23 at 22:55 +1300, Ross Levis wrote:
> It's my first post here.  I'm developing an audio player which has a 
> fading
> up/down facility.  This is working fine except for 22050 mono samples. 
> I'm getting patchy loud noises (intermittent white noise?) while fading 
> the audio data up and down.  The original audio can also be heard 
> between the noise.
> 
> The basic equation I'm doing is (Excuse the Pascal syntax):
> 
> Data := Data * CurrVol / 32767;

Does CurrVol move gradually from one gain to another gain?

If you do a fast gain change, say from 1.0 => 2.0 without gradually
moving the gain from the start value to the next value, you will get an
horrible transient. Doing a fast gradual change from the first value to
the next one is called declicking.

Consider two samples, first at 0.5  and the next one at 0.51. If the
gain is changed from 1.0 to 2.0 between these samples without
declicking, the first sample will be 0.5 and the next one will be 1.02.
You can just imagine what this non-continuity will sound like when it
gets through your DAC. This will be even worse if you change the gain
from 0.0 (-inf) to 1.0.

-- 
Sampo Savolainen <v2 at iki.fi>




More information about the Linux-audio-dev mailing list