Also I'd encourage you to keep experimenting with options for modulating the delay time with an envelope or lp filter.

Cheers,

Jim

]]>I have found a solution.

Like you said, you must have a linear ramp from 0 to 1 or 1 to 0 to prevent the discontinuities.

With the EnvelopeFollower object, when the value detected is above a threshold, you modulate the distance between the threshold and the detected value.

For that, you can do like you explain with :

x = fmin(fmax( x + c, 0.0),1.0);

Or normalize the value between a min and max with the function doUnipolarModulation.

I have test it by modulating the depth and the rate and it's working

Now, the way to do the duck delay is clear.

Thank you very much for the help

]]>Yep you'll probably want the delay fully off when the effect is not meant to be on.

so x is just a linear ramp from 0 to 1 or 1 to 0;

x = fmin(fmax( x + c, 0.0),1.0); where is c is + or - some small value i.e .001

you'd typically set the condition c of being positive or negative according to whether or not the threshold has been met.

The sqrt is then just a waveshaper which approximates that ramp to a sinus function although you could use trigonometry or various other functions.

You have the output equation right.

]]>When I said it was working, it's not exactly true.

I recorded some wave file with my guitar to test the plugin.

The audio level is very low so when I strum stronger, you can hear the effect.

However, when I use an audio file with higher level, the effect is always on.

It seems necessary to use a threshold.

In an article for a reverse delay, there is this function for smoothing the reverse signal :

double getGain(double coef) {return 4.0 * coef * (1.0 - coef);}

where coef is the i th element of the delayed signal divide by the delay time.

If I understand what you say previously, you suggest to fade the signal with

output = sqrt(1-x) * inputdry + sqrt(x) * inputdelayed;

Where x is the ouput of a sinus function ?

Best Regards, Johan.

]]>

Incidentally I'd like to reconsider my recommendation of an equal gain crossfading curve as opposed to an equal power one would probably suit better.

i.e something akin to sqrt(x) and sqrt(1-x) rather than x and 1-x - for values of x clamped between 0 and 1.

This can just be achieved by waveshaping the linear xfade with the sqrt or some equivalent type of function. sin(pi/2*x), cos(pi/2*x)

This avoids volume dips when the signals are uncorrelated though it will raise the volume slightly otherwise but is a less noticeable estimate in this context

Cheers

]]>I solve the problem

Instead of having a value of 0 or 1, I take the output of the envelope detector (which is between [0, 1] and smooth) and set it as the delay time.

]]>Sometimes Will is away from the forum for a whiles but I can probably help you here.

Since your delay time of 0 is equal to the dry. Then you can just set up a cross-fading mechanism to smoothly switch between dry and delayed signal.

You can do this in a couple of ways, there was a recent forum discussion on here about exponential smoothing but linear ramping is probably the best choice for this case.

I believe there is code for a linear ramp/smoothing function in Will's fxobects.h file though it's also not too hard to write one yourself.

If output = (1.- x) * inputdry + (x) * inputdelayed;

then you need x to be a value of 1 above the threshold and 0 below it.

so simply smooth x first via your choice of filter.

To avoid audible clicks you will probably need the smoothing time to be at least 5ms. It's easiest to check for clicks in this context using a low frequency sine wave.

Great idea by the way.

]]>I have recently bought your excellent book for making audio plugins. I’ve got a question for the implementation of the Dyna-Flanger on the Chapter 15 (Modulation Delay). My idea to implement it is to set the delay time to 0 when the envelope doesn’t detect a value higher than the threshold. However, it creates a « click » when the flanger is applied. How is it possible to fix it ?

Best regards, Johan.

]]>