Re: MIDI::Score
[email protected] (Dave Turner) Sun, 25 May 2003 16:07:01 +0000
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <a05100302baf6986fb65c@[81.174.192.125]> |
>At 20:44 -0800 2003/05/24, Sean M. Burke wrote:
>>Thanks Sean, but remember, Monkey See Monkey Do.
>>Leave 4 lines of code out of your POD and it gives Perl newbies
>>like me a real headache!
>
>Huhwhat? Four lines what where?
>
look at MIDI::Score.
>So, given this event structure:
>
> ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'],
> ['text_event', 0, 'Lord through this hour/ be Thou our guide'],
> ['text_event', 0, 'so, by Thy power/ no foot shall slide'],
> ['patch_change', 0, 1, 8],
> ['note_on', 0, 1, 25, 96],
> ['note_off', 96, 0, 1, 0],
cut some notes for brevity
> ['note_on', 0, 1, 25, 96],
> ['note_off', 192, 0, 1, 0],
>
>here is the corresponding score sctructure:
>
> ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'],
> ['text_event', 0, 'Lord through this hour/ be Thou our guide'],
> ['text_event', 0, 'so, by Thy power/ no foot shall slide'],
> ['patch_change', 0, 1, 8],
> ['note', 0, 96, 1, 25, 96],
> ['note', 96, 96, 1, 29, 96],
> ['note', 192, 96, 1, 27, 96],
> ['note', 288, 192, 1, 20, 96],
> ['note', 480, 96, 1, 25, 96],
but you don't tell us HOW to do it!
Based on your reply to my request for help the crucial missing 4
lines are the these:-
my $opus = MIDI::Opus->new({ 'from_file' => $IN_FILE });
my $event_r = $opus->tracks_r->[0]->events_r;
my $score_r = MIDI::Score::events_r_to_score_r($event_r);
dump_score( $score_r);
DaveT