Copy link to clipboard
Copied
You can't import AAC audio into Flash Professional CS6, but you can play it using a NetStream. I got that to work, but now I'm trying to embed the AAC file instead of having it as an external file. Does anyone know how I would do that? Thanks. Here is my code to play the external AAC with NetStream.
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.play("myAudio.aac");
Copy link to clipboard
Copied
It's a little silly, but no. About the only workaround I've seen is convert it to a video file (with only an audio track) and [Embed] that.
Any reason you really want to embed audio?
Are you using AIR? There's some even sillier workarounds (StageWebViews/ANEs playing via a browser, controlled via JavaScript).
Copy link to clipboard
Copied
This is for a browser game I'm working on that will have a lot of voiced dialogue. I was drawn to the AAC format because the quality is still really good even at low bitrates. I realize that embedding the audio will increase the filesize and the user's initial download time, but it ensures all my audio will play exactly when I want it to. I could upload the external AAC audio to my website and stream it, but if the user's internet connection is spotty, the audio will be delayed or choppy, right? Same thing if I post the game to Newgrounds or one of the other Flash portal sites and it gets tons of hits and my server gets hammered. Maybe I could host the audio files at Google Sites or something and stream them from there? Or is there a way to make the streaming audio download and buffer slightly ahead of time before it's needed?
I found this post about how to embed a NetStream video, so I may try the workaround you suggested:
http://stackoverflow.com/questions/10579142/how-to-embed-flv-in-flash-and-play-it-with-as3
Copy link to clipboard
Copied
That embedded FLV may not have FLV (I believe that old embeddable FLV format uses mp3). F4V can use AAC but it's not a format you can embed in a library.
Consider this.. your game really just needs a preloader. It's no different at all if you download one huge SWF containing AAC or 30 AAC files one by one separately (or as you need them, preload them). If anything, one huge SWF is a bad way to go. Just show the user a preload bar as they're very used to seeing during playing a game and keep it all external. You'll have AAC, only preload what you need and keep it all external for easy editing.
Copy link to clipboard
Copied
Thanks for your input. I haven't decided yet if I'm going to embed everything or not, depending on how many MB of audio I end up with. I will probably at least embed the audio at the very beginning.
For anyone else who's trying to do the same thing, I created my AAC audio using Nero's free NeroAACEnc. Then I used ffmpeg, which is also free, to create an FLV movie with only that as an audio track. And then I embedded the movie and played it like in the post I linked above.
neroaacenc -q 0.25 -he -if myAudio.wav -of myAudio.aac
ffmpeg -i myAudio.aac -vn -acodec copy myMovie.flv
Copy link to clipboard
Copied
It doesn't "fully" support AAC, just beware of that.
http://en.wikipedia.org/wiki/Flash_Video
Use of the H.264 and AAC compression formats in the FLV file format has some limitations and authors of Flash Player strongly encourage everyone to embrace the new standard F4V file format.
Copy link to clipboard
Copied
Thanks for the heads up. My FLV with AAC audio seems to play fine though. I tried converting my AAC to F4V instead, which ffmpeg can do, but apparently NetStream.appendBytes only supports FLV so the F4V wouldn't play. And just for the sake of comparison, an MP3 of similar quality has about twice the file size, so I still think going through all this is worth it.
Copy link to clipboard
Copied
Glad you found the solution that works best for you!
Last thing I'd recommend is probably what you're already doing, which is isolating embedded audio into separate files so you only need to load sounds for what you're doing, rather than all audio in the same file. At least you get some external load-as-needed speed but can still package/linkage easily.
Good luck!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now