Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Implementation of the Dyna-Flanger (Homework Ch15)
Avatar
Member
Members
September 27, 2021 - 5:35 am
Member Since: September 27, 2021
Forum Posts: 4
sp_UserOfflineSmall Offline

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.

Avatar
Admin
October 2, 2021 - 11:08 am
Member Since: January 1, 2020
Forum Posts: 70
sp_UserOfflineSmall Offline

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. 

Avatar
Member
Members
October 6, 2021 - 6:24 am
Member Since: September 27, 2021
Forum Posts: 4
sp_UserOfflineSmall Offline

Hello and thank you for the answer !

I solve the problem Laugh

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.

Avatar
Admin
October 7, 2021 - 11:02 am
Member Since: January 1, 2020
Forum Posts: 70
sp_UserOfflineSmall Offline

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

Avatar
Member
Members
October 11, 2021 - 9:54 am
Member Since: September 27, 2021
Forum Posts: 4
sp_UserOfflineSmall Offline

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.

Avatar
Admin
October 12, 2021 - 10:03 am
Member Since: January 1, 2020
Forum Posts: 70
sp_UserOfflineSmall Offline

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.

Avatar
Member
Members
October 13, 2021 - 6:44 am
Member Since: September 27, 2021
Forum Posts: 4
sp_UserOfflineSmall Offline

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 Wink

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

Thank you very much for the help Laugh

Avatar
Admin
October 14, 2021 - 10:04 am
Member Since: January 1, 2020
Forum Posts: 70
sp_UserOfflineSmall Offline

Great to hear, pleasure Johan. Feel welcome to post any further further questions .

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

Cheers,

Jim

Forum Timezone: America/New_York

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