sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ;=================================================================== ; Example Convolution Instrument. Uses the impulse file convolve.p6, ; which will be convolved with the soundin file soundin.p5. The dry ; (original) sound can be mixed with the wet (convolved) sound and ; should have a delay time equal to the exact length of the original ; impulse file. A mechanism is implemented to discard the initial ; zeros before the output of convolve begins to appear. ; RP ;=================================================================== instr 1 iampscl = p4 ;amplitude scaling factor isound = p5 impfile = p6 idelay = p7 idryfac = p8 kcount init idelay*kr ;set counter for initial delay loop: asound soundin isound ;use soundin.p5 awet convolve asound*iampscl,impfile ;use convolve.p6 adry delay asound,idelay ;delayed dry signal kcount = kcount-1 ;decrement delay counter if (kcount > 0) kgoto loop ;discard initial output out adry*idryfac+awet*(1-idryfac) endin ;------------------------------------------------------------------- ; Test instrument for impulse response. Should produce an output ; that is exactly the same as the original impulse file. ;------------------------------------------------------------------- instr 2 aunit init 32767 ;initialize to max amp for "impulse" iampscl = p4 ;scale as needed to avoid SOR impfile = p5 ;use convolve.p5 awet convolve aunit*iampscl,impfile aunit = 0 ;zero this after the first sample out awet endin
;Use thewind.wav (soundin.500) as a test audio file ;Use Howard Fredric's impulse files from Sweden ;convolve.101 is Domkyrkan Cathedral (12+ sec reverberation) ;nn st dur ampscl soundin impulse idelay idryfac i01 0 8 .02 500 "convolve.101" 7.357 .75 s ;convolve.102 is Drottningholm Palace (round ballroom w/slapback) ;nn st dur ampscl soundin impulse idelay idryfac i01 0 4 .02 500 102 1.496 .75 s ;convolve.103 is a Stockholm subway station (round, echoey) ;nn st dur ampscl soundin impulse idelay idryfac i01 0 5 .02 500 103 4.435 .75 s ;convolve.104 is "the wind is invisible" ;use eroica symphony (soundin.100) as a test audio file i01 0 7 .004 100 104 1.6 0 s ;convolve.105 is frigate.wav (birdcall of a frigate bird) ;use eroica symphony (soundin.100) as a test audio file i01 0 7 .07 100 105 .4 0 s ;convolve.106 is noise burst with exponential decay ;use eroica symphony (soundin.100) as a test audio file i01 0 10 .05 100 106 6 .75 ;use thewind (soundin.500) as a test audio file i01 + 7 .04 500 106 6 .75 s ;convolve.107 is noise burst with logarithmic decay ;use eroica symphony (soundin.100) as a test audio file i01 0 12 .035 100 107 6 .75 ;use thewind (soundin.500) as a test audio file i01 + 9 .03 500 107 6 .75 s ;convolve.108 is a noise "wedge" (noisewdg.wav) ;use eroica symphony (soundin.100) as a test audio file i01 0 11 .05 100 108 6 .75 ;use thewind (soundin.500) as a test audio file i01 + 8 .04 500 108 6 .75 s ;convolve.118 is flanged noise (noischor.wav) ;use thewind (soundin.500) as a test audio file i01 0 8 .02 500 118 6 .5 ;use bigclunk (soundin.502) as a test audio file i01 + 8 .01 502 118 6 .25 ;use bees1.wav (soundin.505) as a test audio file i01 + 10 .01 505 118 6 .25 ;use popcorn.wav (soundin.506) as a test audio file i01 + 7 .045 506 118 6 .25 ;use laugh.wav (soundin.507) as a test audio file i01 + 7 .018 507 118 6 .25 s ;convolve.109 is a woman's laughter (laugh.wav) ;use eroica symphony (soundin.100) as a test audio file i01 0 8 .05 100 109 2.459 .75 ;use thewind (soundin.500) as a test audio file i01 + 6 .04 500 109 2.459 .75 s ;convolve.110 is a glass breaking (crash.wav) ;use eroica symphony (soundin.100) as a test audio file i01 0 7 .025 100 110 1.736 .5 ;use thewind (soundin.500) as a test audio file i01 + 5 .06 500 110 1.736 .75 s ;convolve.111 is bees buzzing (bees1.wav) ;use bigclunk (soundin.502) as a test audio file i01 0 9 .015 502 111 6.555 .5 ;use thewind (soundin.500) as a test audio file i01 + 10 .003 500 111 6.555 .5 s ;convolve.112 is a toilet flush ;use eroica symphony (soundin.100) as a test audio file i01 0 10 .008 100 112 5.517 .25 ;use thewind (soundin.500) as a test audio file i01 + 8 .0035 500 112 5.517 .25 s ;convolve.113 is an inside the piano clunk (bigclunk.wav) ;use eroica symphony (soundin.100) as a test audio file i01 0 8 .01 100 113 4.272 .25 ;use thewind (soundin.500) as a test audio file i01 + 6 .01 500 113 4.272 .25 s ;convolve.114 is popcorn ;use eroica symphony (soundin.100) as a test audio file i01 0 9 .03 100 114 3.312 .25 ;use thewind (soundin.500) as a test audio file i01 + 7 .03 500 114 3.312 .25 ;use bigclunk (soundin.502) as a test audio file i01 + 9 .03 502 114 3.312 .25 s ;convolve.115 is a cello note ;use thewind (soundin.500) as a test audio file i01 0 5 .01 500 115 1.567 .5 ;use bigclunk (soundin.502) as a test audio file i01 + 5 .01 502 115 1.567 .5 ;use bees1.wav (soundin.505) as a test audio file i01 + 8 .006 505 115 1.567 .5 ;use popcorn.wav (soundin.506) as a test audio file i01 + 6 .024 506 115 1.567 .5 ;use laugh.wav (soundin.507) as a test audio file i01 + 5 .012 507 115 1.567 .5 s ;convolve.116 is a cello note's decay (.474 sec) ;use thewind (soundin.500) as a test audio file i01 0 4 .01 500 116 .474 .5 ;use bigclunk (soundin.502) as a test audio file i01 + 4 .01 502 116 .474 .5 ;use bees1.wav (soundin.505) as a test audio file i01 + 8 .006 505 116 .474 .5 ;use popcorn.wav (soundin.506) as a test audio file i01 + 5 .024 506 116 .474 .5 ;use laugh.wav (soundin.507) as a test audio file i01 + 4 .012 507 116 .474 .5 s ;convolve.117 is cello decay with downward gliss (.575 sec) ;use thewind (soundin.500) as a test audio file i01 0 4 .01 500 117 .575 .25 ;use bigclunk (soundin.502) as a test audio file i01 + 4 .005 502 117 .575 .25 ;use bees1.wav (soundin.505) as a test audio file i01 + 8 .006 505 117 .575 .25 ;use popcorn.wav (soundin.506) as a test audio file i01 + 5 .06 506 117 .575 .25 ;use laugh.wav (soundin.507) as a test audio file i01 + 4 .04 507 117 .575 .25 s ;convolve.119 is a fof-generated chord ;use thewind (soundin.500) as a test audio file i01 0 5 .01 500 119 1.3 .25 ;use bigclunk (soundin.502) as a test audio file i01 + 5 .03 502 . . .25 ;use bees1.wav (soundin.505) as a test audio file i01 + 9 .006 505 . . .25 ;use popcorn.wav (soundin.506) as a test audio file i01 + 6 .05 506 . . .25 ;use laugh.wav (soundin.507) as a test audio file i01 + 5 .03 507 . . .25 e