Hey Squarenote,
First up thanks for exploring this stuff, i too, would love to know the sound capabilities and have a stencyl expert speak on this and have more sound features added in future.
Using your beat timer code i've been able to get my actor to move on beat quite well and it will stay in sync for electronic-produced music for well over 3 minutes.
I think the problem with it slowly getting out of sync is related to at least of couple of things:
1) the BPM calculation, in that its never 100% perfect no matter what you're using to calculate it. So every measure will slowly push the event out of sync. e.g. the 'true' BPM of Song X is 120.25 BPM but its calculated at 125.00 BPM so it's off by 0.25 every measure and the longer it plays the more the offset becomes audible/visible. Some sort of periodic re-syncing code should fix this well enough to keep the illusion of things syncing perfectly.
2) Also the type of music you're using, Stuff that's not made by a computer, band-music, live music etc will never be able to be synced perfect as the song has an ever changing tempo/bpm. Humans never play exactly on beat.
For seamlessly looping mp3s it can definitely be done - I see Stencyl uses Flixel (import org.flixel.*

I'm not sure how the "stencyl.api.engine.sound." was created and maybe im barking up the wrong tree but on the Flixel forums people have managed to update the FlxSound Class with seamless looping:
http://www.piposplayhouse.com/FlxSound.asThere's also some 3rd party classes that allow for dynamic pitch shifting here:
http://forums.flixel.org/index.php?topic=2540.0 I've also found some amazing real-time DSP stuff thats written in AS3 - (
http://www.anttikupila.com/flash/soundfx-out-of-the-box-audio-filters-with-actionscript-3/)
All this suggesting that sound in Flash is not as crappy as it's made out to be.
But implementing this stuff in Stencyl is way above my level, The source is there in AS3 i would really love a Stencly pro to speak on whether we can import this as an .swc or just create custom blocks that would allow for these features?