MIDI-Perl

 view release on metacpan or  search on metacpan

lib/MIDI/Simple.pm  view on Meta::CPAN

If you see a "[quarter note symbol] = 160" in a piece of sheet music,
and you want to figure out what number you need for the C<set_tempo>,
do:

  60_000_000 / 160  ... and you get:  375_000

Therefore, you should call:

  set_tempo 375_000;

So in other words, this general formula:

  set_tempo int(60_000_000 / $quarter_notes_per_minute);

should do you fine.

As to the Tempo/Duration parameter, leave it alone and just assume
that 96 ticks-per-quarter-note is a universal constant, and you'll be
happy.

(You may wonder: Why 96?  As far as I've worked out, all permutations



( run in 0.289 second using v1.01-cache-2.11-cpan-26ccb49234f )