Embedding wav files in AS3 Flash/Flex project?

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?

-------------Problems Reply------------

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


The Flash player doesn't know how to directly play wav files. It's true that you can import them to the authoring tool, but when you publish the SWF your audio will be converted to mp3 or adpcm or whatever you select in your publish settings. Even if you read in a wav at runtime, the only way to play it is by parsing the binary stream, so naturally the same limitation applies if you embed the file.

Some related info at this question. Which curiously you seem to have commented on last year! :)

Category:flash Views:0 Time:2010-05-13

Related post

  • How to keep embedded ".wav" files small in PowerPoint 2010? 2012-10-02

    Original title: HOW TO KEEP EMBEDDED .WAV FILES SMALL IN POWER POINT 2010 I have rec'd many power point files by email (.pps) and they all contain music and pictures and the file sizes are somewhere between 2000kb to 6000kbs. Yet when I make a presen

  • recommendation for html parser library in as3 for flex project 2009-11-08

    Can somebody recommend a simple html parsing library, written in as3 for a flex project? Thanks, Nava --------------Solutions------------- Best one and specified for HTML and CSS is Cross-browser compliant HTML/CSS rendering engine written in ActionS

  • Playing embedded wav files using SoundPlayer 2009-11-30

    I have a Compact Framework 3.5 application that is responsible for scanning barcodes. There are 3 different sounds it should play depending on the situation, so I created a wrapper class around the SoundPlayer object and call the Play method on that.

  • How do I upsample a wav file using AS3? 2009-12-16

    I am trying to upsample an 8000hz, 16-bit wav file to 11025hz in AS3. At this point, I am not concerned about applying the low-pass filters that I know I will eventually need. I've been referencing this wiki page. Here is what I've done so far: Calcu

  • Put the data from a .wav file into the flash memory of pic18F4550 2011-05-26

    I'm new at hardware programming: I work with the pic18F4550 with the C compiler from microchip version 8.63. My question is: has someone example code to write a .wav file (binary data) to the flash memory of the pic18F4550? --------------Solutions---

  • Playing a swf file within a Flash Catalyst project 2013-12-06

    I've added videos to Catalyst projects sucessfully, but my current project requires that a swf file (created in Flash CS5) play when the Catalyst projcect starts, then on click go to another state. The swf within plays when I run the project, but not

  • Embedding bold font in AS3 Flash dynamic field 2009-07-01

    I have already googled and read a lot of different topics relating to this problem, but still cant solve mine. I have this dynamic text field in a movieclip, and I embeded upper case, lower case and numbers. I exported that movieclip, then used it in

  • Writing to a file in as3 flash develop 2010-02-20

    Ive been doing some research and I cant seem to find anything on writing to a file. My initial question was writing a array to a seperate file. But now I am looking for resources on how to write any data such as XML or a array to a file. What I want

  • Enums in AS3 / Flash / Flex? 2008-12-01

    One thing I really like about AS3 over AS2 is how much more compile-time type-checking it adds. However, it seems to be somewhat lacking in that there is no type-checked enumeration structure available. What's a good (best / accepted) way to do custo

  • Can the flash player play .wav files from a url? 2009-03-20

    Let's say I have a wav file at a url: http://hostname.com/mysound.wav I'm trying to load the wav file with the sound class like: var url:String = "http://hostname.com/test.wav"; var urlRequest:URLRequest = new URLRequest(url); var sound:Sound = new S

  • Can I cross compile my AS3 code or Flex project to native C++? 2011-10-07

    I would like to tak emy existing AS3 or Flex project and compile it to run on native C++ code. Is there a way to do this? What sort of solutions exist? I do not want to change my AS3 code. --------------Solutions------------- No, because of absense o

  • Converting flash project to flex project 2011-11-15

    I want to convert a flash file (*.swf) to a flex project so that I can able to run it on iOS devices. Any suggestions how to run a *.swf file on Iphone/ipad/ipod? --------------Solutions------------- Flash Professional can package mobile applications

  • How to run an EXE file from Flash/Flex/AIR? 2010-10-29

    I want to run an .exe file from my Flash/Flex/AIR Application, How is it possible? What I need is to build an Interface to open a xls file and convert it into swf, I have the converter file which is an exe file, when I run convert.exe infile.xls outF

  • AS3/Flash performance with large bitmaps 2011-04-20

    i have a AS3/FL10 based application that renders/animates/filters (blur) large PNGs (1 per view) (about 1100x900 px, roughly 2mb). Due to the fact that the fans start spinning like crazy on my notebook, i wonder if this is considered "bad practise".

  • The wrong wav files are playing for some slides, even though the correct file is showing up in the animation pane. 2014-01-06

    I'm embedding wav files in PowerPoint 2010 slides, and the correct file is showing up in the animation pane, but for some slides the wrong wav file plays--and in some instances, it's a file that isn't embedded anywhere in the presentation--it's store

  • Importing a .wav file in c# and extracting the signal an array of doubles 2011-10-26

    I'm doing a project on audio signal processing and I need to import a wav file in c# and extract an array of doubles or floats that contains the signal data. Most of the tutorials for audio libraries I've found don't seem to do stuff this low-level.

  • Need to understand WAR descriptor and structure - Flex project within WAR 2012-01-14

    I am trying to understand why I am not able to launch a SWF from the URL after launching mvm jetty:run on my project. The project has built successfully and produced a Falcon-WAR-0.0.1-SNAPSHOT.war in the maven target directory. In this file are the

  • Error Message C00D11B1 when trying to play .wav file 2013-02-17

    I am unable to play a Wav file in Windows 7 but the file plays on a computer using XP. I put together a Powerpoint with embedded wav files on a XP computer using Office 2003 a few months ago and then got a new computer. The PP in Office 7 will not pl

  • Problem playing .wav file through MCI on Windows 7 2013-10-18

    I have a PowerPoint 2007 presentation with an embedded .wav file. The sound plays fine on other XP systems, and even on my laptop which has Windows 7 Professional and PP 2007 on it, but it won't play on my new PC which has Windows 7 Home Premium (Del

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.172 (s). 11 q(s)