[CM] scheme, snd, cm_patterns.scm

James Hearon j_hearon at hotmail.com
Thu Jul 9 10:31:06 PDT 2015


Hi,
re: finding myself s7 challenged for CM_patterns.scm in Snd without Grace process, sprout etc.

I've kept digging with this and got something working, but it's not very pretty.  It uses 'list-ref'
in with-sound (), but that could be improved, I'm sure.
Regards,
Jim


------------------
(load "snd/CM_patterns.scm")

(definstrument (examp1 start-time duration frequency amplitude sampling-rate)
  (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))) 
     (outb i (* amplitude (oscil sine-wave))) 
     )))

 (define xxx '(160.0  600.345  1000.0  400))
 (define aaa (make-heap xxx))
 (define bbb (next aaa #t))

(with-sound (:output "MyTest.wav" :srate 48000 :channels 2
             :header-type  mus-riff :statistics #t)
  (do (( i 0.0 (+ i 2.0))) 
      ((>= i 2.0)) 
 (examp1   0        0.25    (list-ref bbb 0)    0.5 48000)
 (examp1   (+ i 1.0)    0.25    (list-ref bbb 2)    0.5 48000)
 (examp1   (+ i 2.0)    0.25    (list-ref bbb 3)    0.5 48000)
 (examp1   (+ i 3.0)    0.25    (list-ref bbb 1)    0.5 48000)
 ))
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20150709/a53ee3be/attachment.html>


More information about the Cmdist mailing list