set_tempo and beats per minute
[email protected] ("Sean M. Burke") Wed, 02 May 2001 15:20:50 -0600
| Newsgroups | perl.midi |
|---|---|
| Message-ID | <[email protected]> |
Someone recently wrote to me pointing out that set_tempo didn't work as
they expected: they expected a larger number to mean a faster tempo.
So here's something you all might find more intuitive:
sub bpm { set_tempo(60_000_000 / $_[0]) }
# turns beats-per-minute into microseconds-per-qn
That seems to work right: bpm(120) makes a set_tempo(500_000) because each
quarter note lasts 500,000 microseconds, i.e., 120 per minute. Or should
this routine be called "qpm", in case beats aren't quarternotes?
(Here in New Mexico, it's the effectively the same, but only because 99% of
local music is in 4/4 time -- imagine oompa music as performed by
mariachis. Forever. Once in a while, there's a ballad that struggles
toward 3/4 time, and sometimes makes it there in one piece.)
--
Sean M. Burke [email protected] http://www.spinn.net/~sburke/