TempoClick:
Filter:
ddwCommon/Classes (extension) | Control

TempoClick
ExtensionExtension

Impulse source synced with language-side clock

Description

Allocates a control bus on the server, and plays regular impulses on it.

It plays one new synth every beat, with subdiv pulses in each beat. This maintains precise sync with the language-side clock. (The server's sample rate fluctuates according to the audio interface. If you simply run one synth for several minutes, the deviation in sample rate will cause the server-side pulses to drift out of sync with the clock. TempoClick refreshes the sync every beat.)

Class Methods

.new

Creates a new instance, and launches the impulses on the next clock beat.

Arguments:

server

(The server that will host the control bus.

clock

An instance of TempoClock to sync with.

bus

Optional. If you wish to specify a control bus, do it here. If this is nil, a control bus will be allocated for you.

subdiv

How many pulses per beat.

Returns:

The TempoClick instance.

.latencyFudge

Deprecated. No longer used.

Instance Methods

Control

.play

Start the pulses on the bus. This is done automatically by *new.

.stop

Stop the pulses, but keep the bus.

.free

Stop the pulses and release the bus.

.remove

Synonym for -free.

Bus access

.bus

Returns:

The control Bus object.

.index

Returns:

The control bus's numeric index (integer).

.asMap

Returns:

A bus-mapping Symbol, compatible with Bus: -asMap.

.asMapArg

Synonym for -asMap.

.asControlInput

Called automatically if you use a TempoClick in a Synth argument list, e.g. Synth(\triggered, [t_trig: aTempoClick]). See the example below.

Returns:

A bus-mapping Symbol, same as -asMap.

.asUGenInput

An In UGen, providing the triggers as a server-side signal. If c is the TempoClick instance, you can write e.g. Decay2.kr(c, 0.01, 0.1) to hardcode the clicks into your SynthDef. (Note, however, that it's better practice to provide a trigger input to the SynthDef, and map the control bus as demonstrated in the example.)

Returns:

In.kr(bus, 1).

Queries

.server

Returns:

The Server hosting the impulses.

.clock

Returns:

The clock used for sync.

NOTE: A clock_ method is defined, so it looks like you might be able to change the clock on the fly. clock_ comes from Object. It has no function for TempoClick. The only way to switch to a different clock is to create a new TempoClick instance.

.subdiv

Gets or sets the subdivision (number of pulses per beat).

Arguments:

s

Number of pulses per beat (integer or float).

.tempo

For convenience, you can get or set the clock's tempo here. These methods are forwarded to the clock.

Arguments:

tempo

Beats per second, as in TempoClock.

.nodeID

There is no particular need to do this, but you can find out which nodeID is playing the impulses at any moment. The synth refreshes once per beat. To avoid using up too many node IDs, TempoClick bounces between two adjacent IDs.

Returns:

The current node ID (changes once per beat).

Examples