[CM] scheme move-locsig

James Hearon j_hearon at hotmail.com
Thu Apr 28 18:09:41 PDT 2016

I'm getting fouled up with trying to pan across a heap of notes using cm patterns.  I was trying to use a panning enevelope for the move-locsig degree, but something's not quite right.  I tried changing the pan-env, make-env to :duration seconds thinking that would work across the whole heap of notes, but I still can still only get left, right, or center.

Not quite sure what I'm doing wrong.  Wondering if someone sees my errors and can help.
Thank You,

(provide 'snd-nrev.scm)

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

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

;move-locsig with pan envelope
(definstrument (myinst start-time duration frequency amplitude sampling-rate revamt degree distance (panning-env '(0 0 6 90)) )
  (let* ((beg (floor (* start-time sampling-rate)))
	 (end (+ beg (floor (* duration sampling-rate))))
	 (loc (make-locsig :degree degree :distance distance :reverb revamt))
	 (pan-env (make-env panning-env :duration 12)) ;use seconds here?
	 (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 (env pan-env) distance)

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

(let ((aaa (make-heap '(160 600.345 1000 400))) 
      (bbb (make-heap '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))))
(with-sound (:output "/opt/snd-16/MyTest.wav" :srate 48000 :channels 2
		     :header-type mus-riff :statistics #t :play #t)
	      (let ((i 0))
	           (do ((k 0 (+ k 1)))
	           ((>= k 40))
	      (let ((v (next bbb)))
		(myinst i v  (next aaa) .9 48000  0.01  0  1.0  '(0 90 5 0)  )
		(set! i (+ (round-off i 2) v))
		  ;(format #t "~s i: ~s v: ~s\n"k i v )

More information about the Cmdist mailing list