; instruments for granular synthesis sr = 44100 kr = 2205 ksmps = 20 nchnls = 1 instr 1 ; straightforward snychronous granular synthesis imaxamp = 32767 isamplepitch = sr/ftlen(3) kampenv linseg 0, 0.01, 1, 0.024, 0.5, p3-0.125, 0.125, 0.1, 0 ; overall amplitude envelope apitchcurve linseg p5, p3, p6 agranular grain p4*imaxamp*kampenv, isamplepitch, apitchcurve, 0, 0, p7, 3, 2, 1, 0 ; ar grain xamp, xpitch, xdens, kampoff, kpitchoff, kgdur, igfn, iwfn, imgdur[, igrnd] out agranular endin