8 my ($filename) = @ARGV;
9 my $opus = MIDI::Opus->new({from_file => $filename});
17 channel_after_touch => 2,
18 pitch_wheel_change => 2
24 my @arg = split /\s+/, $_;
26 print "Executing: $cmd @arg\n";
31 $opus->ticks($arg[0]);
35 print "Ticks: ", $opus->ticks(), "\n";
38 elsif($cmd eq 'tricks')
40 print "haha, very funny\n";
42 elsif($cmd eq 'tracks')
44 my $tracks = $opus->tracks_r();
48 my @t = ($tracks->[0]);
52 push @t, $tracks->[$_];
64 for($tracks->[$_]->events())
66 my $p = $chanpos{$_->[0]};
72 ++$notes if $_->[0] eq 'note_on';
73 $name = $_->[2] if $_->[0] eq 'track_name';
75 my $channels = join " ", sort keys %channels;
76 print " $name" if defined $name;
77 print " (channel $channels)" if $channels ne "";
78 print " ($notes notes)" if $notes;
85 $opus->write_to_file($arg[0]);
89 print "Unknown command, allowed commands: ticks, tricks, tracks, save\n";
91 print "Done with: $cmd @arg\n";