The Flash IDE is capable of embedding many types of uncompressed sound files, including wav, and offers optional compression when publishing.
However, the [Embed] tag, only seems to allow embedding of mp3 files. Is it truly impossible to embed an uncompressed wav file, or am I missing some magic, undocumented mimeType?
I was hoping for something like:
[Embed source="../../audio/wibble.wav" mimeType="audio/wav"]
...but I get
no transcoder registered for mimeType 'audio/wav'
It's possible to embed wav or other format as an octet-stream and parse at runtime, but that's pretty heavy handed I think.
I'm surprised that even though the Flash IDE can embed uncompressed sound data, [Embed] cannot, given that the swf spec can contain uncompressed sound data.
Any takers?
From the LiveDocs - Basics of working with sound:
[...] Although there are various sound file formats used to encode digital audio, ActionScript 3.0, Flash Player and AIR support sound files that are stored in the mp3 format. They cannot directly load or play sound files in other formats like WAV or AIFF. [...]
But apparently there's a workaround. Check post #3 in this thread from actionscript.org:
Replying to myself in case anyone has the same question in the future and is searching for an answer.
I couldn't find any direct support for embedding WAV files in a Flex Builder 3 / ActionScript 3 application. What I did try and was delighted to see it works is to create a Flash Movie in Flash CS 3 (you will need to own that or get an evaluation) and import your sounds to the library and link them to be exported by ActionScript. Export the Flash CS3 project to a SWF movie and save it in your project (I added it to a "lib folder").
Your ActionScript code to create and play the sound should be:
[Embed(source="lib/Sounds.swf", symbol="BigShipSound")] private static var BigShipSound: Class; ... var bigShipSound : Sound = BigShipSound as Sound; bigShipSound.play(0, 20);
There's a library you can use
http://code.google.com/p/as3wavsound/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With