Midi SysEx Messages



am I correct in assuming that currently it is not possible to send SysEx messages with Sonic Pi?



You can send raw midi so probably can that way though I’ve not investigated it.



Yes, I have seen that. The thing is that I need to send something like:

F0 00 20 6B 7F 42 02 00 **01 70 09** F7 (source)

and up to now I have not spotted how to translate this to something like

midi_raw 0xb0, 0x79, 0x0  # example from Sonic Pi doc

accepting only 3 bytes. As far as I understood sysex commands contain more than 3 bytes (as in the example above, where the mere midi control data bytes are #9 to #11).



Great question. It should work, but I have to confess to not having tried it myself, so it’s possible there’s a bug somewhere.

I’m currently on the road, so it’s a bit hard for me to try something out right now, but please pester me if I don’t get back to you on this.



First time I tried, it did not work. But I’ll give some more effort tomorrow. Maybe I did someting wrong.

If I understand correctly I will just have to spit up the command in 3 groups, right?

Thanks for the input, @samaaron !



Hi Sam,

if you have the time I’d like some help about this issue. I have confirmed that I can trigger the controller by using amidi. F. e. I can send the following message to trigger a pad’s LED to on:

 amidi -p hw:2 -S 'F0 00 20 6B 7F 42 02 00 10 77 01 F7'

I tried different versions but I do not manage to send the same command using Sonic Pi’s midi_raw.

Some obvious questions:

  • How do I divide the command (if at all); midi_raw expects 3 bytes (or at least parts) if I interpret the documentation correctly: “midi_raw a (byte), b (byte), c (byte)”
  • Do I need the sysex delimiters F0 ... F7?
  • Do I need the hex prefixes 0x; if yes: for all bytes?
  • Finally - and an answer to the questions before: Could you give an example using the above mentioned sysex command I sent with amidi that I could try?

I’d be very grateful for some help on this issue.




I’m in Australia for a couple more weeks. Hopefully I’ll an opportunity to look into this before Christmas.



Yes, I know. Have a nice stay. No hurry with that.



Complete Rewrite of Live Looper

I’d like to chime in and show interest in this functionality. A lot of the controls on the Roland Integra 7 use sysex commands and they are usually around 14 bytes. This could open some doors to new possibilities.



I’m a SysEx junkie. Actually got into SysEx midi before midi noteOn/Off or CC because I realized I could control deep parameter settings of my Lexicon MPX1 pro. MidiOX is an awesome tool for analyzing what is going on with midi.

Please get Sonic Pi to support SysEx because I will use it to control effects parameters on hardware in sync with performance. Legendary!



I just stumbled in here while checking some Beatstep sysex stuff…

As a preliminary solution you could try to make a sequence of midi_raw calls by splitting up your sysex into 3 byte chunks. This should work as far as I can tell from looking at the Sonic Pi code.

In order to simplify things you could define a function in Sonic Pi to do just that:

def midi_rawest(*args)
  midi_raw *args.take(3)
  midi_rawest *args.drop(3) if args.length > 3

The new function should allow you to send longer messages, i.e.

midi_rawest 0xf0, 0x00, 0x20, 0x6b, 0x7f, 0x42, 0x02, 0x00, 0x10, 0x77, 0x01, 0xf7

Please note that I haven’t tested the function as I am not in front of my music PC.

1 Like


Hi @Daniel,

thanks for looking into that!

I will have some time at the weekend and try, what you are recommending …

PS.: I like the function name midi_rawest :wink: