// Intro to Filters // FIR examples ( SynthDef(\example2a, {arg dur, amp, a0, a1; var src, del, env, out; env = Line.kr(1, 1, dur, doneAction: 2); src = WhiteNoise.ar(amp.dbamp); del = Delay1.ar(src); out = (src * a0) + (del * a1); Out.ar(0, out * env); }).load(s); ) s = Server.internal.boot; FreqScope.new; z = s.scope(1); // first, just the source s.sendBundle(0.1, [\s_new, \example2a, -1, 0, 0, \dur, 3, \amp, -12, \a0, 1, \a1, 0]); // next, acting as a lowpass filter // 6dB/oct. rolloff up to SR/2 s.sendBundle(0.1, [\s_new, \example2a, -1, 0, 0, \dur, 3, \amp, -12, \a0, 0.5, \a1, 0.5]); // inverting the delay with a negative coefficient creates a highpass effect // 6dB/oct. rolloff down to 0Hz s.sendBundle(0.1, [\s_new, \example2a, -1, 0, 0, \dur, 3, \amp, -12, \a0, 0.5, \a1, -0.5]) z.window.close // example2b uses a two sample delay ( SynthDef(\example2b, {arg dur, amp, a0, a1; var src, del, env, out; env = Line.kr(1, 1, dur, doneAction: 2); src = WhiteNoise.ar(amp.dbamp); del = Delay2.ar(src); out = (src * a0) + (del * a1); Out.ar(0, out * env); }).load(s); ) // band reject (notch @ SR/4, 6dB/oct. rolloff) s.sendBundle(0.1, [\s_new, \example2b, -1, 0, 0, \dur, 4, \amp, -12, \a0, 0.5, \a1, 0.5]); // band pass (peak @ SR/4, 6dB/oct. rolloff) s.sendBundle(0.1, [\s_new, \example2b, -1, 0, 0, \dur, 3, \amp, -12, \a0, 0.5, \a1, -0.5])