link_tempo_set — Sets the tempo.


Plugin opcode in ableton_link_opcodes. This opcode is part of the plugin repository and has to be installed separately. The plugin repository can be found here:

Sets the local tempo if this peer is not enabled; sets the tempo of the global network Ableton Link session if this peer is enabled.


link_tempo_set i_peer, k_bpm [, k_at_time_seconds]


i_peer -- The Ableton Link peer object.

k_bpm -- The requested tempo in beats per minute.

k_at_time_seconds -- The session time at which the indicated tempo will take effect. The default value is the current session time.


Here is an example of the link_tempo_set opcode. It uses the file ableton_link.csd.

Example 532. Example of the link_tempo_set opcode.

Run the Ableton Link "LinkHut" example application, or some other 
Ableton Link peer, while you run this CSD to see what happens.
-m0 -d -odac 
sr = 44100
ksmps = 10
nchnls = 2

alwayson "LinkMonitor"

gi_peer link_create 72
gk_beat init 0

instr Beep
asignal oscils 20000, p4, 0
outs asignal, asignal

instr TempoChange
link_tempo_set gi_peer, 80

instr LinkEnable
i_enabled = p4
link_enable gi_peer, i_enabled

instr LinkMonitor
i_kperiod_seconds = ksmps / sr
printf_i "kperiod: %9.6f seconds.\n", 1, i_kperiod_seconds
printf_i "gi_peer: %g\n", 1, gi_peer
link_enable gi_peer, 1
k_trigger, gk_beat, k_phase, k_time link_metro gi_peer, 1
k_peers link_peers gi_peer
k_tempo link_tempo_get gi_peer
k_enabled link_is_enabled gi_peer
k_hz = 1000
if floor(gk_beat % 4) == 0 then
k_hz = 3000
k_hz = 2000
schedkwhen k_trigger, 0, 1, "Beep", 0, 0.01, k_hz
printf "LinkMonitor: gi_peer: %g k_enabled: %9.4f k_trigger: %9.4f beat: %9.4f k_phase: %9.4f time: %9.4f tempo: %9.4f peers: %3d\n", k_trigger, gi_peer, k_enabled, k_trigger, gk_beat, k_phase, k_time, k_tempo, k_peers
f 0 360
i "TempoChange" 10 80
i "LinkEnable"  20 1 0
i "LinkEnable"  30 1 1

See also

Ableton Link Opcodes


By: Michael Gogins 2017