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--

In reply to (jeffa) Re: Dealing with MIDI by jeffa
in thread Dealing with MIDI by asiufy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.