Get values from midi keyboard

Hi @CUSTOM_ROBO

I've managed to do this following these instructions

I slightly edited the SC code to get it to do what I wanted:

MIDI IN

//To accept MIDI in to Tidal we need to run a bit more code - this lets SuperCollider convert MIDI inputs from your controller into OSC messages

// Evaluate the block below to start the mapping MIDI -> OSC.

(
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", "n", num); // if I remember correctly this was the bit I changed to get notes in!

});

off = MIDIFunc.noteOff({ |val, num, chan, src|
osc.sendMsg("/ctrl", "n", 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;
};
)

And then using code in Tidal like this:

d4 $ sound "arpy" # up (cF 1 "n")

Depending on the pitch of your samples etc you will probably need to transform the midinote to a lower number, as up maps to semitones, rather than midinotes.

Something like:

d4 $ sound "arpy" # up ((cF 1 "n")-60)

And you might need to have a play around with noteon/noteoff (I used this in a kind of drone/noise setting so wasn't such a big deal for me, but this setup will still play the tidal pattern even when a note isn't being pressed - you could try mapping noteon/noteoff to #gain to help with this).

Hopefully this will get you started - shout back if you need any help.

2 Likes