Processing midifiles with Ruby

If anyone else has a need to handle standard midifiles with Ruby
they might be interested in a little package I’ve written for that

A little while back I found I was doing a lot of analysis of some
particular midifiles. Typically I was using one of the midifile->text
packages and then running a ruby script on the result, but those
extra text files became an annoyance, and I figured it would be better
to read the midifiles directly with Ruby.

I found Jim M.'s ‘midilib’ quickly, but it seemed both more and
less than I needed. (‘Less’ in particular because it doesn’t handle
Format 0 files, and those were what I was looking at then.) So [of
course!] I ended up writing a library to suit myself. I’ve finally
cleaned it up and added a bit of documentation, so I’m making it
available in case it’s useful to others.

It provides facilities for both reading and writing all types of
Reading is particularly simple – you simply create a Midifile object
the opened file as a parameter, and use its ‘each’ method to extract
every element of the file in sequence. Building a new file for writing
is also straightforward. The package includes a few demo scripts to
illustrate its usage.

I’ve put the package up on the web at:

– Pete –

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs