Please help me, play midi

As I can reproduce a midi.

step 1

        MidiFile midiFile;
        FileInputStream* midiFileInputStream;

        File tempfile = File(T("test.mid"));

        if(!tempfile.exists())
            return;

        midiFileInputStream = tempfile.createInputStream();

        midiFile.readFrom(*midiFileInputStream);

yes or no

That’s the right approach.

I am trying too to create a midi player but I see Juce uses software timer which cannot be precise.
I remember in CoreAudio was possible to schedule midi message with timeStamp and the Hardware was in change to deal it.
It would be great if i next future Juce releases will be a Hardware Time if different platform, what makes Juce great !!!

Can you please link where you saw that? If that’s the case it is a leftover that should be cleaned up.
The only place I know is on the MIDIKeyboardComponent, which cannot be precise anyway, because the additional events come from the message thread (UI interaction).

The usual approach in JUCE is to schedule midi events synchronised to the audio block it is about to play (processBlock()).

1 Like