Get note data from MIDI file

后端 未结 3 1245
借酒劲吻你
借酒劲吻你 2021-02-02 02:43

Is there a way to get the note data from a MIDI file? That is, I want to break down the MIDI file into its constituent parts so they are in the form of a unique word (or any ot

相关标签:
3条回答
  • There is a number of ready made solutions, taking input from MIDI file, generating musical visualization, so in theory and practice, MIDI parser works fine

    I am working on such musical visualizer in HTML5, generating vertical top > down notes timeline live to support handicapped piano players.

    DLP projector is great but it seems, I need to install large LCD TV screen, just over the piano keyboard to get visualization to match the notes played

    @Brendan Kavanagh is the leader another key developer is called Stephen Malinowski

    just follow my question to get the right web links

    How to build MIDI file visualizer to get input from MIDI file and display MIDI timeline over the keyboard to match notes played by a real player

    0 讨论(0)
  • 2021-02-02 03:39

    Parsing MIDI files by hand is no fun, take my word on this. ;) The format, although well documented, is difficult to deal with since you are always on the raw byte level. Since you are interested in extracting some meaningful information from MIDI files themselves, I'd recommend using a framework such as Juce, which is written in C++ and has support for reading MIDI files.

    Juce is pretty large, but the API is good and well-documented. The class for parsing MIDI files, for instance, is pretty straightforward and easy to use.

    0 讨论(0)
  • 2021-02-02 03:40

    Nik Reisman - sorry, but I don't agree with you...parsing midi in C#, C++ is something about 400 rows of code..It's nothing hard and it is nothing difficult.

    I will advise you start with this link: https://web.archive.org/web/20141227205754/http://www.sonicspot.com:80/guide/midifiles.html
    There is everything you need to know about midi and how to read it..

    In the short description how the parser will work:
    1)Open midi in byte mode
    2)Read the header chunk where there is info about size, number of tracks and IMPORTANT file format!!
    - There are 3 types of formats: 0,1,2 (type 2 is really "valuable", there are only few midi files with this type, so you don't need to read the midi if there is type 2)
    - if there is not written: "MThd" (0x4D546864), end with error (it's a bad midi file)
    3)Read track chunk
    - if there is not written: "MTrk" (0x4D54726B) end with error (it's a bad midi file)
    4)Read the midi events.. - There are very many events, you can read them all with if-else commands, or you can read only the events what you want to know, for example NOTE ON, NOTE OFF - Sometimes in some midi files are not NOTE OFF..this event is changed with NOTE ON and velocity 0

    On the websites everything is explained really nicely. If you open the midi file in byte mode you will have only a few methods and everything is then only about if-else commands and there you will catch what is stored right now.
    It is important to understand VARIABLE LENGTH, but on the websites it is also explained. It's not hard. You can google many sites where VARIABLE LENGTH is explained too, with some images and examples. So I don't think that it is hard to explain it in here.

    If you want a bit more advice, write me, I will try it. But parsing midi is not as hard as how it looks. If you have some problems, write me..

    0 讨论(0)
提交回复
热议问题