View Single Post
Old 01-15-2020, 12:51 PM   #2
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 550
Default

The tone control is two basic peak filters. You could edit out the delay code and continue to use the tone control as is. Or you could use ReaEQ. The result will be identical with the right BW value. 3-Band-EQ uses shelves so not the same.

Code:
desc: Tone Control

slider1:0<-60,60,0.1>Bass Gain (dB)
slider2:200<20,500,1>Bass Frequency (Hz)
slider3:0<-60,60,0.1>Treble Gain (dB)
slider4:4000<500,20000,1>Treble Frequency (Hz)

in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output

@init

Bc0=Bc1=Bc2=0;
Bli1=Bli2=Bri1=Bri2=0;
Tc0=Tc1=Tc2=0;
Tli1=Tli2=Tri1=Tri2=0;

@slider

width=1.5;
// bass control
arc=(2*$pi*slider2)/srate;
gain=(2^(slider1/6));
a=(sin(arc)*width) * (gain < 1 ? 1 : 0.25);
tmp=1/(1+a);  
Bc0=tmp*a*(gain-1);
Bc1=tmp*2*cos(arc);
Bc2=tmp*(a-1);

// treble control
arc=(2*$pi*slider4)/srate;
gain=(2^(slider3/6));
a=(sin(arc)*width) * (gain < 1 ? 1 : 0.25);
tmp=1/(1+a);  
Tc0=tmp*a*(gain-1);
Tc1=tmp*2*cos(arc);
Tc2=tmp*(a-1);

@sample

Btmp=Bc0*(spl0-ldelay2) + Bc1*Bli1 + Bc2*Bli2;
Ttmp=Tc0*(spl0-ldelay2) + Tc1*Tli1 + Tc2*Tli2;
ldelay2=ldelay1; ldelay1=spl0; 
Tli2=Tli1; spl0 += (Tli1=Ttmp);
Bli2=Bli1; spl0 += (Bli1=Btmp);

Btmp=Bc0*(spl1-rdelay2) + Bc1*Bri1 + Bc2*Bri2;
Ttmp=Tc0*(spl1-rdelay2) + Tc1*Tri1 + Tc2*Tri2;
rdelay2=rdelay1; rdelay1=spl1; 
Tri2=Tri1; spl1 += (Tri1=Ttmp);
Bri2=Bri1; spl1 += (Bri1=Btmp);
ErBird is offline   Reply With Quote