Flash timing code is fail
Yesterday's test was a great success -- in that the test discovered a huge flaw in the program. Or rather, it found a huge flaw in the platform: the Timer object in Flash is horribly inaccurate.
I'm not a complete idiot -- I did some initial tests with flash before spending ten hours writing that public test. Specifically, I ensured that the clap-detection functionality was accurate enough. It wasn't perfect (my physical metronome varied by 5 ms... although to be fair to flash, it's possible that the metronome itself was varying), but it was good enough.
However, I didn't test that flash could make a light blink to within 5 ms. In retrospect, I should have. But it never occurred to me that it would be a problem.
(and yes, it took almost all my willpower to avoid using "flash" as a verb in the previous paragraph)
You can test it for yourself on your own computer: Metronome test
On my system, a modest dual-2.0 Ghz macbook running OSX 10.4.11, half the time I get a maximum delay of about 40ms, and half the time it spikes up to over 200ms. That's totally unacceptable for a metronome -- especially when I'm going to be grading students on their clapping ability. The whole point of this program, and my Master's thesis in general, is that computers can provide objective, accurate, and above all, trust-worth grading. If students can't trust that the computer grades are accurate (at least to 5%), the program will be a pathetic toy rather than an educational aid. And we have more than enough pathetic toys masquerading as educational tools (or "edutainment").
Note that the above test is only timing the Timer class. I'm not doing anything else here -- adding other stuff (like listening to claps + key presses, drawing flashing lights, etc) can only make it worse.
Yeah, that's quite a bit of duct tape, even for me. But what's the alternative? Abandon 90% of potential MEAWS users by ignoring Windows? Spending a week setting up a development environment on windows so that I can compile it? Neither of those options are particularly appealing. :(