[CM] channels

James Hearon j_hearon at hotmail.com
Wed Apr 16 11:34:37 PDT 2014

cm clm s7

I'm getting confused over :channels 2 for with-sound and stereo output.  I was thinking to get stereo output I just needed to add the :channels 2 argument to with-sound if out-any is used in the instrument.  

Seems like I can only get one channel (one side) with :channels 2.  If I use :channels 1 I get dual mono (two sides).

If I try Fernando's move-osc with locsig the sound pans and I can see two channels using Snd as editor.  But for examp2 below, I just get one channel.

I'm wondering where I might be getting confused.


 (definstrument (move-osc beg dur freq amp 
 (degree 0.0) (dist 1.0) (reverb 0.03))
  (let* ((start (seconds->samples beg))
        (end (seconds->samples (+ beg dur))) 
         (car (make-oscil :frequency freq))
         (loc (make-locsig :degree degree :distance dist :channels 2))
     (pan-env (make-env '(0 0 1 90) :duration dur))) 
     (do ((i start (+ i 1)))
     ((= i end))
       (let ((ut (* amp (oscil car))))
     (move-locsig loc (env pan-env) dist)
         (locsig loc i ut)))))

(with-sound (:output "test.wav" :srate 48000 :channels 2
                     :data-format mus-lshort
                     :header-type  mus-riff) 
   (move-osc    0    3    220.0    0.75  0 1.0 0.3))


(definstrument (examp2 beg dur frequency amplitude)
  (let* ((start (seconds->samples beg))
        (end (seconds->samples (+ beg dur))) 
     (sine-wave (make-oscil :frequency frequency)))
     (do ((i start (+ i 1)))
     ((= i end))
       (outa i (* amplitude (oscil sine-wave))))))

(with-sound (:output "test2.wav" :srate 48000 :channels 2
                     :data-format mus-lshort
                     :header-type  mus-riff) 
   (examp2    0    3    220.0    0.75))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/mailman/private/cmdist/attachments/20140416/b5548f28/attachment.html 

More information about the Cmdist mailing list