in reply to Dealing with MIDI

There really is not support for MIDI in Perl that has warranted using Perl instead of a MIDI program. The truth is, if you are into MIDI, you are using tools such as Performer or Cakewalk, both of which are very capable of producing a nice display of the notes from a particular MIDI file.

I have experimented with MIDI, but the results aren't a complete solution:

use MIDI; use Data::Dumper; use strict; my $file = 'chimes.mid'; my $opus = MIDI::Opus->new({from_file=>$file}); # dump the contents of the events $opus->dump({flat=>1}); # example output (minus the header added by me) EVENT dtime channel note velocity ----------------------------------------------------------- text_event 0 (coded at Thu May 31 13:44:10 2001 ) patch_change 0 1 8 note_on 0 1 25 96 note_off 96 1 25 0 note_on 0 1 29 96 note_off 96 1 29 0 note_on 0 1 27 96 note_off 96 1 27 0 # print the notes as png file: 'experimental' according to docs # draw() returns a reference to a GD object my $im = $opus->draw; open(OUT, ">mid.png"); binmode(OUT); print OUT $im->png; close(OUT); # this produces an image like this +------------------------------------+ | | | ------------ | | ------------| |------------ | | | +------------------------------------+
But this is sooooo lousy compared to what a MIDI software package offers (of course, I really shouldn't knock free software either). I think the best use of Perl for MIDI is to create patterns of notes that can be derived from a mathematical sense - like generating scales of notes based from trigonometric functions or other such methods.

I am also anticipating that XML will help revolutionize the ease of displaying MIDI event information.

Jeff

R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--

Replies are listed 'Best First'.
Re: (jeffa) Re: Dealing with MIDI
by Vynce (Friar) on Jun 01, 2001 at 08:04 UTC

    not to toot my own horn, but eventually 4ML will likely be a big help. there are other non-perl open-source MIDI things going on; check sourceforge.