summaryrefslogtreecommitdiff
path: root/midicsv-1.1/count_events.pl
blob: 377dcd4679289be1ef20b815a0ae47f1dfb631dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
    }