;--------------------------------------------------------- ; Drum Kit ; Coded by Hans Mikelson August 25, 1999-March 2000 ;--------------------------------------------------------- sr = 44100 ; Sample rate kr = 4410 ; Kontrol rate ksmps = 10 ; Samples/Kontrol period nchnls = 2 ; Normal stereo zakinit 50,50 ; May need this later ;--------------------------------------------------------- ; Pinkish noise by Richard Dobson (modified somewhat) ;--------------------------------------------------------- instr 1 iseed = p4 iout = p5 aprev init 0 abeta line 0.5, p3, 0.5 ; empirical attempt to keep amplitude constant ampmod = 1 + abeta ampmod = 1.0 / ampmod ; the formula...uses white noise source absqr = sqrt(1.0 - (abeta * abeta)) arand rand 1, iseed anew = (aprev * abeta) + absqr * arand ; X(n) becomes X(n-1) aprev = anew zaw anew * ampmod, iout endin ;--------------------------------------------------------- ; Kick Drum 1 ;--------------------------------------------------------- instr 10 idur = p3 ; Duration iamp = p4 ; Amplitude ilowf = p5 ; Low frequency ihif = p6 ; High freqency ipanl = sqrt(p7) ; Pan left ipanr = sqrt(1-p7) ; Pan right iacc = p8 ; Accent irez = p9 ; Resonance iod = p10 ; Overdrive imix = p11 ; OvrToneMix kfenv linseg ihif, idur*.1/iacc, ihif*.7, idur*.2/iacc, ilowf*1.5, idur-idur*.3/iacc, ilowf ; Freq Envelope kfenv2 linseg ihif*2, idur*.1/iacc, ihif, idur*.2/iacc, ilowf*2, idur-idur*.3/iacc, ilowf*1.2 ; Freq Envelope krenv expseg .7, idur, 1 ; Q Envelope kaenv expseg .1, .001, 1, .02, 1, .04, .7, idur-.061, .4 ; Amp Envelope kdclck linseg 1, idur-.05, 1, .05, 0 ; Declick asigl zar 1 asigr zar 2 asigl = asigl asigr = asigr afltl moogvcf asigl*kaenv, kfenv, irez*krenv ; Moog filter afltl2 moogvcf asigl*kaenv, kfenv2, irez*krenv ; Moog filter aout1l = (afltl+.2*imix*afltl2)*kaenv*iod/iacc ; Scale the sound krmsl rms aout1l, 1000 ; Limiter, get rms kliml table3 krmsl*.5, 5, 1 ; Get limiting value aoutl = aout1l*kliml*iamp*kdclck*iacc ; Scale again and ouput afltr moogvcf asigr*kaenv, kfenv, irez*krenv ; Moog filter afltr2 moogvcf asigr*kaenv, kfenv2, irez*krenv ; Moog filter aout1r = (afltr+.2*imix*afltr2)*kaenv*iod/iacc ; Scale the sound krmsr rms aout1r, 1000 ; Limiter, get rms klimr table3 krmsr*.5, 5, 1 ; Get limiting value aoutr = aout1r*klimr*iamp*kdclck*iacc ; Scale again and ouput outs aoutl*ipanl*3, aoutr*ipanr*3 ; Output the sound endin ;--------------------------------------------------------- ; Snare 4 (Pmask) ;--------------------------------------------------------- instr 34 idur = p3 ; Duration iamp = p4*2 ; Amplitude ifqc = cpspch(p5) ; Pitch to frequency ipanl = sqrt(p6) ; Pan left ipanr = sqrt(1-p6) ; Pan right irez = p7 ; Tone ispdec = p8 ; Spring decay ispton = p9 ; Spring tone ispmix = p10 ; Spring mix ispq = p11 ; Spring Q ipbnd = p12 ; Pitch bend ipbtm = p13 ; Pitch bend time ifqc = ifqc*p14 ; Frequency modifier arndr1 init 0 arndr2 init 0 kdclk linseg 1, idur-.002, 1, .002, 0 ; Declick envelope aamp linseg 1, .2/ifqc, 1, .2/ifqc, 0, idur-.002, 0 ; An amplitude pulse kptch linseg 1, ipbtm, ipbnd, ipbtm, 1, .1, 1 aosc1 vco 1, 400, 2, 1, 1, 1 ; Use a pulse of the vco to stimulate the filters aosc = -aosc1*aamp ; Multiply by the envelope pulse aosc2 butterlp aosc, 12000 ; Lowpass at 12K to take the edge off asig1 moogvcf aosc, ifqc*kptch, .9*irez ; Moof filter with high resonance for basic drum tone asig2 moogvcf aosc*.5, ifqc*2.1*kptch, .75*irez ; Sweeten with an overtone aampr expseg .1, .002, 1, .2, .005 arnd1 zar 1 arnd2 zar 2 arnd1 = arnd1*2*asig1 arndr1 delay arnd1-arndr2*.6, .01 arnd2 = arnd2*2*asig1 arndr2 delay arnd2-arndr1*.6, .01 ahp1l rezzy arnd1+arndr1, 2700*ispton*kptch, 5*ispq, 1 ; High pass rezzy based at 2700 ahp2l butterbp arnd1, 2000*ispton*kptch, 500/ispq ; Generate an undertone ahp3l butterbp arnd1, 5400*ispton*kptch, 500/ispq ; Generate an overtone ahpl pareq ahp1l+ahp2l*.7+ahp3l*.3, 15000, .1, .707, 2 ; Attenuate the highs a bit ahp1r rezzy arnd2+arndr2, 2700*ispton*kptch, 5*ispq, 1 ; High pass rezzy based at 2700 ahp2r butterbp arnd2, 2000*ispton*kptch, 500/ispq ; Generate an undertone ahp3r butterbp arnd2, 5400*ispton*kptch, 500/ispq ; Generate an overtone ahpr pareq ahp1r+ahp2r*.7+ahp3r*.3, 15000, .1, .707, 2 ; Attenuate the highs a bit ; Mix drum tones, pulse and noise signal & declick aoutl = (asig1+asig2+aosc2*.1+ahpl*ispmix*4)*iamp*kdclk*2 aoutr = (asig1+asig2+aosc2*.1+ahpr*ispmix*4)*iamp*kdclk*2 outs aoutl*ipanl, aoutr*ipanr ; Output the sound endin