Here is a superior way to populate %Lengths. It also adds thirty-second
(tn) and sixty-fourth (fn) notes:
119,135c119,142
< # This list should be rather uncontroversial.
< # The numbers here are multiples of a quarter note's length
< # The abbreviations are:
< # qn for "quarter note",
< # dqn for "dotted quarter note",
< # ddqn for "double-dotten quarter note",
< # tqn for "triplet quarter note"
< %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 = $_;
< }
---
Show quoted text> %Length = ( # this list should be rather uncontroversial.
> # The numbers here are multiples of a quarter note's length
> # The abbreviations are:
> # qn for "quarter note",
> # dqn for "dotted quarter note",
> # ddqn for "double-dotten quarter note",
> # tqn for "triplet quarter note"
> 'wn' => 4, 'dwn' => 6, 'ddwn' => 7, 'twn' => (8/3),
> 'hn' => 2, 'dhn' => 3, 'ddhn' => 3.5, 'thn' => (4/3),
> 'qn' => 1, 'dqn' => 1.5, 'ddqn' => 1.75, 'tqn' => (2/3),
> 'en' => .5, 'den' => .75, 'dden' => .75, 'ten' => (1/3),
> 'sn' => .25, 'dsn' => .375, 'ddsn' => .4375, 'tsn' => (1/6),
> # Yes, these fractions could lead to round-off errors, I suppose.
> # But note that 96 * all of these == a WHOLE NUMBER!!!!!
>
> # Dangit, tsn for "thirty-second note" clashes with pre-existing tsn for
> # "triplet sixteenth note"
> #For 32nd notes, tha values'd be:
> # .125 .1875 .21875 (1/12)
> #But hell, just access 'em as:
> # d12 d18 d21 d8
> #(assuming Tempo = 96)
>
> );
I have included my tester program that I used to work this out, with the
diff loop in isolation. I have tested this patch successfully but see
that there are no dist tests for this.
Thanks again,
Gene Boggs,
Software Engineer-at-large