Hello Will,

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.

Hi Johan,

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.

Awesome, but now volume dynamics are pitch modulating the effect? Very cool stuff.

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

Hello Jim,

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.

Hi Johan,

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.

Thank you very much for the answer !

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

Most Users Ever Online: 152

Currently Online:

4 Guest(s)

Currently Browsing this Page:

1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

clau_ste: 39

Nickolai: 39

JimmyM: 33

Gwen: 32

Member Stats:

Guest Posters: 1

Members: 738

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 815

Posts: 3146

Moderators: W Pirkle: 656