ofxMidi on iOS

Hey everyone,

Just a quick question that I’ve not managed to find an answer to just yet!
I was wondering if ofxMidi works on the iPhone build of Openframeworks?

Would be very keen to find out!



I don’t think it does. I’ve been thinking about packaging up http://gitorious.org/midimonitor into an OF addon though. It’s a CoreMIDI wrapper for iOS.

Hey Seth,

Ha, odd coincidence!

I’ve just managed to work that code into an Openframeworks project (posted sample code on my site)

So far I’ve just managed to get Midi Out working (and only tested on a Wifi MIDI connection) however it’s a start! I must admit that I’m not an expert on Objective C so there is definitely a better way of doing it, I’m sure!

Let me know what you think!


I’ll take a look later glidepro. I got the code working outside of OF a few weeks ago, but haven’t had time to go back to it. It should be fairly simple to make it an addon I think. I’ll take a look at what you did and maybe can use it in my project as well. :slight_smile:

I think it would be a good idea to maybe wrap some of the code in a .mm to make it easier. That way we can call it like cpp instead of having to use obj-c.

Like instead of having to do this:

	// put all the data together and send...  
	const UInt8 note      = noteValue[touch.id];  
	const UInt8 noteOn[]  = { 0x90, note, 127 };  
	[midi sendBytes:noteOn size:sizeof(noteOn)];  

we could put in a wrapper that could just call:

midi.noteOn(channel, note, volume);  
midi.noteOff(channel, note);  

and inside noteOn would be:

void midi::noteOn(uint channel, int note, int volume){  
//noteOn function wrapping the obj-c code  
	const UInt8 noteOn[]  = { channel, note, volume};  
	[midi sendBytes:noteOn size:sizeof(noteOn)];  

Just popping in to say:


This is exactly what I needed, and I was beginning to think that I’d need to figure out the Objective-C wrapping myself, which is not currently in my skill set.

Your code dropped right into my current iPad interface project and worked from the first build.

@momo_the_monster: great! glad it’s working for you!

@seth: yes, I think putting the MIDI code into wrappers like that is a good idea! As well as note on/off it’d be cool to get some sort of method that will let you use controller changes in a ‘friendly’ way too - might start work on that!

I’m also looking for this, but would rather see ofxMidi upgraded to include iOS support and use a single api rather then use a separate one between desktop and mobile device. How much trouble would that be?

I haven’t looked at the similarities, but there’s little documentation for CoreMIDI on iOS and the one glidepro uses is pretty much standard I think for what people are using on iOS gitorious.org/midimonitor.

It could be combined with ofxMIDI, although if there’s more updates to midimonitor later that could be a problem. I haven’t had time to look yet, but it’d probably be best to look at the API calls and see if the CoreMIDI on the desktop and for iOS are the same or not and go from there.

I haven’t looked at the similarities, but there’s little documentation for CoreMIDI on iOS and the one glidepro uses is pretty much standard I think for what people are using on iOS.

ofxMIDI uses RTMidi and RTMidi doesn’t support iOS. So, I don’t know if it can all be merged into one. It could probably use the same API calls though so things are consistant and depending on the OS you include either ofxMIDIiOS or ofxMIDI and the calls are the same.

have you tried to compile rtMidi for ios? internally the mac version uses coremidi so thoretically it should work

PGMidi works on iOS 4.3 - but I have no idea how to roll it into an addon.

I dont think RTMidi has the calls that iOS uses. For example using wifi or CCK. I could be wrong.

skinnyTOD, they’re using midimonitor which is what we talked about in the earlier posts. I think midimonitor is the best framework for MIDI on iOS right now. I’m not sure trying to get rtMidi working on iOS is worht it (especially since I don’t think it supports the necessary calls). It would make more sense to just use midimonitor and wrap the code into the same API as ofxMIDI so they’re switchable.

Just to let you know I am working on it

Great Chris! Let us know if you need some testers when it’s ready.

Have there been any updates to this?

I also wanted to share this (you may need to join the group to see it) https://docs.google.com/document/d/1UW-8vPEf95p0zO0hV1lpwD5MTgefKB1y-jdWR-nFYM8/edit?hl=en-US&pli=1

It’s kind of a MIDI standard for iOS (maybe mac too) for implementing MIDI on iOS. It’s created by some of the top music iOS developers and I think variable valuable when considering what features ofxMIDI should have.