Hi there,
I'm actually taking some personnal time to work on a little project that
unit two of my main occupations :
Flex developpement and Mashup producing.
In this AIR application I'll need a TAP Button.
A TAP Button is a button that is clicking on rhytm to help find the BPM
(Beats Per Minutes) of a song.
The function seems simple :
private function setTappedBPM( e : MouseEvent ) : void
{
var timer : Number = getTimer();
if( _nLastTimerForTappedBtn == 0 )
{
_nLastTimerForTappedBtn = timer;
}
else
{
var ms : uint = timer - _nLastTimerForTappedBtn;
var tappedBPM : uint = 6000000 / ms;
_nTappedBPM = tappedBPM / 100;
_nLastTimerForTappedBtn = timer;
mainUI.bpmChoose.btnTap.label = "Tap (" + _nTappedBPM + ")";
}
}
Hi just keep the timer (from getTime) of the last click and then calculate
the gap between the new and the old, it give me the number of ms between two
click.
I just have to make some basic math to have the BPM.
But, by testing I see that the precision is very bad. I try to test it one
very regular song and by clicking as regular as I can but the tempo
calculated is very floating (about 10 BPM of gap)...
I have make a mistake or it is just a flash player limitation ?
--
BenoƮt Milgram / Flapflap
http://www.kilooctet.net
I'm also a music mashup / bootlegs producer :
http://www.djgaston.net