(not sure if this is the right forum for this topic)
Hi - as a starting point for working with midi in oF I want to make a little midi player: take input from a keyboard or midi file and play it back using the OSX QT synth.
I have compiled and am able to run the ‘midiexample’ file that has been mention elsewhere on the forum. I am able to get input from the keyboard through this message function:
void testApp::newMessage(ofxMidiEventArgs &args){
int port;
int channel;
int status;
int byteOne;
int byteTwo;
double timestamp;
cout << "MIDI message [port: " << args.port << ", channel: " << args.channel << ", status: " << args.status << ", byteOne: " << args.byteOne << ", byteTwo: " << args.byteTwo << ", timestamp: " << args.timestamp << "]" << endl;
// trying to rout the msg to midiOut:
if (args.byteTwo == 0){
midiOut.sendNoteOff(args.channel, args.byteOne, args.byteTwo);
cout << "off" << endl;
} else {
midiOut.sendNoteOn(args.channel, args.byteOne, args.byteTwo);
cout << "on" << endl;
}
}
The msg info looks like this:
// start up code to list ports
ofxMidiIn: 2 ports available
0: IAC Driver IAC Bus 1
1: USB Keystation 49e
ofxMidiOut: 2 ports available
0: IAC Driver IAC Bus 1
1: USB Keystation 49e
//msgs received from keyboard input
MIDI message [port: 0, channel: 1, status: 144, byteOne: 41, byteTwo: 77, timestamp: 0]
on
MIDI message [port: 1101081088, channel: 1, status: 144, byteOne: 41, byteTwo: 0, timestamp: 0.143988]
off
MIDI message [port: 1107697408, channel: 1, status: 144, byteOne: 43, byteTwo: 41, timestamp: 11.8763]
on
MIDI message [port: 1101112576, channel: 1, status: 144, byteOne: 43, byteTwo: 0, timestamp: 0.14803]
In the code above I am trying to route the msg to an instance of midiOut - but it is not resulting in any sound. Am I missing an additional lib or set up? Not getting any error msgs. I’m a little confused by the ‘port’ value changing for each incoming msg.
While I’m here - I will also want to play a midi file, so any tips on that would be helpful too.
Thanks!