Convert MIDI to Java data structure (List, Hash Map, ???) -


i want grab midi file, read it, , store data in sort of data structure. using site found easy way read file, works charm:

reading midi files

now need figure out way grab output , store it. hash map doesn't seem ideal since keys need unique , list of type object doesn't seem great. ideas on best option might be. suppose might output text or csv... thoughts?

update: bit more detail on have.

here output i'm getting (through system.out.println):

@0 channel: 1 note on, e5 key=76 velocity: 127 @192 channel: 1 note off, e5 key=76 velocity: 64 @192 channel: 1 note on, d#5 key=75 velocity: 127 @384 channel: 1 note off, d#5 key=75 velocity: 64 @384 channel: 1 note on, e5 key=76 velocity: 127 

now need find best method of storing information. should expicit "why" i'm trying well. i'm working developer going take data , use batik (which know nothing about) display on screen.

thanks responses... i'll closely @ each of them tonight...

reading midi file specifications, think can start creating like

public class midifile {     enum fileformat {         single_track,         syncronous_multiple_tracks,         assyncronous_multiple_tracks;     }      fileformat file_format;     short numberoftracks;     short deltatimeticks;      //create class tracks, events, put collection storing tracks,      //some collection storing events inside tracks, etc      //collection<integer, miditrack> type of collection depends on application  }  public class miditrack {     int length;     //collection<midievent> type of collection depends on application }  public class midievent {     int delta_time;     int event_type;    //use of enum or final variables interesting     int key;     int velocity; } 

if want store midi messages (so not midi file), class messages

public class midievent {     int delta_time;     int channel;     int event_type;    //use of enum or final variables interesting      //two bytes, interpret according message type     byte byte0;     byte byte1;      //or more memory consuming     byte key;     byte pressure;     byte controller;     short bend; } 

the type of collection use store application specific, how want access elements of list, , more.

if want insert midimessages in collection , read first last use linkedlist (that's implementation of list). if want modify messages , access elements index, want use arraylist (that's implementation of list too).

information of midi file structure http://faydoc.tripod.com/formats/mid.htm


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -