Skip to content

Commit

Permalink
Release QuickFilter v1.0 (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagolr committed Nov 25, 2023
1 parent 5849eea commit 72270f4
Show file tree
Hide file tree
Showing 2 changed files with 1,311 additions and 0 deletions.
83 changes: 83 additions & 0 deletions Filter/tilr_QuickFilter.jsfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
desc: QuickFilter
author: tilr
version: 1.0
provides: tilr_QuickFilter/qf.svf_filter.jsfx-inc
about:
# QuickFilter

Simple filter with 9 modes and smooth interpolation.

import qf.svf_filter.jsfx-inc

slider1:0<0,9,1{Low-Pass,High-Pass,Band-Pass,Band-Pass2,EQ Bell,Notch,All-Pass,Low-Shelf,High-Shelf}>Mode
slider2:1000<10,22000,1:log>Freq (Hz)
slider3:0.0<-36.0,36.0,0.1>Gain (dB)
slider4:0.71<0.1,40.0,0.01:log>Q
slider6:-120.0<-120.0,24.0,0.1>Dry (dB)
slider7:0.0<-120.0,24.0,0.1>Wet (dB)

@init
function db2gain (db) ( 10^(db / 20); );
function rc_set(rc)
instance(a) (
a = 1 / (rc * srate + 1);
);
function rc_lp(sample)
instance(lp, a) (
lp += a * (sample - lp);
);
function smooth()
instance (lp, smooth) (
lp = smooth;
smooth = this.rc_lp(this);
);

dry.rc_set(0.0033);
dry.smooth = db2gain(slider6);
wet.rc_set(0.0033);
wet.smooth = db2gain(slider7);

filter.svf_set_sample_rate(srate);

@slider

mode = min(max(0, slider1|0), 9);
freq = slider(2);
gain = db2gain(slider3);
q = slider4;
dry = db2gain(slider6);
wet = db2gain(slider7);

mode == 0 ? filter.svf_lp(freq, q, 1) :
mode == 1 ? filter.svf_hp(freq, q, 1) :
mode == 2 ? filter.svf_bp(freq, q) :
mode == 3 ? filter.svf_bp2(freq, q) :
mode == 4 ? filter.svf_eq(freq, q, gain) :
mode == 5 ? filter.svf_bs(freq, q) :
mode == 6 ? filter.svf_ap(freq, q) :
mode == 7 ? filter.svf_ls(freq, q, gain) :
filter.svf_hs(freq, q, gain);

slider_show(slider3, mode == 4 || mode == 7 || mode == 8);

@sample

last_play_state == 0 && play_state ? (
filter.svf_single_set_to_target(); // FIX
);
last_play_state = play_state;

filter.svf_tick();
dry.smooth();
wet.smooth();

l = filter.svf_svf0(spl0);
r = filter.svf_svf1(spl1);

mode == 3 ? ( // bandpass2 gain compensation
l *= q;
r *= q;
);

spl0 = dry.smooth * spl0 + wet.smooth * l;
spl1 = dry.smooth * spl1 + wet.smooth * r;
Loading

0 comments on commit 72270f4

Please sign in to comment.