Many synths have nice features which can't be configured via MIDI, because MIDI offers a limited set of commands. At the same time, OSC supports is not that widespread.

I was thinking that maybe MIDI ports could be used to send arbitrary data, in a way similar to how RPCs work.

This way you could for example write a Python program that fully interacts with a running ZynaddsubFX instance easily, without any API calls. Just connect it to the JACK/ALSA MIDI in port, send the commands and (if necessary) get the results back from the MIDI out port.

Was this ever attempted? Is there a way to use MIDI to send arbitrary data?

The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]

Why do you want that?
First point is, you need to abuse a protocol to do so, this abuse must be supported by the application you want to serve by this.
Much easier is a socket to use, which could do all that, without abusing a protocol. A (rpc) socket could as well be used across networks, so you could control the app in question from a other PC or tablet or even from your Phone, not only from a python script.

btw. guitarix does that since years now, and a lot of projects use sockets to control guitarix from a arduino board for example, or control guitarix running on a RPI.

tramp wrote:Why do you want that?
First point is, you need to abuse a protocol to do so, this abuse must be supported by the application you want to serve by this.
Much easier is a socket to use, which could do all that, without abusing a protocol. A (rpc) socket could as well be used across networks, so you could control the app in question from a other PC or tablet or even from your Phone, not only from a python script.

btw. guitarix does that since years now, and a lot of projects use sockets to control guitarix from a arduino board for example, or control guitarix running on a RPI.

Well, you are right, I guess I was thinking about using already established things like JACK to make this kind of communication more straightforward for non-techies as well...just plug two MIDI ports and let programs do the talking, something like that.

The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]

Yes. You put the data inside a "System Exclusive" MIDI message. This message starts with the hex byte F0 and ends with the hex byte F7. In between these two bytes can be any number of bytes, for any purpose. But the data bytes must be 7-bit (ie, only values 0 to 127). So if you need values 128 to 255, you'll have to "bit pack" the data when it is sent, and unpack when received.

To make sure you don't interfere with System Exclusive messages already used by various MIDI equipment, it's recommended that the first (one to three) data bytes be a "manufacturer's ID" as registered with MIDI Manufacturer's Association (MMA). For example, Microsoft's ID is hex 00 00 41. So Microsoft sysex messages start with the 4 bytes: