Skip to content

Instantly share code, notes, and snippets.

@fukuroder
Last active September 2, 2017 01:16
Show Gist options
  • Save fukuroder/46d4bf2a8d1ec5815568400b850fc6d0 to your computer and use it in GitHub Desktop.
Save fukuroder/46d4bf2a8d1ec5815568400b850fc6d0 to your computer and use it in GitHub Desktop.
faustでBiQuadフィルタの練習
cutoff = hslider("[0]cutoff", 200, 20, 2000, 0.1);
resonance = hslider("[1]resonance", 0.707, 0.707, 20, 0.01);
low = hslider("[2]low", 1.0, 0.0, 1.0, 0.01);
band = hslider("[3]band", 1.0, 0.0, 1.0, 0.01);
high = hslider("[4]high", 1.0, 0.0, 1.0, 0.01);
pi = 3.141592;
s = tan( cutoff * pi / 44100.0 );
t = s / resonance;
u = s*s + t + 1.0;
a0 = (low*s*s + band*t + high)/u;
a1 = 2.0*(low*s*s - high)/u;
a2 = (low*s*s - band*t + high)/u;
b1 = (-2.0)*(s*s - 1.0)/u;
b2 = (-1)*(s*s - t + 1.0)/u;
biquad=(_<:(_',_))<:((_<:(_',_)),_):(*(a2),*(a1),*(a0)):> +~(_<:(_',_):(*(b2),*(b1)):>_);
process=(biquad,biquad);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment