Hi,
I am looking for a way to fire a noteOn event after the RecordBuf time is elapsed.
The noteOn event will be used to switch off a LED of a midi controller.
Thanks
Hi,
I am looking for a way to fire a noteOn event after the RecordBuf time is elapsed.
The noteOn event will be used to switch off a LED of a midi controller.
Thanks
Welcome to the scsynth forum!
You can’t send midi from the server, only osc, so you need to throw and catch the osc.
In synth
rec = RecordBuf.ar…;
SendReply.kr( Done.kr(rec), /recording/done, 1);
In sclang, where ~midiOut is already set up.
OSCdef(\record_catcher, {
~midiOut.noteOn(16, 60, 60);
}, /recording/done);
I haven’t tested this code, on mobile, but I think that works!
If you are trigger when the record but should record with an argument, it’s better to do this a different way.
J
Hi jordan,
and thanks and hello to the forum.
Ui, that looks interesting. I will try it.
Sebastian
an easier way is to just use onFree. no need for OSCdef and SendReply.
s.boot
(
SynthDef(\myrecorder, {|buf|
RecordBuf.ar(SoundIn.ar, buf, loop: 0, doneAction:2);
}).add;
b.free; b= Buffer.alloc(s, 2*s.sampleRate);
MIDIClient.init;
m= MIDIOut(0);
)
Synth(\myrecorder).onFree({m.noteOn(0, 60, 80).postln}); //record 2sec and then send out noteOn