-odac sr = 44100 ksmps = 16 nchnls = 1 0dbfs = 1 gisine ftgen 0,0,2^10,10,1 ; define the macro #define ADDITIVE_TONE(Frq'Ratio1'Ratio2'Ratio3'Ratio4'Ratio5'Ratio6) # iamp = 0.1 aenv expseg 1,p3*(1/$Ratio1),0.001,1,0.001 a1 poscil iamp*aenv,$Frq*$Ratio1,gisine aenv expseg 1,p3*(1/$Ratio2),0.001,1,0.001 a2 poscil iamp*aenv,$Frq*$Ratio2,gisine aenv expseg 1,p3*(1/$Ratio3),0.001,1,0.001 a3 poscil iamp*aenv,$Frq*$Ratio3,gisine aenv expseg 1,p3*(1/$Ratio4),0.001,1,0.001 a4 poscil iamp*aenv,$Frq*$Ratio4,gisine aenv expseg 1,p3*(1/$Ratio5),0.001,1,0.001 a5 poscil iamp*aenv,$Frq*$Ratio5,gisine aenv expseg 1,p3*(1/$Ratio6),0.001,1,0.001 a6 poscil iamp*aenv,$Frq*$Ratio6,gisine a7 sum a1,a2,a3,a4,a5,a6 out a7 # instr 1 ; xylophone ; expand the macro with partial ratios that reflect those of a xylophone ; the fundemental frequency macro argument (the first argument - ; - is passed as p4 from the score $ADDITIVE_TONE(p4'1'3.932'9.538'16.688'24.566'31.147) endin instr 2 ; vibraphone $ADDITIVE_TONE(p4'1'3.997'9.469'15.566'20.863'29.440) endin i 1 0 1 200 i 1 1 2 150 i 1 2 4 100 i 2 3 7 800 i 2 4 4 700 i 2 5 7 600 e ; example written by Iain McCurdy