Nathanael,
    Just to get you started, there are functions defined in portsmf to 
read in a standard midi file given a (string) file name.
    What you get back is an Alg_seq_ptr, a pointer to a C++ object. 
Within the object, there is a time_map that essentially contains the smf 
tempo track, a time_sigs that is a list of time signatures from the smf, 
and an array of pointers to track objects.
    Each track object shares the Alg_seq's time_map and contains a 
dynamic array of pointers to events, where an event is either an 
Alg_update or an Alg_note. Alg_updates are basically <time, attribute, 
value> tuples and Alt_notes are basically <time, duration, channel, 
pitch, velocity> tuples. You can tell the type of an event by its tag 
field which is 'u' or 'n' for update or note.
    The Alg_seq class has important methods convert_to_beats() and 
convert_to_seconds(), which do global mapping on all events in the 
Alg_seq, changing their time and duration fields between units and 
seconds, allowing access either way.
    For debugging, the package can save an Alg_seq in the "allegro" or 
".gro" format, which is a human-readable ascii format -- very handy for 
seeing what's going on inside the data.
    This should at least give you some tips on what to expect and look 
for. Let me know if you get stuck anywhere.

    -Roger

_______________________________________________
media_api mailing list
media_api@create.ucsb.edu
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to