-odac sr = 44100 ksmps = 16 nchnls = 2 0dbfs = 1 instr 1 ; triggers notes in instrument 2 with randomised p-fields krate randomi 0.2,0.4,0.1 ;rate of note generation ktrig metro krate ;triggers used by schedkwhen koct random 5,12 ;fundemental pitch of synth note kdur random 15,30 ;duration of note schedkwhen ktrig,0,0,2,0,kdur,cpsoct(koct) ;trigger a note in instrument 2 endin instr 2 ; subtractive synthesis instrument aNoise pinkish 1 ;a noise source sound: pink noise kGap rspline 0.3,0.05,0.2,2 ;time gap between impulses aPulse mpulse 15, kGap ;a train of impulses kCFade rspline 0,1,0.1,1 ;crossfade point between noise and impulses aInput ntrpol aPulse,aNoise,kCFade;implement crossfade ; cutoff frequencies for low and highpass filters kLPF_CF rspline 13,8,0.1,0.4 kHPF_CF rspline 5,10,0.1,0.4 ; filter input sound with low and highpass filters in series - ; - done twice per filter in order to sharpen cutoff slopes aInput butlp aInput, cpsoct(kLPF_CF) aInput butlp aInput, cpsoct(kLPF_CF) aInput buthp aInput, cpsoct(kHPF_CF) aInput buthp aInput, cpsoct(kHPF_CF) kcf rspline p4*1.05,p4*0.95,0.01,0.1 ; fundemental ;bandwidth for each filter is created individually as a random spline function kbw1 rspline 0.00001,10,0.2,1 kbw2 rspline 0.00001,10,0.2,1 kbw3 rspline 0.00001,10,0.2,1 kbw4 rspline 0.00001,10,0.2,1 kbw5 rspline 0.00001,10,0.2,1 kbw6 rspline 0.00001,10,0.2,1 kbw7 rspline 0.00001,10,0.2,1 kbw8 rspline 0.00001,10,0.2,1 kbw9 rspline 0.00001,10,0.2,1 kbw10 rspline 0.00001,10,0.2,1 kbw11 rspline 0.00001,10,0.2,1 kbw12 rspline 0.00001,10,0.2,1 kbw13 rspline 0.00001,10,0.2,1 kbw14 rspline 0.00001,10,0.2,1 kbw15 rspline 0.00001,10,0.2,1 kbw16 rspline 0.00001,10,0.2,1 kbw17 rspline 0.00001,10,0.2,1 kbw18 rspline 0.00001,10,0.2,1 kbw19 rspline 0.00001,10,0.2,1 kbw20 rspline 0.00001,10,0.2,1 kbw21 rspline 0.00001,10,0.2,1 kbw22 rspline 0.00001,10,0.2,1 imode = 0 ; amplitude balancing method used by the reson filters a1 reson aInput, kcf*1, kbw1, imode a2 reson aInput, kcf*1.0019054878049, kbw2, imode a3 reson aInput, kcf*1.7936737804878, kbw3, imode a4 reson aInput, kcf*1.8009908536585, kbw4, imode a5 reson aInput, kcf*2.5201981707317, kbw5, imode a6 reson aInput, kcf*2.5224085365854, kbw6, imode a7 reson aInput, kcf*2.9907012195122, kbw7, imode a8 reson aInput, kcf*2.9940548780488, kbw8, imode a9 reson aInput, kcf*3.7855182926829, kbw9, imode a10 reson aInput, kcf*3.8061737804878, kbw10,imode a11 reson aInput, kcf*4.5689024390244, kbw11,imode a12 reson aInput, kcf*4.5754573170732, kbw12,imode a13 reson aInput, kcf*5.0296493902439, kbw13,imode a14 reson aInput, kcf*5.0455030487805, kbw14,imode a15 reson aInput, kcf*6.0759908536585, kbw15,imode a16 reson aInput, kcf*5.9094512195122, kbw16,imode a17 reson aInput, kcf*6.4124237804878, kbw17,imode a18 reson aInput, kcf*6.4430640243902, kbw18,imode a19 reson aInput, kcf*7.0826219512195, kbw19,imode a20 reson aInput, kcf*7.0923780487805, kbw20,imode a21 reson aInput, kcf*7.3188262195122, kbw21,imode a22 reson aInput, kcf*7.5551829268293, kbw22,imode ; amplitude control for each filter output kAmp1 rspline 0, 1, 0.3, 1 kAmp2 rspline 0, 1, 0.3, 1 kAmp3 rspline 0, 1, 0.3, 1 kAmp4 rspline 0, 1, 0.3, 1 kAmp5 rspline 0, 1, 0.3, 1 kAmp6 rspline 0, 1, 0.3, 1 kAmp7 rspline 0, 1, 0.3, 1 kAmp8 rspline 0, 1, 0.3, 1 kAmp9 rspline 0, 1, 0.3, 1 kAmp10 rspline 0, 1, 0.3, 1 kAmp11 rspline 0, 1, 0.3, 1 kAmp12 rspline 0, 1, 0.3, 1 kAmp13 rspline 0, 1, 0.3, 1 kAmp14 rspline 0, 1, 0.3, 1 kAmp15 rspline 0, 1, 0.3, 1 kAmp16 rspline 0, 1, 0.3, 1 kAmp17 rspline 0, 1, 0.3, 1 kAmp18 rspline 0, 1, 0.3, 1 kAmp19 rspline 0, 1, 0.3, 1 kAmp20 rspline 0, 1, 0.3, 1 kAmp21 rspline 0, 1, 0.3, 1 kAmp22 rspline 0, 1, 0.3, 1 ; left and right channel mixes are created using alternate filter outputs. ; This shall create a stereo effect. aMixL sum a1*kAmp1,a3*kAmp3,a5*kAmp5,a7*kAmp7,a9*kAmp9,a11*kAmp11,\ a13*kAmp13,a15*kAmp15,a17*kAmp17,a19*kAmp19,a21*kAmp21 aMixR sum a2*kAmp2,a4*kAmp4,a6*kAmp6,a8*kAmp8,a10*kAmp10,a12*kAmp12,\ a14*kAmp14,a16*kAmp16,a18*kAmp18,a20*kAmp20,a22*kAmp22 kEnv linseg 0, p3*0.5, 1,p3*0.5,0,1,0 ; global amplitude envelope outs (aMixL*kEnv*0.00008), (aMixR*kEnv*0.00008) ; audio sent to outputs endin i 1 0 3600 ; instrument 1 (note generator) plays for 1 hour e ;example written by Iain McCurdy