; test the comb filtering effects of specific delay times ; using white noise and band-limited pulse train as sound sources sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 instr 1 ; generate white noise imaxamp = 32767 ; maximum allowable amplitude of noise kenv linen p4, 0.05, p3, 0.05 ; envelope, with p4 between 0 and 1 anoise rand imaxamp ; white noise gasource = kenv*anoise ; control amplitude of noise with envelope ; and put it in a global variable to use as a source sound for filter endin instr 2 ; generate band-limited pulse train iharms = 16 ; number of harmonics of the band-limited pulse train iharms limit iharms, 1, (sr*0.5)/p5 ; keep number of harmonics within Nyquist rate imaxamp = 32767 ; maximum allowable amplitude of noise kenv linen p4*imaxamp, 0.05, p3, 0.05 ; envelope, with p4 between 0 and 1 gasource buzz kenv, p5, iharms, 1 ; band-limited pulse train (within Nyquist rate) ; put it in a global variable to use as a source sound for filter endin instr 3 ; mix a sound with a delayed version of itself adelayed delay gasource, p6/sr ; specify delay of source, in samples adelayed = adelayed*p5 ; scale by a certain factor out (gasource*p4)+adelayed ; scale source by a certain factor ; and mix the source and the delayed sound together endin