; from an original file by Mark Jamerson 2007 ; modified by Bruce Maxwell 2012 ; Select audio/midi flags here according to platform ; Audio out Audio in Virtual MIDI -M0 is needed anyway ;-g -odac -iadc -+rtmidi=virtual -M0 -g -odac -iadc -+rtmidi=portmidi -M0 ; sampling rate sr=44100 ; control rate kr = 4410 ; samples per control ksmps=10 ; number of output channels (1 = mono, 2 = stereo) nchnls=2 ; what is this? massign 1,1 prealloc 1,10 ; instrument 1: a MIDI FM synthesizers instr 1 ;Midi FM synth ; convert from a midi note on inote cpsmidi ; convert from a midi amplitude iveloc ampmidi 1 ; fixed duration idur = 2 ; what is this? xtratim 1 ; oscilate a triangular wave at 10Hz ; this is the frequency modulator kgate oscil 1,50,2 ; noise with amp 100 x pitch frequency, very low cutoff frequency anoise noise 100*inote,.99 ; sample and hold ; passes through the noise signal if kgate != 0 ; kgate is 0 for half of each oscillation ; acps samphold anoise,kgate acps = anoise * kgate ; oscilate amp 1000 at frequency acps function 1 aosc oscili 10000,acps,1 ; output is aosc aout = aosc ; Use controller 7 to control volume kvol ctrl7 1, 7, 0.2, 1 ; output of the instrument outs kvol * aout, kvol * aout endin instr 2 ; a simple buzzy note ; convert from a midi note on inote cpsmidi ; convert from a midi amplitude iveloc ampmidi 1 ; duration of 1s idur = 0.35 a1 oscili 16000, inote, 3 a2 oscili 1, inote*10, 2 a3 linen 1, 0.05*idur, idur, 0.10*idur outs a1*a2*iveloc, a1*a2*iveloc ; outs a1 * kvol, a1 * kvol endin instr 3 ; pluck ; convert from a midi note on inote cpsmidi ; convert from a midi amplitude iveloc ampmidi 1 ; duration of 1s idur = 0.15 a1 pluck 12000, inote, inote, 3, 3, 0.2 a2 linen 1, 0.01*idur, idur, 0.10*idur outs a1*a2*iveloc, a1*a2*iveloc endin instr 4 ; Hammond B3 using FM synthesis ; convert from a midi note on inote cpsmidi ; convert from a midi amplitude iveloc ampmidi 1 ; duration of 1s idur = 0.5 a1 fmb3 10000, inote, 5, 5, .005, 5, 3, 1, 1, 1, 1 a2 linen 1, 0.05*idur, idur, 0.20*idur outs a1*a2*iveloc, a1*a2*iveloc endin ; ? f0 3600 ; GEN 10: simple sine wave f1 0 1024 10 1 ; GEN 7: amp 1 down to zero in 8 steps, hold at 0 for 8 steps f2 0 16 7 1 8 0 8 ; GEN 10: sine wave with harmonics f3 0 1024 10 1 .5 .6 .3 .2 .5 e