4:09 pm

November 24, 2013

Hi,

I have a question related to how to set the frequency cut of a low pass filter based on time, I would like to find a way to set the parameter smoothing in ms instead of using frequency cut (which I believe is not very intuitive at first sight).

Let's say I want to smooth a parameter in 20 ms. how you know which frequency cut to choose?

I was trying to use:

fs = 44100.0;

smoothingTime = 0.02; // 20 ms.

fc = 1 / (2 * PI * smoothingTime);

b1 = exp(-2 * PI * (fc / fs));

a0 = 1 - b1;

But this reaches up to 63% of the "capacitor charge".

I read that at 5tau the capacitor reach the theoretical 100% but even using that it doesn't reach the desired value at smoothingTime. I had to use about 9tau to get the best approximation but I don't understand why 9tau.

Do I'm missing something?

Thanks!

5:03 am

November 24, 2013

Hi Will,

I think I found a pretty decent solution for this, is the same solution that you applied in the envelope detector using the digital time constant:

const float DIGITAL_TC = -5.0; // ln(0.00673) -> 0.0673% (5TC ~= 99.327% of capacitor charge)

b1 = exp( DIGITAL_TC / (smoothignTimeInMs * sampleRate * 0.001));

a0 = 1.0 - b1;

I don't know if you noticed but you have different values in your code for DIGITAL_TC and ANALOG_TC:

const float DIGITAL_TC = -2.0; // log(1%)

const float ANALOG_TC = -0.43533393574791066201247090699309; // (log(36.7%)

This is because you calculated the constant values using logarithm base 10 and not natural logarithm!

Also you can verify that the musicdsp.org link uses log(0.01) (natural logarithm in C++):

http://www.musicdsp.org/showAr.....hiveID=136

Please let me know if there is a specific reason to have those values calculated with log10 instead of ln!

2:48 pm

November 24, 2013

6:03 pm

January 29, 2017

Hi Alex

WOW! You are correct. I went back to early revs of RAFX (when it was called Socket) and found the version where this happened. Originally, when the user switched from analog to digital mode, the TC was re-calculated each time with C++ log( ). Right before the proofs went out on the FX book, I changed this and hardcoded it with my HP11C, but yeah just punched log() there instead of ln(). The new constants are:

DIGITAL_TC = -4.605

ANALOG_TC = -1.00239343

I will change these in the next version of RackAFX as well.

Thanks for catching this!

Will

6:05 pm

January 29, 2017

Also, if you check the Note Expression Synth in the VST3 SDK you will see Steinberg's solution, which is the same as the MMA DLS Level II spec, for smoothing controller changes. It uses the ramp method of linear smoothing and requires intermediate variables as well to slow down the controller change variables.

- Will

Most Users Ever Online: 36

Currently Online: TheSmile

3 Guest(s)

Currently Browsing this Page:

1 Guest(s)

Top Posters:

Skyler: 48

Derek: 46

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

JimmyM: 30

TheSmile: 27

EZB: 24

lppier: 23

Member Stats:

Guest Posters: 1

Members: 522

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 31

Topics: 545

Posts: 2134

Newest Members:

Bill, hill william, NAUN_SONAR, sufy, Diane, Richard, drvenkman, venkman, Jfx, drorhModerators: W Pirkle: 247

Administrators: Tom: 67, JD Young: 80, Will Pirkle: 0, W Pirkle: 247