If you haven't played with sfxr before, you're definitely missing out! It's a sound effect generation app that's great for making classic game style sounds and spitting them out as .wav files. And I ported it to AS3, you know, for fun
I spotted that someone posted
about my project as3sfxr (ah Google vanity searches, how I love thee)
I also saw the update saying that their experience when using it in an actual game was pretty bad. I actually hadn't done much benchmarking in a real game context, but I did so after reading that post, and oh boy, turns out they were right! My bad...
So, after a hectic week at Flash On The Beach, I picked up the project again and had a go at making it a lot faster and more usable.
Now, there are two ways to play a sound. You can either choose to generate the sound as it plays, or to cache the sound and play it later. The first is of course quick for creation, but slower when actually playing (not that slow though, just slower than the caching option). Caching synthesizes the full sound in one go, then stores the ByteArray to read out of when you play. You should probably cache your sounds during loading, transitions or other non-action times.
The playMutated() method is available for both types of playing too. It slightly modifies the sound, but keeps the original settings so you never stray too far. No more repetitive sound effects!
Take a look at the google code project for really simple examples and the source:http://code.google.com/p/as3sfxr/
Check out the app here. You can copy and paste setting straight out to your code, which is a lot easier than trying to find a good sound by hand:http://www.superflashbros.net/as3sfxr/
I'd love to hear from anyone who tries out the code, I just finished it about an hour ago so it's not super tested. Enjoy!