The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use MIDI::Simple;
use MIDI::Simple::Drummer;

%MIDI::Simple::Length = ();
my $last = 'w';
for(qw(w h q e s t f)) {
    my $n = $_ . 'n';
    $MIDI::Simple::Length{$n} = $_ eq $last ? 4 : $MIDI::Simple::Length{$last . 'n'} / 2;
    $MIDI::Simple::Length{'d'.$n} = $MIDI::Simple::Length{$n} + $MIDI::Simple::Length{$n} / 2;
    $MIDI::Simple::Length{'dd'.$n} = $MIDI::Simple::Length{'d'.$n} + $MIDI::Simple::Length{$n} / 4;
    $MIDI::Simple::Length{'t'.$n} = $MIDI::Simple::Length{$n} / 3 * 2;
    $last = $_;
}

print map { "$_ => $MIDI::Simple::Length{$_}\n" }
    sort { $MIDI::Simple::Length{$b} <=> $MIDI::Simple::Length{$a} }
        keys %MIDI::Simple::Length;

print Data::Dumper->new([MIDI::Simple::Drummer::_durations])->Indent(1)->Terse(1)->Sortkeys(1)->Dump;