sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; ; This is fm-drum written by Jan Mattox and distributed with ; CLM (Common Lisp Music). The CLM original is in the file ; fmex.ins. ; ; Note - the low drum is pretty close to the CLM original, but the ; high drum is some way off. ; instr 1 isinetbl = 1 idur = p3 iamp = p4 ifreq = p5 iindx = p6 ihigh = p7 inoiseamp = 1000.0 icasrat = (ihigh > 0 ? 8.525 : 3.515) imodrat = (ihigh > 0 ? 3.414 : 1.414) iamprise = 0.015 iamp1decay = (idur < 0.18 ? 0.5 * idur : 0.18) iamp2decay = idur - (iamprise + iamp1decay) icascadehz = ifreq * icasrat imodhz = ifreq * imodrat icarrhz = ifreq idevscaler = 7000 icascscaler = iindx * icascadehz imodscaler = iindx * imodhz iglsscaler = (ihigh > 0 ? 66.0 : 0.0) ; modulator indices kindxenv transeg .01, .015, 2, 1, .085, -1, 0.333, idur-.10, -1, .012 ; noise envelope does not decay to zero... ; In CLM there is a minor difference for high and low but it ; seems to do little in the generated waveform. knoiseenv expseg .01, .015, 1, .005, 1, .010, .1, .040, .002, idur-.070, 0.01 ; amplitude envelope... kampenv transeg .01, iamprise, 1, 1.0, iamp1decay, 2, .75, iamp2decay, -8, .001 ; gls envelope kgls linseg 0, idur*0.25, 0, idur*.5, 1, idur*.25, 1 ; deviation adev1 rand inoiseamp adevsig = idevscaler * knoiseenv * adev1 adevsig = (icasrat * iglsscaler * kgls) + adevsig ; cacasade acascphs phasor icascadehz + adevsig acascsig tablei acascphs, isinetbl, 1, 0, 1 acascsig = icascscaler * kindxenv * acascsig acascsig = (imodrat * iglsscaler * kgls) + acascsig ; modulator amodphs phasor imodhz + acascsig amodsig tablei amodphs, isinetbl, 1, 0, 1 amodsig = imodscaler * kindxenv * amodsig amodsig = (iglsscaler * kgls) + amodsig ; carrier acarrphs phasor icarrhz + amodsig acarrsig tablei acarrphs, isinetbl, 1, 0, 1 out iamp * acarrsig * kampenv endin
Score:
; Table #1: sinewave f 1 0 1024 10 1 ; # st drn amp hz ix hi i 1 0 1.5 20000 55 5 0 i 1 2 1.5 20000 66 4 1