librelist archives

« back to archive

clocks + updated docs

clocks + updated docs

Tom Lieber
2010-02-16 @ 00:23
If you're subscribed to the blog, you may know, but I just committed
clock objects to ckv. Trying to get this right stalled development for
a while, but I like how it turned out.

Clocks are virtual clocks whose speeds can be independently changed
without threads getting out of sync. Below is the sample from the

  clock = Clock(300) -- bpm

    while sync(1, clock) do
      local n = Noise()
      c(n, speaker)
      yield(100 * ms)
      disconnect(n, speaker)

  clock_mod = SinOsc(0.1)
  c(clock_mod, blackhole)

  while true do
    clock.bpm = clock_mod.last * 90 + 100
    print("bpm:", clock.bpm)
    yield(100 * ms)

I recommend you check out the new Language Reference section of the
reference page for more clock examples and information on features of
ckv you probably didn't know existed (because I never told any one):

Tom Lieber