#!/usr/bin/perl

use MIDI;

my $filepath = shift || die "No filename!\n";
my $trackno = shift || 0;

$opus = MIDI::Opus->new({"from_file" => $filepath, "no_parse" => });
@tracks = $opus->tracks;

&parse_track($tracks[$trackno]);

exit;

sub parse_track
{
	$track = shift || die "Args to parse_track!\n";
	
	@events = $track->events;

	$score_r = MIDI::Score::events_r_to_score_r(\@events);
	foreach $a (@$score_r)
	{
		foreach $b (@$a)
		{
			print "$b ";
		}
		print "\n";
	}
}	

