Play midi file with clock out

#1

Hi all,

I would like to be able to play a midifile and a clock out in the same way as you might do in Ableton or Logic.

Does anyone have a tried an tested way of doing this.

So far I can…
Send a clock out with ofXMidi no problem.
Play a file out with ofxThreadedMidiPlayer no problem.

I am just not quite sure how to run them both together in a sensible way. You could run them seperately I guess but what if the song changes tempo.

Has anyone got anygood ideas on this?

Many thanks
Simon

#2

Hi, it should be quite straight forwards mixing both. I haven’t looked at the midi player in a while but I think that it might be already implemented.
Have you checked ofxPDSP? at least it has an example called example_midi_seq_out which probably does what you need.
cheers

#3

Ah great thanks for replying Roy. Your library seems to work well with 10.1 so it would be nice to use it. I am just wondering whether it is best to implement the clock within your library or as a seperate thing. Hoping to run the whole thing on a Raspberry pi and sync a video with a midifile being played out.

Will have a look of ofxPDSP but looks like it might be overkill.

Cheers
Simon

#4

Hi,
sure, ofxPDSP might be a bit overkill for what you need, but if it is already implemented it might be easier.
I think that it would be easier if you just modify the addon and ad the code to send the timecode and the clock,

#5

Thanks Roy,

I have not ventured into modifying addons but it definitly seems cleaner than running the clock somewhere else. I will see what I can do and post the code if it works…

Cheers

#6

Hi,
The thing is that I am not sure how the midi clock works. because there is midi clock and midi timecode. Take a look at ofxMidi, there is an example for receiving clock and timecode. You’ll need implement it for sending but the logic should be the same. It would be better to handle it inside the threaded midi player so you can use the same midi out , then you’ll need to do the clock sending inside its thread so you dont have conflicts. This means putting all the needed code inside the ofxThreadedMidiPlayer::threadedFunction()
let me know how it goes and just ping me if you need help.
cheers