From the original SynthMaker forum (2004–2014), with its members’ names and dates.
GPK ·
Hello all,
I am currently writing a program that uses a lot of interpolated delays. I want to be able to change the delay time of the interpolated delays dynamically without any clicks occuring in the audio. Does anyone have a simple example of how to do this?
index=index+1;
index=index-(index>=882001)&882001;
array[index] = in + 1e-15 - 1e-15;
outdex = index - offset;
outdex=outdex + (outdex < 0)&882001;
outp = array[outdex];
b = b + (0==(offset==offset1&1))&1;
b = min(b,1);
out = (1-b)*outp + (b)*out;
b = 0.99*b + 1e-10 - 1e-10;
offset1 = offset;
The massive sample limits are due to the fact I use this in my long-delay projects for up to 20 seconds at 44.1KHz. (Just replace 882001 with a more appropriate limit.)
I don't remember how it works exactly (it's smoothing the output with a kind of lowpass filter effect but the details of why I've done it this way elude me right now) ... and I'm not sure if the denormal remover stuff works at all... but it functions and I haven't been motivated to clean it up yet.
EDIT - missed the fact you said 'interpolated delays'.
oddson ·
So, I guess what this is doing is reading when the delay changes and then mixing the delayed signal with a lagged value to act as a smoother.
b = b + (0==(offset==offset1&1))&1;
b = min(b,1);
out = (1-b)*outp + (b)*out;
If offset1 (a lagged offset) is different than the current offset the value of b is increased to 1 from whatever it is currently. Then this is rounded off to 1 by min().
Then the output is a mix of the delay and the lagged output.
The value of b diminishes until it gets swamped out by the + 1e-10 - 1e-10 addition and then runs along at zero until the next change of delay, thus leaving the output as the straight delayed value in between changes.
The same approach can be used with any output function. I'm not sure it's the best and the speed of smoothing is clearly dependent on sample rate with the fixed value for reducing b through each pass. But it worked well enough to allow me to jump the delay around without clicks. No doubt it could be made more elegant.
GPK ·
Thanks a million for the reply Oddson. Yes it's very important that the delays are interpolated in this case.
I tried out this code, but the clicks are still there, although they now sound like lowpass filtered clicks? 🙁
oddson ·
It might be that because an interpolated delay is already a mix of two delay points you need to have a more sophisticated solution.
I'm taking a look at Sam's delay code and I'll see what I can come up with.
GPK ·
Thanks a million! 🙂
MyCo ·
you could also use the new dezipper to smooth the "delay time" input, before you connect it to the interpolated delay. Or just use a lowpass on the "delay time" input stream.
GPK ·
MyCo wrote: you could also use the new dezipper to smooth the "delay time" input, before you connect it to the interpolated delay. Or just use a lowpass on the "delay time" input stream.
Do you have any working examples?
Panoply ·
Either, as Myco says, attach a dezipper module directly before the input to the delay time,
or if you are working with a stream of audio, use a modified slew limiter.
I've built all sorts of flangers and phasers and wonky delay lines using the interpolated delay - it doesn't click.
Wrote something here? To have a post removed or your name hidden, write to [email protected].