I’m a huge fan of using sound in RIAs. I think that having audio cues is just as important as visual cues and that a click sound, or a subtle noise when you interact with an application makes for a much more usable experience. Unfortunately it can be kind of a pain to add those kinds of sounds to Flash applications. In general you have to go hunt down royalty free sounds and use MP3 files in your application which can add a bit more size to an application than some people want. We made some changes to the sound APIs in Flash Player 10 that let you generate sounds and while I was in Singapore I talked to the guys from Sonoflash who have a really great solution.
You can download a series of libraries from them which are all different soundscapes and have different themes. Add one or more of those SWC files to your application and then you can just call the sounds with some simple ActionScript code. All of the sounds are generated by AS3 an so take up a lot less weight than having to deal with MP3s. It also means you can tweak the sounds on the fly and use the APIs to modify the pitch, frequency, or other variables when you call it. I did a video with them in which they show off some examples and how to use it.
Sonoflash; from Ryan Stewart on Vimeo.
This is long, long overdue but the venerable Chuck Freedman has started a site called getMicrophone() for all things related to Flash and the microphone as an input device. This goes really nicely with Chuck’s work at Ribbit and I think it comes at a time when the Microphone is going to become more important to Flash developers. For one, it’s another area that the Flash Player leads Silverlight. Also, as Adobe pushes for more support for gaming as well as tools like Adobe Flash Collaboration Service, the microphone is as important as the mic and the keyboard. Not to mention other things that may be coming down the pipeline.
So if you haven’t seen it, it’s worth checking out. And make sure to bug Chuck to update it some more. Or even better, offer to contribute some tips and tricks!
Update: Andre Michelle wrote some much better code to adjust the pitch of an external sound. I was secretly hoping he would. Check it out at http://blog.andre-michelle.com/2009/pitch-mp3. Thanks Andre!
Here is another sound example that shows how to adjust the pitch of an external sound. This is an extension of the example that can be found in the documentation for the Sound.extract method. Now this example does adjust the pitch but it also speeds the song up as well. This is because you need to skip some samples in order to increase the pitch. Now there are ways to increase the pitch of sounds without speeding them up but I have no idea how to do it. Do you?
Click on the image below to see the example. It uses my throw slider which you can toss back and forth. It may take a minute for the song to load so please be patient. You can download the FLA file if you want to see how it was done.