[CM] Scheme, outa and reverb

2015-04-29 Thread James Hearon

  Scheme, Outa, and reverb  



 James Hearon   


4/28/15 



 To:  
cmdist@ccrma.Stanford.EDU   



 


Hi,
I might have figured out a way to add the reverberator using outa and *reverb* 
in the definstrument, and calling it using a scheme process.  It may not be the 
best way but it seems to work...which is setting the *clm-reverb* global.  (Now 
I need to figure out how to unset it.)  TX.  Jim

(if (not (provided? 'jcrev.scm))

  (load jcrev.scm))

 (set! *clm-reverb* jc-reverb)

(definstrument (myexamp start-time duration frequency amplitude sampling-rate
  (reverb-amount 0.01))

  (let* ((beg (floor (* start-time sampling-rate)))

 (end (+ beg (floor (* duration sampling-rate

 (sine-wave (make-oscil :frequency frequency)))

 (do ((i beg (+ i 1)))

 ((= i end))  
(outa i (* (* (* amplitude (oscil sine-wave))) reverb-amount)  *reverb*)
(outb i (* (* (* amplitude (oscil sine-wave))) reverb-amount)  *reverb*)  
)))


(with-sound (:output test.wav :srate 48000 :channels 2

 :data-format mus-lshort

 :header-type  mus-riff
 :reverb jc-reverb) 
(myexamp 0 1 440.0 0.5 48000 :reverb-amount 0.15))

;-
;using a process
(define (call_myexamp n r d flb fub amp sr)

(process 

  for freq = (between flb fub)

  repeat n do

 (send myexamp (elapsed) d freq amp sr  :reverb-amount 0.15)

 (wait r) ))

 
(sprout(call_myexamp 40 .15 .10 500 2000 0.5 48000) mytest.wav)
  ___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist


[CM] Scheme, Outa, and reverb

2015-04-28 Thread James Hearon
Hi,
I'm getting myself confused about the following info below from the manual 
about outa and *reverb*.  If I'm understanding correctly then, *reverb* is not 
a reverberator and you still have to supply one, such as jc-rev, which I think 
I did below using with-sound.

But I'm stuck trying to figure out how to use a reverberator with a scheme 
process instead of with-sound.  I know I can include the the reverb-amount etc. 
on the send line in the process, but I can't seem to figure out how to to 
include the jc-reverberator with the process or define.

Do I include the reverberator in the definstrument perhaps for calling it with 
a process?  I know using reverb from a scheme process is much easier if I use 
locsig instead of outa, but I was hoping I might understand if will work or not.

Thank You,
Jim
--
*reverb*
The reverb instrument has to send to the *reverb* output stream an 
appropriately scaled version of its main output, something like:
 
(outa i (* sample reverb-amount) *reverb*)
 
What clm does is, after with-sound processes the whole note list that 
is its body, it runs the reverb instrument that you supply over the 
reverb soundfile that it generated as part of running the body and then 
merges the output of that instrument run into the main soundfile generated.

(if (not (provided? 'jcrev.scm))
  (load jcrev.scm))

(definstrument (myexamp start-time duration frequency amplitude sampling-rate
  (reverb-amount 0.01))
  (let* ((beg (floor (* start-time sampling-rate)))
 (end (+ beg (floor (* duration sampling-rate
 (sine-wave (make-oscil :frequency frequency)))
 (do ((i beg (+ i 1)))
 ((= i end))  
(outa i (* (* (* amplitude (oscil sine-wave))) reverb-amount)  *reverb*)
(outb i (* (* (* amplitude (oscil sine-wave))) reverb-amount)  *reverb*)  
)))

(with-sound (:output test.wav :srate 48000 :channels 2
 :data-format mus-lshort
 :header-type  mus-riff
 :reverb jc-reverb) 
(myexamp 0 1 440.0 0.5 48000 :reverb-amount 0.15))

;-
;using a process
(define (call_myexamp n r d flb fub amp sr)
(process 
  for freq = (between flb fub)
  repeat n do
 (send myexamp (elapsed) d freq amp sr )
 (wait r) ))
 
(sprout(call_myexamp 40 .15 .10 500 2000 0.5 48000) mytest.wav)

  ___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist