[CM] Simple oscillator?

peiman peimankhosravi at gmail.com
Wed Nov 17 09:53:27 PST 2010


Hello,

I don't want to revise an old thread but  think my question is related in
some ways. 

I don't want to create a sine oscilator for sample playback but for
controling variables. So LFO is really what I am after. 

Say I have a process that creates a sequency of notes altogether lasting for
20 seconds. How would I go about changing the value of a variable inside the
process using a sine function that oscilates twice within the length of the
instrument? And finally how would I change the frequency of the oscilation
within the length of the process?

I gather I would need two parallel processes called at the same time, using
a global variable for the oscilating parameter. Is that correct? 

So far I have only managed to come up with somthing like this which
generates (I think!!) a kind of look-up table as a list:

variable l = {} ;defin global variable (list)

loop with c = 0, s = 0
  repeat 4096 
  set s = sin ( fit (interp( c, 0, 0, 4096, pi * 2), 0, pi * 2, 1) ), c +=
1, l &= s
end

print(l) 

Forgive my ignorance, I have only been using CM for a couple of days.

Best,

Peiman
 

Kjetil S. Matheussen-3 wrote:
> 
> 
> 
> 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))))
> 
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
> 
> 

-- 
View this message in context: http://old.nabble.com/Simple-oscillator--tp28565858p30238751.html
Sent from the CCRMA - CMdist mailing list archive at Nabble.com.



More information about the Cmdist mailing list