clockblocks.utilities.apply_tempo_function

clockblocks.utilities.apply_tempo_function(function: Callable, domain_start: float = 0, domain_end: float = None, duration_units: str = 'beats', truncate: bool = True, loop: bool = False, extension_increment: float = 2.0, **kwargs) → None[source]

Drive the current clock’s tempo (in beats per minute) by following a function of beats/time. Forwards to apply_tempo_function(); acts on the currently active clock. Raises NoActiveClockError if there is no active clock.

Parameters:
  • function – a callable mapping a position (in the units given by duration_units) to a tempo.

  • domain_start – the input value at which to start reading function.

  • domain_end – the input value at which to stop, or None to follow the function open-endedly.

  • duration_units – "beats" or "time" — whether the function’s input is measured in beats or in seconds.

  • truncate – if True, discard any tempo curve already scheduled past the current beat first.

  • loop – only relevant when domain_end is set: if True, repeat that finite domain indefinitely (until stop_tempo_loop_or_function()).

  • extension_increment – only relevant when domain_end is None: how far ahead (in the function’s domain) to project at a time, extending again as the clock reaches the projected end.

  • kwargs – forwarded to the underlying envelope-from-function sampling (scanning_step_size, iterations, etc. — see apply_function()).