For this you’ll want to use SendTrig to pass a value from the server to the client.
I haven’t used BeatTrack in a long time, but I think this should work for what you want to do:
(
t = TempoClock(120/60);
a = SynthDef(\help_beattrack, { |out, vol=0.0, beepvol=1.0, lock=0|
var in, fft, resample;
var trackb, trackh, trackq, tempo;
var beeper;
in = SoundIn.ar(0);
fft = FFT(LocalBuf(1024), in);
#trackb, trackh, trackq, tempo = BeatTrack.kr(fft, lock);
beeper = SinOsc.ar(423, 1.0, Decay.kr(trackb, 0.15));
SendTrig.kr(trackb, 0, tempo);
Out.ar(out, Pan2.ar((vol * in) + (beepvol * beeper), 0.0))
}).play;
o = OSCFunc({ arg msg, time;
[time, msg].postln;
t.tempo = msg[3];
},'/tr', s.addr);
)
o.free
t.tempo.postln // post current tempo
This will set the tempo of TempoClock ‘t’ to whatever the currently detected tempo is on every quarter note tick of ‘trackb’.
If you aren’t familiar with the client/server relationship (it caused me, and every other beginner I know, lots of grief), check out Client vs. Server reference in SCDocs.
[edit]
Oh also, I recommend using OSCdef for managing your OSC responders in the client.
OSCFunc is just there in the example because I cribbed the code for SendTrig help file, but I’ve had orphan OSC responders laying around causing me grief in the past using OSCFunc directly.