Module clock

clock coroutines

Functions

run (f[, ...]) create and start a coroutine.
cancel (id) stop a coroutine started by clock.run.
sleep (s) suspend coroutine and schedule resuming time.
sync (beat[, offset]) suspend coroutine and schedule resuming sync quantum.
get_beats () returns the current time in beats since reset was called.
get_tempo () returns the current tempo in bpm
get_sec_per_beat () returns the length in seconds of a single beat
get_beat_sec () alias to getsecper_beat, for norns compatibility
set_source (source) sets the clock source
start () callback when clock starts
stop () callback when the clock stops
reset () callback when the clock beat number is reset


Functions

run (f[, ...])
create and start a coroutine.

Parameters:

  • f function coroutine functions
  • ... any extra arguments passed to f (optional)

Returns:

    integer coroutine id that can be used with clock.cancel

See also:

cancel (id)
stop a coroutine started by clock.run.

Parameters:

  • id integer coroutine id

See also:

sleep (s)
suspend coroutine and schedule resuming time. call from within a coroutine function started by clock.run

Parameters:

  • s float seconds to wait for
sync (beat[, offset])
suspend coroutine and schedule resuming sync quantum. call from within a coroutine function started by clock.run

Parameters:

  • beat float sync quantum (may be larger than 1)
  • offset float if set, this will be added to the sync quantum (optional)
get_beats ()
returns the current time in beats since reset was called.

Returns:

    number beats time in beats
get_tempo ()
returns the current tempo in bpm

Returns:

    number bpm
get_sec_per_beat ()
returns the length in seconds of a single beat

Returns:

    number seconds
get_beat_sec ()
alias to getsecper_beat, for norns compatibility

Returns:

    number seconds
set_source (source)
sets the clock source

Parameters:

  • source string "internal" or "midi"
start ()
callback when clock starts
stop ()
callback when the clock stops
reset ()
callback when the clock beat number is reset
generated by LDoc 1.5.0 Last updated 2024-01-13 13:12:10