IIR
IIR sets up an infinite impulse response (or recursive) filter with center frequency, bandwidth, and amplitude boost defined in triplets by the setup() command. IIR can take as its input a soundfile (INPUTSIG), white noise (NOISE), a pulse train (PULSE), or a buzzing signal (BUZZ). IIR filters are excited based on previous output samples as well as previous input samples, so that they can ring down infinitely using the equation:
   y(n)=a0x(n)-b1y(n-1)-b2y(n-2)...bNy(n-N)
where y is an output sample at time n, x is an input sample, and a0 and bN are filter coefficients that are determined by the shape of the filter desired
(blatantly stolen from Dodge and Jerse, 1985). The number of coefficients used based on past output samples is called the number of poles in the filter. IIR uses a standard 4-pole filter equation.
At least, that's what we'd like you to think.
Syntax:
for all variations:
setup(f0, bw0, a0, f1, bw1, a1...) /* defines the filter in center frequency/bandwidth/relative amplitude triplets -- up to 64 peaks can be defined in a single call */
makegen(1, 24, 1000, t0, a0, t1, a1...) /* defines the envelope of the output signal in time/amplitude pairs */
for processing an input signal:
INPUTSIG(outskip, inskip, duration, amplitude, inchan, spread)
for processing noise:
NOISE(outskip, duration, amplitude, spread)
for processing a buzz signal:
makegen(2, 10, 1024, 1) /* sine wave -- BUZZ requires 1024 points */
BUZZ(outskip, duration, amplitude, pitch, spread)
for processing a pulse signal:
PULSE(outskip, duration, amplitude, pitch, spread)
in comment form:
/* IIR -- creates an iir filter with up to 64 resonance peaks, specifiable
* center frequency and bandwidth for each peak
*
* subcommands:
*
* setup()
* p0 = center frequency 1 (hertz or oct.pc)
* p1 = bandwidth 1 (or multiplier of cf if negative)
* p2 = relative amplitude 1
*
*
* INPUTSIG()
* p0 = output skip
* p1 = input skip
* p2 = duration
* p3 = amplitude multiplier
* p4 = input channel (0 or 1)
* p5 = stereo spread (0-1) [optional]
* assumes function table 1 is the amplitude envelope
*
* NOISE()
* p0 = start
* p1 = duration
* p2 = amplitude
* p3 = stereo spread (0-1) [optional]
* assumes function table 1 is the amplitude envelope
*
* BUZZ()
* p0 = start
* p1 = duration
* p2 = amplitude
* p3 = pitch (hz or oct.pc)
* p4 = stereo spread (0-1) [optional]
* assumes function table 1 is the amplitude envelope
* assumes function table 2 is a sine wave (1024 points)
*
* PULSE()
* p0 = start
* p1 = duration
* p2 = amplitude
* p3 = pitch (hz or oct.pc)
* p4 = stereo spread (0-1) [optional]
* assumes function table 1 is the amplitude envelope
*
*/
An example score using INPUTSIG():
rtsetparams(44100, 2)
load("IIR")
rtinput("/sndh/bob.dole.mono.snd")
makegen(1, 24, 1000, 0, 0, 1,1, 5,1, 7,0)
setup(149.0, 25.0, 1.0, 1415.0, 100.0, 0.8)
INPUTSIG(0, 0, 7, 0.3, 0)
setup(9.0, 25.0, 1.0, 10.0, 100.0, 0.8)
INPUTSIG(8, 0, 7, 0.15, 0)
Another score, using NOISE():
rtsetparams(44100, 2)
load("IIR")
makegen(1, 24, 1000, 0,0, 0.1,1, 0.2,0)
start = 0
for(pc = 0; pc < 0.25; pc = pc + 0.01) {
setup(8.00 + pc, 1.0, 1.0)
NOISE(start, 0.2, 5000, random())
start = start + 0.1
}
A third score, using BUZZ() and PULSE():
rtsetparams(44100, 2)
load("IIR")
makegen(1, 24, 1000, 0,1, 0.1,0)
makegen(2, 10, 1024, 1)
pitch = 134.0
for(start = 0; start < 7.8; start = start + 0.1) {
setup((random()*2000.0) + 300.0, -0.5, 1)
BUZZ(start, 0.1, 4000, pitch, random())
BUZZ(start, 0.1, 4000, pitch + 2.5, random())
/* pitch = pitch + 0.5 */
}
for(start = 7.8; start < 15; start = start + 0.1) {
setup((random()*2000.0) + 200.0, -0.5, 1)
PULSE(start, 0.1, 8000, pitch, random())
PULSE(start, 0.1, 8000, pitch + 2.5, random())
pitch = pitch - 0.5
}