Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Harry van Haaren
On Tue, Mar 19, 2013 at 1:02 PM, Fons Adriaensen f...@linuxaudio.orgwrote: The code below will do the trick Brilliant, thanks for sharing. Will be implementing learning from this later, appreciated! -Harry ___ Linux-audio-dev mailing list

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Tim Goetze
[Fons Adriaensen] On Tue, Mar 19, 2013 at 04:26:21AM +0100, Tim Goetze wrote: A 2nd-order IIR filter is often called a biquad; at musicdsp, look for that instead. Not really. A biquad is one way to implement a 2nd order IIR, and in many cases related to audio DSP, not really the best way.

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Fons Adriaensen
On Tue, Mar 19, 2013 at 03:02:19PM +0100, Tim Goetze wrote: for (i = 0; i nframes; i++) { g1 += w * (gt - g1 - a * g2); g2 += w * (b * g1 - g2); out [i] = g2 * in [i]; } Surely you realise this version executes exactly as many additions and multiplications per sample

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Tim Goetze
[Fons Adriaensen] On Tue, Mar 19, 2013 at 03:02:19PM +0100, Tim Goetze wrote: Surely you realise this version executes exactly as many additions and multiplications per sample as a biquad? Yes. In this case it's possible to remove one multiplication: a = 0.07f; b = 1 + a; // ... gm = b * gt;

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Fons Adriaensen
On Tue, Mar 19, 2013 at 04:46:10PM +0100, Tim Goetze wrote: However, I still take issue with the rather exaggerated claim that using a biquad to smoothen gain changes would be giant overkill. It may be slightly less efficient than your now optimised version, but certainly not enough to

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Tim Goetze
[Fons Adriaensen] Exactly the same with the form I proposed, w, a, b need to be computed just once, not for every gain change. In fact only w depends on the sample rate, a and b are fixed constants. Ah yes, sorry, I see that now. If that extra operation comes around to bite hard enough, I'll

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Fons Adriaensen
On Tue, Mar 19, 2013 at 08:15:41PM +0100, Tim Goetze wrote: [Fons Adriaensen] Exactly the same with the form I proposed, w, a, b need to be computed just once, not for every gain change. In fact only w depends on the sample rate, a and b are fixed constants. Ah yes, sorry, I see that now.

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Charles Z Henry
On Tue, Mar 19, 2013 at 2:15 PM, Tim Goetze t...@quitte.de wrote: [Fons Adriaensen] Exactly the same with the form I proposed, w, a, b need to be computed just once, not for every gain change. In fact only w depends on the sample rate, a and b are fixed constants. Ah yes, sorry, I see that

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Fons Adriaensen
On Tue, Mar 19, 2013 at 05:26:27PM -0500, Charles Z Henry wrote: You guys are splitting hairs... kind of misses the forest for the trees. Here's my nit to pick: two identical 1st-order lowpass filters in series are only equivalent to a 2nd-order lowpass filter when the quality factor is 0.5.

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Charles Z Henry
On Tue, Mar 19, 2013 at 5:57 PM, Fons Adriaensen f...@linuxaudio.orgwrote: On Tue, Mar 19, 2013 at 05:26:27PM -0500, Charles Z Henry wrote: You guys are splitting hairs... kind of misses the forest for the trees. Here's my nit to pick: two identical 1st-order lowpass filters in series are

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-19 Thread Fons Adriaensen
On Tue, Mar 19, 2013 at 06:12:21PM -0500, Charles Z Henry wrote: If it was always a fixed time over which you need to fade in, I think you could find a good analytical function to use, or make a table that always has a predictable effect. Raised cosine is a good solution, but you don't need

[LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Tim E. Real
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.

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Paul Davis
On Mon, Mar 18, 2013 at 5:50 PM, Tim E. Real termt...@rogers.com wrote: 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

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Fons Adriaensen
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

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Tim E. Real
On March 18, 2013 06:47:16 PM you wrote: On Mon, Mar 18, 2013 at 5:50 PM, Tim E. Real termt...@rogers.com wrote: 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 /

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread James Morris
On 18/03/13 Tim E. Real termt...@rogers.com wrote: On March 18, 2013 06:47:16 PM you wrote: On Mon, Mar 18, 2013 at 5:50 PM, Tim E. Real termt...@rogers.com wrote: Hi again. Looking for any advice, tips, tricks, anecdotes etc. I want to eliminate or reduce 'zipper' noise on volume changes.

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Tim E. Real
On March 18, 2013 07:04:52 PM Tim E. Real wrote: On March 18, 2013 06:47:16 PM you wrote: On Mon, Mar 18, 2013 at 5:50 PM, Tim E. Real termt...@rogers.com wrote: Hi again. Looking for any advice, tips, tricks, anecdotes etc. I want to eliminate or reduce 'zipper' noise on volume changes. So

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Fons Adriaensen
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

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Tim E. Real
On March 18, 2013 11:58:48 PM Fons Adriaensen wrote: 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

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Harry van Haaren
On Mon, Mar 18, 2013 at 11:45 PM, Fons Adriaensen f...@linuxaudio.orgwrote: A critically damped second order lowpass with a rise time of 30 ms or so will eliminate all audible artefacts. It's very low on CPU and you only need to run it while the gain is changing. Although I understand the

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Tim Goetze
[Tim Goetze] [Harry van Haaren] How is the rise time determined here? As a function of the filter's damping (zeta = 2*Q) and frequency: http://en.wikipedia.org/wiki/Rise_time Sorry, zeta = 1 / (2*Q). ___ Linux-audio-dev mailing list

Re: [LAD] Mixing audio: Noiseless volume changes

2013-03-18 Thread Harry van Haaren
On Tue, Mar 19, 2013 at 3:26 AM, Tim Goetze t...@quitte.de wrote: tradition (like RBJ's lovely cookbook at musicdsp) will ask for filter Q, which is 0.5 for critical damping. Nice mention, checked out the code there, will play around with it a bit :)