Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Powerfull Midi manipulation Ruby library

Post any examples or modules that you want to share here

Re: Powerfull Midi manipulation Ruby library

Postby tulamide » 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?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2686
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Powerfull Midi manipulation Ruby library

Postby aefa » Sat Sep 25, 2021 8:42 am

tulamide wrote:
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?


Thank you very much tulamide! I'm not very good at programming but I'll get into it! I was reading the procedures up and down and totally didn't understand the reason for the NoPs. I'll post the progress (if any) :)
aefa
 
Posts: 48
Joined: Wed Mar 26, 2014 12:52 pm

Re: Powerfull Midi manipulation Ruby library

Postby benjoe » Fri Nov 11, 2022 11:09 pm

User108 wrote:Hello to all, I've found some awesome midi library MIDILIB (Google it for details) and succeeded to fully integrate it to Flowstone's Ruby - no need to carry extra files, just paste one instance of Ruby code component containing all the functions of MIDILIB - and you are ready to process midi files. Hope, this will give birth to long-awaited sequencers written in pure Ruby. Good-luck! I also attach original MIDILIB - you don't need it, but may look at its factory code examples.

And I would thank all the developers for such a perfect tool as Flowstone. I was disappointed by Synthmaker's inability to deal with binary files, but now Flowstone fixed this and brings me back as a happy user thanks to Ruby. :)


I know this is an old post,but can you explain or make a version where the midi is written from the keys pressed and it's not quantizing? Like a midi recorder to file. It has to record polyphonic stuff,not just like a simple sequencer.
benjoe
 
Posts: 4
Joined: Thu Oct 22, 2020 8:32 pm

Previous

Return to User Examples

Who is online

Users browsing this forum: No registered users and 36 guests