Mapping controller input

When you setup controller input like described here:

How do you map the controller input to a reasonable value in Tidal?

Let's say you want to change #speed from -2 to 2 and get cc numbers from 0 - 127.

Hi @specht,
the easiest way to achieve such a behaviour would be to do the math on the SuperCollider side like:

var cc, mapping;
var osc;


osc ="", 6010);


cc ={ |val, num, chan, src|
	((val/(127/4)) - 2).postln;
	osc.sendMsg("/ctrl", num.asString, ((val/(127/4)) - 2));

~stopMidiToOsc = {;

You are totally free to specify a control name (by changing the num.asString with a name like "myspeed") which you can use in TidalCycles. In the case of

osc.sendMsg("/ctrl", "myspeed", ((val/(127/4)) - 2));

you can use it in TidalCycles like:

d1 $ sound "bd" # speed (cF 1 "myspeed")

Thanks. Ok, in supercollider you can use linlin and linexp for mapping

val.linlin(0, 127, -2, 2);

Exploring this a bit further, but to me it seems more easy to do it on the Tidal side actually.

d1 $ sound "bd" # speed (range (-2) 2 $ cF 1 "12")

This way you don't have to re-evaluate in supercollider, because you need to define a new with a new mapping there.

Also on Linux, when you evaluate


twice, you get a doubled number of Supercollider MIDI in and output ports. This seems to work better:

MIDIClient.init(7, 9);