BPM calculator (beats perminute)
Calculate the the BPM when tapping on e.g. a label of the form
Is it possible to convert following javascript code to basci4ppc
Hints are welcome
grCor
function TapForBPM(e)
{
document.BEATSPERMINUTE.WAIT.blur();
timeSeconds = new Date;
secs = timeSeconds.getTime();
if ((secs - secsPrevious) > 1000 * document.BEATSPERMINUTE.WAIT.value)
{
count = 0;
}
if (count == 0)
{
document.BEATSPERMINUTE.AVG.value = "";
document.BEATSPERMINUTE.TAP.value = "First Beat";
secsFirst = secs;
count = 1;
}
else
{
bpmAvg = 60000 * count / (secs - secsFirst);
document.BEATSPERMINUTE.AVG.value = (Math.round(bpmAvg * 100)) / 100;
count++;
document.BEATSPERMINUTE.TAP.value = count;
}
secsPrevious = secs;
return true;
}
Calculate the the BPM when tapping on e.g. a label of the form
Is it possible to convert following javascript code to basci4ppc
Hints are welcome
grCor
function TapForBPM(e)
{
document.BEATSPERMINUTE.WAIT.blur();
timeSeconds = new Date;
secs = timeSeconds.getTime();
if ((secs - secsPrevious) > 1000 * document.BEATSPERMINUTE.WAIT.value)
{
count = 0;
}
if (count == 0)
{
document.BEATSPERMINUTE.AVG.value = "";
document.BEATSPERMINUTE.TAP.value = "First Beat";
secsFirst = secs;
count = 1;
}
else
{
bpmAvg = 60000 * count / (secs - secsFirst);
document.BEATSPERMINUTE.AVG.value = (Math.round(bpmAvg * 100)) / 100;
count++;
document.BEATSPERMINUTE.TAP.value = count;
}
secsPrevious = secs;
return true;
}