## audacity-devel

 [Audacity-devel] Zero crossing From: Vince Busam - 2002-09-10 01:36:13 ```I remember (but can't find) a post that suggested finding a point where both tracks cross zero or are zero is a good point to use as a boundary for paste or cut -- or at least something like that. I'm looking to improve my AVC algorithm and was thinking that waiting for zero crossing to adjust the volume level might be worth considering. As a quick test, I put in code to indicate when both tracks equal 0 (not just cross zero). I see frequent double zero points in some music but saw one gap of 1.2 million samples. My experiments show that changing the amplification level too often leads to distortion. So I'm looking for good points at which to change the amplification value. Any suggestions? Vince ```
 [Audacity-devel] Zero crossing From: Ben Crowell - 2002-09-10 02:50:54 ```Changing the amplification suddenly at a point where the waveform y(t) is nonzero causes a discontinuity in y, and therefore a badly behaved fourier series with lots and lots of spurious high frequencies. Changing the amplification suddenly at a point where y=0 but the derivative y'(t) is nonzero causes a discontinuity in y', which has just as bad an effect on the fourier series. In audible terms, I think /either/ result will probably be heard as a click. If you can find a point where y, y'', y''', etc. are all zero up to infinitely high derivatives, then you can do whatever you want there. In other words, you need an interval of pure silence that lasts for a significant amount of time. I think this is the only way to avoid a click. ```
 Re: [Audacity-devel] Zero crossing From: Matt Brubeck - 2002-09-10 15:48:17 ```On Sep 9, Ben Crowell wrote: > Changing the amplification suddenly at a point where the waveform y(t) > is nonzero causes a discontinuity in y, and therefore a badly behaved > fourier series with lots and lots of spurious high frequencies. > > Changing the amplification suddenly at a point where y=0 but the > derivative y'(t) is nonzero causes a discontinuity in y', which has > just as bad an effect on the fourier series. Not just as bad -- remember, taking the derivative in the time domain is equivalent to multiplying by s in the frequency domain. The effects of discontinuity in y' will be attenuated in the Fourier transform of y, with the highest-frequency components attenuated the most. > In audible terms, I think /either/ result will probably be heard as > a click. In practical terms, when I took a 200Hz sine wave, selected a portion of it, and amplified by -5dB, there was an audible click only when the selection boundaries were not at zero crossings. Try it... > If you can find a point where y, y'', y''', etc. are all zero up to > infinitely high derivatives, then you can do whatever you want there. Unfortunately this is highly unlikely in an audio signal -- even places where y(t) = y'(t) = 0 are quite rare, since audio signals without strong DC bias tend to cross zero at the steepest parts of their slopes. ```
 Re: [Audacity-devel] Zero crossing From: Steve Harris - 2002-09-10 07:19:58 ```On Mon, Sep 09, 2002 at 06:36:22 -0700, Vince Busam wrote: > I'm looking to improve my AVC algorithm and was thinking that waiting for > zero crossing to adjust the volume level might be worth considering. I theory at least, that would be exactly the wrong thing to do as you have discontinuities in the gain envelope. In practice you probably wouldn't notice, but you're better off not doing it. > My experiments show that changing the amplification level too often leads to > distortion. So I'm looking for good points at which to change the > amplification value. That probably means that you're not correctly smoothing your gain function. Try applying a low order low cut LP filter to it before applying it to the waveform. Making the gain changes less frequent is the last thing you want to do. - Steve ```