Send MIDI as OSC message?

I see there is a

void midi( uint8_t *port, uint8_t *status, uint8_t *data1, uint8_t *data2 ) const;

in cinder::osc::Argument class and even a tiny example in the test app, which sends something that looks like a byte array. But how does one send a meaningful midi in practice? For example, how do I send a MyGreatMusic.mid file (which I created in Garage Band) over to my iOS device (whose default IOS AudioPlayer is believed to be able to play midi files as if they were regular audio files).

Thanks.

–8

Last time I used MIDI is 20 years ago, so I may be wrong, but sending MIDI and playing MIDI on iOS are two different things. When playing MIDI on a PC or tablet, the operating system uses a software synthesizer that takes the MIDI data and converts it to audio. For this to work, it needs to be able to look ahead in the data to synthesize it “just in time”. It’s not a fully fledged musical instrument, so you need to send the whole file - not a single MIDI packet.

As OSC is just a data transmission protocol, it can be used to transmit any kind of data over the network. The name “Open Sound Control” gives away that it was designed as an alternative to MIDI, which is why the protocol defines a standard(*) way to transmit a MIDI packet. When you receive MIDI data, you still need to process it on the other end. You could for example send it to a digital piano connected through USB or a MIDI cable. See this article for more info.

-Paul

(*): officially, MIDI is not part of the OSC v1.0 protocol, but is defined as an “extension”, see: http://opensoundcontrol.org/spec-1_0

Here is an example of playing MIDI data, MIDI file and MIDI sequence on iOS device: GitHub - genedelisa/MIDIPlayer: Swift example of using AVMIDIPlayer from a file or from a MusicSequence

I think it is possible to figure out how to feed the MIDIPlayer above with the OSC block midi message, or as a last resort, an OSC block blob message, but I am curious about the intent of the block’s creators (or the OSC spec you point to), specifically regarding

m 4 byte MIDI message. Bytes from MSB to LSB are: port id, status byte, data1, data2

Thanks.

–8