Module clock

clock coroutines

The norns script reference has examples for this module.

Functions

run (f[, ...]) create and start a coroutine using the norns clock scheduler.
cancel (coro_id) stop execution of a coroutine previously started using clock.run.
sleep (s) suspend execution of the calling coroutine and schedule resuming in specified time.
sync (beat[, offset]) suspend execution of the calling coroutine and schedule resuming at the next sync quantum of the specified value.
set_source (source) select the sync source.
get_beats () get current time in beats.
get_tempo () get current tempo.
get_beat_sec () get length of a single beat at current tempo in seconds.

Fields

clock.transport.start static callback when clock transport is started; user scripts can redefine
clock.transport.stop static callback when clock transport is stopped; user scripts can redefine
tempo_change_handler static callback when clock tempo is adjusted via PARAMETERS > CLOCK > tempo; user scripts can redefine


Functions

run (f[, ...])
create and start a coroutine using the norns clock scheduler.

Parameters:

  • f function coroutine body function
  • ... any extra arguments will be passed to the body function (optional)

Returns:

    integer coroutine handle that can be used with clock.cancel

See also:

cancel (coro_id)
stop execution of a coroutine previously started using clock.run.

Parameters:

  • coro_id integer coroutine handle

See also:

sleep (s)
suspend execution of the calling coroutine and schedule resuming in specified time. must be called from a coroutine previously started using clock.run.

Parameters:

  • s float seconds to wait for
sync (beat[, offset])
suspend execution of the calling coroutine and schedule resuming at the next sync quantum of the specified value. must be called from a coroutine previously started using clock.run.

Parameters:

  • beat float sync quantum. may be larger than 1
  • offset float if set, this value will be added to the sync quantum (optional)
set_source (source)
select the sync source.

Parameters:

  • source string "internal", "midi", or "link"
get_beats ()
get current time in beats.
get_tempo ()
get current tempo.
get_beat_sec ()
get length of a single beat at current tempo in seconds.

Fields

clock.transport.start
static callback when clock transport is started; user scripts can redefine
clock.transport.stop
static callback when clock transport is stopped; user scripts can redefine
tempo_change_handler
static callback when clock tempo is adjusted via PARAMETERS > CLOCK > tempo; user scripts can redefine
  • bpm : the new tempo
generated by LDoc 1.5.0 Last updated 2024-10-13 17:45:04