Midi classes

Hi !

I want to create a little MIDI File player with the Juce Framework, but i’ve no sample in the demo source except for the MidiKeyboard.

I just want to know if someone can help me to understand how work theses classes. A source sample is welcome if possible!

For the moment I can open a MidiFile, get the tracks separatly but I don’t understand really how to put the sequence message to a (pre)opened MidiOutput?

I’ve read the two topics about MidiFile and i don’t get the “PlayingMidiFile.zip” sample code from Wolfen. The link is broken. Can you help me Wolfen?

In all case, thank’s a lot to Jules for the hard work you’ve made.

Nobody can help me ?

I don’t have any sample code for that… You basically need to run a thread and send out midi messages at the right time.

Thank’s man. Now it’s good.

I generate a timestamp with a MMTimer (accuracy ~1/2ms) and a Juce Thread send at right time the message to a MidiOuput device.

My first test is very basic but the beat is fine!

Have a good day

Hello dorpxam,

I’m also interested in implementing a basic midi file player within the juce framework.

Can you share your small piece of code (the timer/thrad part) ? When you talk about MMTimer, is it the windows specific stuff or dit you use the Juce Time class ?

Thanks

Hello dorpxam,

I’m also interested in implementing a basic midi file player within the juce framework.

Can you share your small piece of code (the timer/thread part) ? When you talk about MMTimer, is it the windows specific stuff or dit you use the Juce Time class ?

Thanks

Sylvain Clément
Lille, France

I really don’t recommend using a windows mm timer for this kind of thing. The way I did it in tracktion was with a high-priority thread that uses Time::waitForMillisecondCounter to wait for the correct time.

With Windows I got accurate timing with the MIDI stream functions - you queue up a load of MIDI messages and let Windows do all the timing for you.

I think Juce only supports the low level immediate messages for MIDI (I’ll see what MIDI API it uses).

Does Mac have anything similar, where you can tell the system what the PPQN, tempo etc. is, feed it a buffer and let it do all the work?

Thanks Jules,
My initial intention was playing with your Time class but but the message from dorpxam led me thank that it was not enough accurate. It works in Traktion so I’ll be happy !

Sylvain Clément

It’s accurate to about 1ms, which should be fine for external midi gear.

waitForMillisecondCounter is the way I did it. (after wasting vast amounts of time bollocking about with Win32 timer bollocks! ) nice to see the fearless leader done it the same way!