Re: MIDI file utility
Posted: Mon Jun 18, 2018 12:07 pm
kortezzzz wrote:Tested it on 3.0.6 and it seems working. Also the rewind" feature is very cool. Wondering if there is any way to just extraxt the full midi data out of the file without playing the notes. String format is welcome since it can easily set parmeters of any kind of Ruby based note\step sequencer inside FS. In that way, we can use the file utility as solid midi data extracter insteed of a player
You indeed can.
Code: Select all
file=MidiFile.load_file(path) #opens and parses the midi file
list_of_midi_events= file.tracks[0].events #gets array of midi events from track 0 of the midi file
Note, the midi events are various subclasses of MidiEvent. To get corresponding Midi objects that flowstone recognizes, you must call .to_midi method on them (which will usually return nil, because the feature is not fully implemented yet). However, the MidiEvent objects are more useful, because they also contain time-position within.
A full blown midi editor is indeed a planned feature...