Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created April 4, 2021 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/53093aabcfc133c54081ad1b002d86c0 to your computer and use it in GitHub Desktop.
Save jpcima/53093aabcfc133c54081ad1b002d86c0 to your computer and use it in GitHub Desktop.
import("stdfaust.lib");
snes_fir(x) = sum(i, 8, in(i) * tap(i)) with {
refSR = 32000; // sample rate of SNES
// the filter inputs
in(0) = x; // at 0 it's the undelayed input sample
// at I, it's the sample at I frames back based on SNES reference rate
// convert this sample delay to DAC rate, which gives a fractional time
in(i) = x : de.fdelay(64, i*(ma.SR/refSR));
// the Ith value of the FIR filter, as a 0-1 slider
// first tap is default to 1, others 0
tap(i) = hgroup("Coefficients",
vslider("[%i] FIR Tap %i", ba.if(i == 0, 255, 0), 0, 255, 0)) : /(255.0);
};
// test by sending noise in the filter, and output in stereo
process = testSignal : snes_fir <: (_, _) with {
testSignal = no.noise : *(0.25);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment