From 760d4d5a0fc89e5b14681879577a80e79795e4a3 Mon Sep 17 00:00:00 2001 From: pepper Date: Mon, 19 Jan 2015 00:02:46 -0800 Subject: first --- midicsv-1.1/count_events.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 midicsv-1.1/count_events.pl (limited to 'midicsv-1.1/count_events.pl') diff --git a/midicsv-1.1/count_events.pl b/midicsv-1.1/count_events.pl new file mode 100644 index 0000000..377dcd4 --- /dev/null +++ b/midicsv-1.1/count_events.pl @@ -0,0 +1,18 @@ + + # Count number of events by type in CSV MIDI file + # and report. + + while ($a = <>) { + + if (!($a =~ m/\s*[\#\;]/)) { # Ignore comment lines + if ($a =~ m/\d+\s*,\s*\d+\s*,\s*(\w+)/) { + $events{$1}++; + } else { + print("Cannot parse: $a"); + } + } + } + + foreach $k (sort(keys(%events))) { + printf("%9d %s\n", $events{$k}, $k); + } -- cgit v1.2.3-70-g09d2