Skip to content

Instantly share code, notes, and snippets.

@yaxu
Last active January 16, 2018 08:48
Show Gist options
  • Save yaxu/2822ea149c202d9dd0ceb2ae5bfe2f2b to your computer and use it in GitHub Desktop.
Save yaxu/2822ea149c202d9dd0ceb2ae5bfe2f2b to your computer and use it in GitHub Desktop.
Midi interface
// in sc..
MIDIClient.init;
~midiOut = MIDIOut.newByName("X18/XR18", "X18/XR18 MIDI 1");
// prototype: addMIDI { |name, device, channel=0| ... }
addMIDI("vbass", midiOut, 1)
// in tidal
d1 $ n "c a f4 e" # s "vbass"
// since channel is only default send something to tenth channel on same device as the vbass like this:
d1 $ n "40" # s "vbass" # channel 9
// these could all do the same, i.e. set pan (which is general midi control 10):
d1 $ cc "10:60 10:122" # s "vbass"
d1 $ ccv "63 127" # cc "10" # s "vbass"
d1 $ pan "0.5 1" # s "vbass"
// could also be paired with 'n' to both set the control change and set the note
d1 $ cc "10:60 10:122" # n "c7 a7*2" # s "vbass"
// The mapping from the 'pan' parameter to cc 10 would be best in superdirt I think, because tidal wouldn't necessarily know that 'vbass' was a midi synth.
// Starting midi clock could be as simple as this, the logic for this could be done in tidal:
d10 $ midiclock "vbass"
@telephon
Copy link

yes, that looks good. I'd change the signature of addMIDI to addMIDI { |name, event| ... }, so that you'd write: ~dirt.soundLibrary.addMIDI(\vbass, (device: ~midiOut, channel: 0), and you could specify any other defaults here, all of which could be overridden by tidal.

Do you have a list of parameters that would indicate a specific midi command, like cc indicating control change?

And a list of mappings from parameters like pan to certain midi parameters? I'd make all of these open to different specification, just adding the simplest case as defaut.

@jarmitage
Copy link

jarmitage commented Jan 15, 2018

As well as having the grp function for cc, it should also be possible to use two functions, e.g.

d1 $ cc (choose [8,9,10]) (discretise 8 $ scale 0 127 sine) # s "vbass"

This could be cc' I guess - that's the pattern I use for this in my own Tidal setup, e.g. I have lpf using grp and lpf' as well.

Perhaps ccn and ccv might be clearer for the single param versions?

channel for MIDI channel is still not super obvious, can that be made clearer? Are we still going to use s "midi" for unnamed devices? It could possibly be # midi 9 instead of # channel 9.

@jarmitage
Copy link

@telephon in terms of mappings for CCs, something like this? http://nickfever.com/music/midi-cc-list

@telephon
Copy link

ok, good. Next is a list of parameter names we want to use in tidal. Should we prefix by 'midi' or is that too wordy?

e.g.

midichan
midion
midioff
midicc

etc.

cc could be an exception, because it is clear

@telephon
Copy link

you wouldn't name devices, but just link names and default parameters to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment