[CM] Simple oscillator?

Kjetil S. Matheussen k.s.matheussen at notam02.no
Sat May 15 04:21:49 PDT 2010



On Sat, 15 May 2010, Bill Schottstaedt wrote:

>> Can you show me an example of the CM code to make a one second 440 hertz sine tone?
>


Using Snd-RT (realtime version of CLM), it can be done like this:


   (<rt-out> :len 1 (oscil :freq 440))


Which is approx. the same as:


   (let ((phase 0.0))
     (<rt-out> :len 1
       (sin (inc! phase (hz->radians 440)))))


Or:

   (<rt-stalin>
      (define phase 0.0)
      (define tone (sound
                     (out (sin phase))
                     (inc! phase (hz->radians 440))))
      (wait 1:-s)
      (stop tone))


Or:

   (<rt-stalin>
      (define phase 0.0)
      (sound
        (out (sin phase))
        (inc! phase (hz->radians 440)))
      (wait 1:-s)
      (remove-me))


Or:

   (<rt-stalin>
      (sound :dur 1:-s
        (out (oscil :freq 440))))



More information about the Cmdist mailing list