[LAD] Mixing audio: Noiseless volume changes

From: Tim E. Real <termtech@email-addr-hidden>
Date: Mon Mar 18 2013 - 23:50:39 EET

Hi again. Looking for any advice, tips, tricks, anecdotes etc.

I want to eliminate or reduce 'zipper' noise on volume changes.
So I'm looking at two techniques:
Zero-crossing / zero-value signal detection, and slew-rate limiting.
Code is almost done, almost ready to start testing each technique.
Each technique has some advantages and disadvantages.

If I use a slew-rate limiter, I figure for a sudden volume factor change
 from 0.0 to 1.0, if I limit the slew rate to say 0.01 per sample then after
 100 samples the ramp will be done.
But even with a fine ramp, this still might introduce artifacts in the audio.

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.
But I stuck a time limit on waiting for a zero-cross because it's possible
 the signal might have a high DC offset, or contain VLF < 20Hz.
(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.)

At some point waiting for a zero-cross, a ramp would have already finished
 and it may have been better to use that ramp instead.
Conversely, a zero-cross might happen sooner than a ramp could finish,
 and we definitely want to use that zero-cross here instead of the ramp.

So it means I either have to give the user a choice of the two techniques,
 or try to automatically switch between them - which ever one occurs first,
 the ramp finishing or the zero-cross, use it.
But it means I have to keep two audio buffers - one for applying the ramp
 as the samples are processed, and one for waiting until zero-cross happens -
 and which ever one "finishes the race" first, that buffer "gets the nod".

The zero-crossing technique has some interesting implications.
For a stereo signal each channel's zero-cross will happen at different times.
So I'm trying to imagine what that's going to sound like where the volume
 changes happen at slightly different times, if it will be noticeable, even
 though that is far better than 'zipper' noise.
Also I'm trying to imagine how track cross-fading support would deal
 with zero-crossing - if it is better to use ramps in that case.

What do you think?

Thanks.
Tim.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Mar 19 04:15:01 2013

This archive was generated by hypermail 2.1.8 : Tue Mar 19 2013 - 04:15:01 EET