Is it possible to get the instrument used in a midi file?

Hi All,

First thanks Jules for this Library, it is really usefull,

I have never used it before, but it has been recommended to me by many people on different forums. I have many .midi songs, what I want to do is to write a C++ program to get the midi events in each songs and also get the instrument played for each note in every file.

I wonder whether I can do that using Juce or not ? I have been reading the documentation for 2 days, I don’t want to loose more time specially if this Library can not help me,

Thanks for our help,


Yes, of course - you’d want to look at the MidiFile and MidiMessageSequence classes for that.

Thanks for your answer,
I started working with Introjucer, the problem is that the window close down just after creating a new project.
On the other hand, I think that it is more convenient for me to work with any editor (emacs in this case)
Is there anyway to import the Midifile and the MidiMessageSequencer to my program and use the methods that the two libraries offer ?


Sorry, can’t really understand what you’re asking… (?)

Sorry for not being clear.
Can I use something like that on my code :
" include " Midifile.h"
Import “Midifile.cpp”
I want to use the methods in my code directly instead of passing by Introducer ?

No - there are lots of dependencies. You can include the whole module, but I would recommend using the introjucer if you’re not an expert. I’m not aware of any bugs in the introjucer, but if it’s misbehaving please give me some more details and I’ll sort it out.

The window closes down whenever I create a new project, and click on the main to see what is on that (using the same window).
Actually, what I need to do with midi is just a sub task, I need also to use another data structure (musicxml) in the same project. So in this case including the whole module Juce would be better to manipulate midi files, No ?

Sorry, can you try explaining that again…? Is it crashing? What does “click on the main” mean? If it’s crashing, have you run it in the debugger?

And just in case: You’re using the very latest version that you’ve built from the latest GIT source tree, right? Not some months-old binary you downloaded from somewhere?

Yes, I followed all the steps that are in the website to download.
So, when I create a new project, in the left side of my new window i have : Files and Config.
I go to Files, there is tree structure there, I go to Main.cpp, the Introducer window crashes after that.

That’s bizarre - I can’t imagine what’s going on… What OS? And if you run the introjucer from the debugger, what’s the stack trace?