ofxMidi - calling specific midi notes?

Hello all,

Recent user of openframeworks - I love the features of the framework and what some people have been able to build with it

My one question is this -

If I want to target a speific midi note (say C4 for example) to trigger a change of background color - how do I grab that midi information and use it in ,say a switch statement?

I was using the keypressed() and using keys on the keyboard to trigger ofSetBackgroundColor() but cant seem to figure out how to get it functioning with midi data

Any help would be greatly appreciated!


Check the midiInput example with ofxMidi, there is this method there

void ofApp::newMidiMessage(ofxMidiMessage& msg) {

	// make a copy of the latest message
	midiMessage = msg;

The midi message contains all the information you need, so to get the note you can check like this in a basic way:

if (midiMessage.pitch==30)
		//do something here


fanatastic stuff!

thank you so much for your help!