sr = 44100 kr = 4410 ksmps = 10 nchnls = 2 /* Use normalized signals */ 0dbfs = 1.0 /** * Simple Saw Synth * * @p4 Amplitude * @p5 Pitch using pitch-class value notation * @p6 Pan position, left = 0.0, right = 1.0 */ instr 1 /* P-fields */ idur = p3 iamp = p4 ipitch = cpspch(p5) ipan = p6 /* Amplitude envelope */ irise = idur * 0.25 ifall = idur * 0.75 kampEnv linseg 0, irise, iamp, ifall, 0 /* Oscillator */ aosc oscil kampEnv, ipitch, 1 /* Filter envelope */ kfilterEnv expon 20000, idur, 70 /* Low-pass filter */ afilter butlp aosc, kfilterEnv /* Pan */ aout0 = afilter * sqrt(1 - ipan) aout1 = afilter * sqrt(ipan) /* Output */ outs aout0, aout1 endin /* Function Tables */ f 1 0 8192 7 -1 8192 1 /* Rising Saw */ /* Compound note */ i 1 0 4 0.5 7.00 0.1 i 1 0.2 4 0.5 7.001 0.9