p0 = output start time (seconds) p1 = input start time (seconds) p2 = input duration (seconds) p3 = amplitude multiplier (relative multiplier of input signal) p4 = filter order (higher order allows steeper slope) p5 = input channel p6 = pan (0-1 stereo; 0.5 is middle) p7 = bypass filter (0: bypass off, 1: bypass on) (usually use 0) p8 = reference to frequency response table p3 (amplitude), p6 (pan) and p7 (bypass) can receive dynamic updates from a table or real-time control source. p8 should be a reference to a pfield table-handle. Author: John Gibson, 7/3/99; rev for v4, JGG, 7/24/04 Filter design code adapted from Bill Schottstaedt's Snd.
The desired frequency response curve is described by a table specification
of
Example:
JFIR
Can only process 1 channel at a time. To process stereo, call twice --
once with inputchan=0 (p5) and PAN=0 (p6), again with inputchan=1 and PAN=1.
JFIR can produce either stereo or mono output.
nyq = 44100 / 2
table = maketable("line", 5000, 0,0, 200,0, 300,1, 2000,1, 4000,0, nyq,0)
With a high order, this should attenuate everything below 200 Hz and
above 4000 Hz. NOTE: Be sure to use the "nonorm" option
for
maketable
when specifying the frequency response curve.
Sample Scores
very basic:
rtsetparams(44100, 2)
load("JFIR")
rtinput("mysound.aif")
inchan = 0
inskip = 0
dur = DUR()
start = 0
amp = 2.5
order = 300
nyq = 44100 / 2
freqresp = maketable("line", "nonorm", 5000,
0,0, 100,0, 200,1, 700,1, 1000,0, 1500,0, 1600,.8, 2200,.8, 4000,0, nyq,0)
env = maketable("line", 1000, 0,0, 1,1, 7,1, 9,0)
pan = 0.5
bypass = 0
JFIR(start, inskip, dur, amp * env, order, inchan, pan, bypass, freqresp)
slightly more advanced:
rtsetparams(44100, 2)
load("JFIR")
rtinput("mysound.aif")
inchan = 0
inskip = 0.7
filedur = DUR() - 0.7
reset(4000)
env = maketable("line", 12000, 0,0, 1,1, 29,1, 30,0)
amp = 4.0
dur = 0.05
pan = 0.5
bypass = 0
cflist = { 500, 2000, 1000, 750, 3000, 180, 1700, 5000, 1400, 450, 900, 2200 }
numcf = len(cflist)
half_bandwidth_percent = 0.50
nyquist = 44100 / 2
order = 300
for (st = 0; st < filedur - dur; st += dur) {
n = (st / filedur) * (numcf - 1)
cf = cflist[trunc(n)]
low = cf - (cf * half_bandwidth_percent)
high = cf + (cf * half_bandwidth_percent)
freqresp = maketable("line", 5000, 0,0, low,0, cf,1, high,0, nyquist,0)
JFIR(st, inskip, dur, amp * env, order, inchan, pan, bypass, freqresp)
inskip += dur
}
See Also
BUTTER
ELL
EQ
FILTERBANK,
FILTSWEEP,
FIR,
IIR,
MOOGVCF,
MULTEQ