[CM] scheme move-locsig

James Hearon j_hearon at hotmail.com
Thu May 5 12:00:49 PDT 2016


Hi,
I couldn't come up with the magic to get a pan-env working across a heap of notes with move-locsig.  But I made a solution below by just passing degree only to the inst and controlling degree over the total duration of the heap from with-sound.  Not elegant, but it pans across the whole heap of notes.

------------
(provide 'snd-nrev.scm)

(if (provided? 'snd)
    (require snd-ws.scm)
    (require sndlib-ws.scm))

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

(define (round-off z n)
  (let ((power (expt 10 n)))
    (/ (round (* power z)) power)))

(definstrument (myinst start-time duration frequency amplitude sampling-rate revamt distance degree )
  (let* ((beg (floor (* start-time sampling-rate)))
	 (end (+ beg (floor (* duration sampling-rate))))
	 (loc (make-locsig :degree degree :distance distance :reverb revamt))
	 (sine-wave (make-oscil :frequency frequency)))
     (do ((i beg (+ i 1)))
         ((= i end))
     (let ((x (* amplitude (oscil sine-wave))))
       (locsig loc i x)
       (move-locsig loc degree distance)
       ))))

(let ((aaa (make-heap '(360 800.345 1200 600))) 
      (bbb (make-heap '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) )
(with-sound (:reverb nrev :output "/home/MyTest.wav" :srate 48000 :channels 2
		     :header-type mus-riff :statistics #t :play #t)
	      (let ((i 0))
		(let ((mypanenv (make-env '(0 90 5 0) :length 70))) ;not sure why length  works here instead of duration
	           (do ((k 0 (+ k 1)))
	           ((>= k 40))
		   (let ((v (next bbb)))     		     
		(myinst  i v  (next aaa) .9 48000  0.01  1.0  (mypanenv k)  ) ;send degree to inst
		(set! i (+ (round-off i 2) v))
		  ))))) )
		   




More information about the Cmdist mailing list