;using global reverb
;To use global reverb, you need to set up and use global audio variables 
;(which start with "ga") to pass the signal from the source instrument to the
;reverb instrument.  Notice that the global variable is initialized  in the .orc header.
;The best way to vary the amount of reverb for each note is to control 
;the amplitude put into the global signal for each note.

;Below is a sample instrument.  If you are using Netscape, use "View Source"
;to download to a textfile.  Delete any html tags.


;orchestra

sr=44100
kr=441
ksmps=100
nchnls=1
garev  init 0  ;dumps any previous information in garev

instr 1  ;p4=source amplitude, p5=source frequency
							;p6=scaling factor (depth) for signal passed to reverb (1=unity gain)
 
anote  oscil  p4, p5, 1
out anote
garev = anote * p6
endin

instr 99  ;p4=reverb time

arevsig   reverb   garev, p4 ;  puts global signal into reverb
out  arevsig
garev = 0  ;very important to clear global reverb signal each k-rate pass!
endin

;score
f1 0 2048 10 5 4 3 2 1
i99 0 8 3 
i1 0 2 4000 441 .5
i1 3 1 5000 600 .7
i1 4 1 3000 350 .9
e