Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading MIDI Files

Tags:

java

midi

What is the best way to read a MIDI file (chronologically) with multiple tracks? (Java)

Note: I don't want to play the MIDI file, just read the messages.

Couple ideas:

Is it safe to assume there are no note events shorter than the 1/64th note? Or should I visit every track and only move to the next tick after all other ticks tracks

  • Assume there is no midi event shorter than a 1/64th note, and move the current position tick count by that fix delta.
  • Visit every track and progress to the next earliest tick
like image 628
Venus Avatar asked Jul 25 '09 19:07

Venus


People also ask

What program opens a MIDI file?

MIDI files can be opened with Windows Media Player, VLC, WildMidi, TiMidity++, NoteWorthy Composer, WildMIDI, Synthesia, MuseScore, Amarok, Apple's Logic Pro, and very likely some other popular media players. To play one online, try Online Sequencer.

What information is in a MIDI file?

MIDI Files contain one or more MIDI streams, with time information for each event. Song, sequence, and track structures, tempo and time signature information, are all supported. Track names and other descriptive information may be stored with the MIDI data.

Can a computer play MIDI files?

If you want to just play MIDI files on your PC, you can use media player software like VLC. Thankfully, Windows Media Player also supports MIDI as input format. So, you don't need third-party software to play MIDI files. Just import a MIDI file into it and play it.


1 Answers

JFugue can read a MIDI file and sort the messages in chronological order.

The results can be read as JFugue MusicStrings (for example, C-sharp, 5th octave, whole note = "C#5w"), or you can write your own ParserListener and attach it to the MidiParser so you can output your own text.

like image 74
David Koelle Avatar answered Oct 12 '22 12:10

David Koelle