Tempo tempo calculations

see also: TempoBus, TempoPlayer

This class represents the concept of tempo. It can be used for translations between seconds, beats and bars. It holds an instance of TempoClock which it keeps set to its own tempo.

It can be used to convert beats <-> seconds, but this value is only accurate at the time you make the computation. If the tempo is changed the value is no longer valid. TempoBus adds itself as a dependant to the Tempo object, so when the tempo changes, it is informed, and it updates the value on the bus.

Tempo.bpm = 170;

Tempo.tempo = 2.3; // in beats per second

Tempo.gui; // there is a gui class

Tempo.bpm = 170;

Tempo.beats2secs(4.0).postln;

Tempo.bpm = 10;

Tempo.beats2secs(4.0).postln;

All class methods refer to the default global tempo.

You can create an instance of Tempo if you need individual, separate tempii.

t = Tempo.new;

u = Tempo.new;

t.bpm = 170;

u.tempo = 1.3; // in beats per second

t.gui;

All of the following methods exist as class methods (the default tempo)

and as instance methods.

bpm

bpm_(beatsPerMinute)

Tempo.bpm = 96;

or

Tempo.bpm_(96);

tempo

in beats per second

tempo_(beatsPerSecond)

Tempo.tempo = 2.0;

or

Tempo.tempo_(2.0);

beats2secs(beats)

secs2beats(seconds)

bars2secs(bars)

you can change the beats per bar:

Tempo.beatsPerBar = 7.0;

secs2bars(seconds)

sched(delta,function)

Schedule a function to be evaluated delta beats from now.

OSCSched and BeatSched are more comprehensive

schedAbs(beat,function)

Schedule a function to be evaluated at an absolute beat, as measured

from the time SuperCollider first booted up.

OSCSched and BeatSched are more comprehensive

*kr

kr

creates a tempo control inside an instr synth def.

changing the tempo on the client will send tempo changes to the synth playing on the server.

This is a shortcut to creating a TempoPlayer

(

Instr(\helpTempoPlayer,{

Impulse.ar( Tempo.kr )

});

Patch(\helpTempoPlayer).play

)

A TempoBus can be started on the server, and it will keep the Tempo object's tempo as a float control value on a Bus on the server. UGens can then use this for scaling their frequencies for beat based rhythms etc.