i’m interested in having a norns engine send an osc message back to a norns lua script on every “beat” detected with sc’s BeatTrack. i got a start from this, but i’m a little stuck and would appreciate any help.
namely, how to i setup a OSCFunc to send back the message using SendTrig? the following is not functional, but contains what i think are the elements needed to do this…
// CroneEngine_BeatTrack
// beat tracker
Engine_BeatTrack : CroneEngine {
var pg;
*new { arg context, doneCallback;
^super.new(context, doneCallback);
}
alloc {
var buffer1 = Buffer.alloc(context.server,44100 * 1, 2,bufnum:bufnum);
pg = ParGroup.tail(context.xg);
SynthDef("BeatTrack", {
arg out, inL=0, inR=1;
var o, trackb, trackh, trackq, tempo, fft;
fft = FFT(LocalBuf(1024), In.ar([inL, inR]);
#trackb, trackh, trackq, tempo = BeatTrack.kr(fft, 0);
o = OSCFunc({ arg msg, time; [time, msg].postln;},'/tr', NetAddr.new("127.0.0.1", 10111));
SendTrig.kr(trackb, 0, tempo);
}).add;
context.server.sync;
this.addCommand("on", "f", { arg msg;
Synth("BeatTrack", [\out, context.out_b,\inL, context.in_b[0].index,\inR, context.in_b[1].index], target:pg);
});
}
}