[ANN] midilib initial release

J

Jim Menard

midilib is a pure Ruby MIDI library useful for reading and writing standard
MIDI files and manipulating MIDI event data.

The latest version of midilib (0.8.0) can be found on the midilib Web site
(http://midilib.rubyforge.org/). The midilib RubyForge project page is
http://rubyforge.org/projects/midilib/.

midilib is also available as a Gem. The Gem has been uploaded to RubyForge,
and should appear in remote gem listings soon.

Jim
 
J

Jim Menard

Mike,
How does it differ from http://raa.ruby-lang.org/project/smf/ ?

(I guess I'll go find out! :)

Both midilib and smf read and write standard MIDI files. smf supports MML, a
musical notation language. midilib has no such support.

midilib adds a few methods to the Track and Event classes that support
quantizing tracks and events and modifying events' times. I don't see similar
methods in smf, but I could be wrong.

Also, midilib events have an extra time_from_start ivar. Events have delta
times (time from the previous event), but Track has a method that fills in the
time_from_start values for each event. This makes track and event manipulation
easier.

Here's a quick rundown of some of the interesting midilib methods.

MIDI::Track#merge merges an array of events into the track's events.

MIDI::Track#quantize quantizes all of the events in the track.

MIDI::Track#recalc_times recalculates time_from_start for each event.

MIDI::Track#recalc_delta_from_times is the opposite of recalc_times: it
recalculates delta_time for each event from each event's time_from_start.
This is useful, for example, when merging two event lists.

MIDI::Track#sort sorts events by time_from_start (and then recalculates
delta times).

MIDI::Track#quantize quantizes every event.

MIDI::Event#quantize_by quantizes a single event.

MIDI:Event#channel?
MIDI:Event#note?
MIDI:Event#note_on?
MIDI:Event#note_off?
MIDI:Event#meta?
MIDI:Event#system?
MIDI:Event#realtime?

These methods help identify event types when you're walking a list of
events.

Finally, midilib has unit tests.

I welcome bug reports, feedback, comments, and suggestions.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top