Old 09-16-2020, 12:44 AM   #1
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,098
Default What's wrong with this JS filter mod?

Got problems with an LP filter (EEL). It works fine, as long as I don't change freq from default and then put freq back to default again. If I do, the signal starts resonating up through the roof. Not sure if the Q values make it unstable? Could use some feedback (no pun intended), can't seem to fix it myself.

It's a simple modification of an teej RBJ design, and I need it to run on 48k projects, hence the 24kHz top value.
I'm pretty sure the problem is not because I set the filter slopes through simple slider values. Original Q settings code commented out.

If anyone can reproduce this error, it'd be nice to hear just that too.


Code:
slider1:1<0,1,1>LPF OFF/ON
slider2:24000<3500,24000,10>LPF
slider3:0.78<0.35,0.8,0.01>LPF Q
slider4:0<-18,18,0.1>OUTPUT

@init

// cDcAdd = 10^-30;
// cDenorm = 10^-30;

@slider

a9 = 1;
s9 = 2;
q9 = slider3;
// q9 = 1 / (sqrt((a9 + 1/a9)*(1/s9 - 1) + 2));
w09 = 2 * $pi * slider2/srate;
cosw09 = cos(w09);
sinw09 = sin(w09);
alpha9 = sinw09 / (2 * q9);
b09 = (1 - cosw09)/2;
b19 = (1 - cosw09);
b29 = (1 - cosw09)/2;
a09 = 1 + alpha9;
a19 = -2 * cosw09;
a29 = 1 - alpha9;
b09 /= a09;
b19 /= a09;
b29 /= a09;
a19 /= a09;
a29 /= a09;

gain = 10^(slider4/20);

@sample

slider1 != 0 ? (
ospl0 = spl0;
spl0 = b09 * spl0 + b19 * xl19 + b29 * xl29 - a19 * yl19 - a29 * yl29;
xl29 = xl19;
xl19 = ospl0;
yl29 = yl19;
yl19 = spl0;
ospl1 = spl1;
spl1 = b09 * spl1 + b19 * xr19 + b29 * xr29 - a19 * yr19 - a29 * yr29;
xr29 = xr19;
xr19 = ospl1;
yr29 = yr19;
yr19 = spl1;
);

spl0 *= gain;
spl1 *= gain;
Thanks for any suggestions
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears

Last edited by Colox; 09-16-2020 at 12:53 AM.
Colox is offline   Reply With Quote
Old 09-16-2020, 10:54 PM   #2
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,098
Default

Managed to fix it. Turns out it was the on/off slider in combo with the freq slider. The ...
Code:
slider1 != 0 ? ( .. );
Adding a dependency for the freq slider too solves this.
Code:
slider1 != 0 %% slider2 != 24000 ? ( .. );
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears

Last edited by Colox; 09-16-2020 at 11:02 PM.
Colox is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.