Skip to content

Instantly share code, notes, and snippets.

@jpcima
Last active July 1, 2019 07:38
Show Gist options
  • Save jpcima/208ec17fcfd3cdf130552ac3e235457d to your computer and use it in GitHub Desktop.
Save jpcima/208ec17fcfd3cdf130552ac3e235457d to your computer and use it in GitHub Desktop.
Quadrafuzz
// A port of Quadrafuzz effect from Pizzicato
// https://alemangui.github.io/pizzicato/#quadrafuzz
import("stdfaust.lib");
msp = library("maxmsp.lib");
quadrafuzz(x) = dry_gain * x + low_band(x) + mid1_band(x) + mid2_band(x) + hi_band(x)
with {
dry_gain = hslider("[1]Dry gain", 0, 0, 1, 0.01) : si.smoo;
wet_gain = hslider("[2]Wet gain", 1, 0, 1, 0.01) : si.smoo;
low_gain = hslider("[3]Low drive", 0.6, 0, 1, 0.01) : si.smoo;
mid1_gain = hslider("[4]Mid-Low drive", 0.8, 0, 1, 0.01) : si.smoo;
mid2_gain = hslider("[5]Mid-High drive", 0.5, 0, 1, 0.01) : si.smoo;
hi_gain = hslider("[6]High drive", 0.6, 0, 1, 0.01) : si.smoo;
low_filter(x) = msp.LPF(x, 147, 0, Q);
mid1_filter(x) = msp.BPF(x, 587, 0, Q);
mid2_filter(x) = msp.BPF(x, 2490, 0, Q);
hi_filter(x) = msp.HPF(x, 4980, 0, Q);
// the Q formula from Firefox WebAudio
Q = 1.0 / pow(10, -0.05 * resonance) with { resonance = 0.7071; };
low_band = *(wet_gain) : low_filter <: distort(_, low_gain);
mid1_band = *(wet_gain) : mid1_filter <: distort(_, mid1_gain);
mid2_band = *(wet_gain) : mid2_filter <: distort(_, mid2_gain);
hi_band = *(wet_gain) : hi_filter <: distort(_, hi_gain);
distort(x, gain) = (3 + gain * 150) * x * 20 * deg / (ma.PI + gain * 150 * abs(x))
with { deg = ma.PI / 180; };
};
process = quadrafuzz;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment