«Simple MIDI CC to Sysex messages ( proof of concept )» by hems.inlet

on 03 Jun'15 00:46 in midisysexcctestroutingmapping

This snippet is a proof of concept showing how to map MIDI CC to MIDI Sysex messages.

It can be improved by filtering MIDI source, and routing channel and control number in a neater way.

unfortunately i couldn't test this code on my synths, the CC part was tested.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// running this line will show all your MIDI ins and outs on the console
// find the number of the output interface you want to use
MIDIClient.init;

// select the midi out you would like to use
m = MIDIOut( 8 ).latency_(0.0);

// send a sysex functions
// some example messages MKS-50 here:
// "http://www.vintagesynth.com/roland/sysex.php"
// this one using MIDI CHANNEL 2 ( 0x01 )

// set filter
~set_param = { | param, value |
  m.sysex(Int8Array[ 0xF0, 0x41, 0x36, 0x01, 0x23, 0x20, 0x01, param, value, 0xf7]);
};


// connect will connect to all midi in devices
// if you need to specify one,
// check the sources at: MIDIClient.sources
// and connect using MIDIIn.connect(  source_index )
MIDIIn.connectAll;

// show incoming control data
~control = { arg src, channel, control, value;
  
	// ( control + " : " + value ).postln;
  
  switch( control,
  32, {
      // value.postln;
	  // still have to convert value to hex number
  	  ~set_param.value( 0x10, value );
  });
};

MIDIIn.addFuncTo(\control, ~control);
raw 1059 chars (focus & ctrl+a+c to copy)
reception
comments