Re: Powerfull Midi manipulation Ruby library
Posted: Fri Sep 24, 2021 10:05 pm
aefa wrote:I know this is an old post but, did anyone ever got anything out of this lib? All I can do is read the file make a sequence or a MIDIFile but I can't figure out how to parse events and tracks out of it!
The MIDI reader is already parsing. It identifies note on/off, cc, sysex, etc. and triggers a method for each of these. For example, when it encounters a note on it triggers
note_on(allvalues you need, like velocity, channel, etc.)
So, in your RubyEdit you create a
def note_on(allvalues you need, like velocity, channel, etc.)
##your code handling this note_on goes here##
end
Look for NoP in the library, between start NoP and end NoP comments are all the methods you can use as I described above. Make sure your definition has the exact same amount of arguments, and it should work just fine.
In the same way you also get global data, like tempo, signature, number of tracks, etc.
I'm afraid you have to read all the comments in the library, as they explain how to use all the methods. But I think my explanation above about YOU creating a method definition in YOUR RubyEdit, matching the method that gets triggered by the parser, was the missing link?