+ for my $testtranspose(-127..127)
+ {
+ my $toohigh = 0;
+ my $toolow = 0;
+ my $good = 0;
+ for my $channel(sort keys %notes_seen)
+ {
+ for my $note(sort keys %{$notes_seen{$channel}})
+ {
+ my $cnt = $notes_seen{$channel}{$note};
+ my $votehigh = 0;
+ my $votelow = 0;
+ my $votegood = 0;
+ for(@busybots_allocated)
+ {
+ next # I won't play on this channel
+ if defined $_->{channels} and not $_->{channels}->{$channel};
+# next # I won't play this program
+# if defined $bot->{programs} and not $bot->{programs}->{$program};
+ my $transposed = $note - ($_->{transpose} || 0) - $testtranspose;
+ if(exists $_->{notes_on}{$transposed})
+ {
+ ++$votegood;
+ }
+ else
+ {
+ ++$votehigh if $transposed >= 0;
+ ++$votelow if $transposed < 0;
+ }
+ }
+ if($votegood)
+ {
+ $good += $cnt;
+ }
+ elsif($votelow >= $votehigh)
+ {
+ $toolow += $cnt;
+ }
+ else
+ {
+ $toohigh += $cnt;
+ }
+ }
+ }
+ next if !$toohigh != !$toolow;
+ print STDERR " Transpose $testtranspose: $toohigh too high, $toolow too low, $good good\n";
+ }
+