Skip to content

Instantly share code, notes, and snippets.

@KoltesDigital
Created March 24, 2019 13:07
Show Gist options
  • Save KoltesDigital/3a32a51cc79629a3f075982453d4be60 to your computer and use it in GitHub Desktop.
Save KoltesDigital/3a32a51cc79629a3f075982453d4be60 to your computer and use it in GitHub Desktop.
MIDI to OSC in SuperCollider
(
var on, off, cc;
var osc;
osc = NetAddr.new("127.0.0.1", 6010);
MIDIClient.init;
MIDIIn.connectAll;
on = MIDIFunc.noteOn({ |val, num, chan, src|
osc.sendMsg("/ctrl", num.asString, val/127);
});
off = MIDIFunc.noteOff({ |val, num, chan, src|
osc.sendMsg("/ctrl", num.asString, 0);
});
cc = MIDIFunc.cc({ |val, num, chan, src|
osc.sendMsg("/ctrl", num.asString, val/127);
});
if (~stopMidiToOsc != nil, {
~stopMidiToOsc.value;
});
~stopMidiToOsc = {
on.free;
off.free;
cc.free;
};
)
~stopMidiToOsc.value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment