/ Topics / TimeKeeper

ChucK . ChucK Live
Asset-based, Nonlinear Workflow
On Graphs and Code . Authoring Musical Notes
Player . Instrument . NoteStream . TimeKeeper
Channels, Effects . Control Signals
Audio I/O . MIDI Input . VST3 Plugins


schedule

TimeKeeper is a relatively simple class. It owns the definition of BPM (Beats per Minute) and also holds a time signature in the form of Beats per Bar and Beat Type. In traditional western music notation Beat per Bar is the top number in the signature while Beat Type is the bottom number. 4/4 time means that there are 4 quarter-note beats in each musical measure.

TimeKeeping is an opt-in feature. Classes that keep track of TimeKeeper state are said to be in sync. When you play notes on your MIDI device you can try to be in sync or not, there is no enforcement there. The same can be said of procedural nodes that disregard TimeKeeper.

Keeping in mind that programs can procedurally update TimeKeeper's definition of BPM (Beats Per Minute) we offer a simple interface to modify these settings while the composition is playing. If your program invokes TimeKeeper.BPM(float), manual edits will be overridden by the program changes.

In addition, these controls, located in the Graph Editor, allow you to play/pause and display the current time in HR:MM:SEC as well as MEASURE:BEAT representations.

Since a shared notion of time is usually important to keep players in sync there is usually only a single TimeKeeper in most compositions.

By instantiating a TimeKeeper node you now have access to its properties. Above is the graph view of a TimeKeeper node. To the right is the property editor view. Changes made here will directly affect a running session and also be stored in your composition. The Live values (at top) only affect the current state and aren't edits to a node parameter.

TimeKeeper as Controller

TimeKeeper can also act as a controller, emitting these control change events through its output CC port:

Name Meaning
TkStart Emitted when timekeeping session begins.
TkEnd Emitted when a timekeeping session ends.
TkMeasure Emitted when a new measure begins. Value is the measure number within the composition
TkCountIn Emitted on each measure of the optional CountIn period.
TkBeat Emitted when a beat occurs, parameter value is the beat within a measure
TkRunning Emitted when the play/pause state changes. Value is 1 when running or 0 when paused or completed.
TkRepeat Emitted when the a repetition occurs.

Controlling the TimeKeeper

If you wish to drive changes in BPM through your composition, here is a simple example:

Note that CCGenerator has identified BPM as the CC Name for which to generate a value. Also note that the range of BPM values it will generate is between 50 and 200 BPM.

If you prefer to automate tempo with the Session Grids, we recommend you peruse this example.

home .. topics .. interface .. reference .. examples .. tipjar