Playing MP3 data using the Flash sound “hack”

A recurrent question that I see after writing the article “How to make actionscript 3 play generated pcm wave data” is how would one do this with MP3 data.

I spent a while hacking around to see if it could be done, and came up with this.

Not much time to write anything about this, but I thought that I should just post up the code. It requires an mp3 called “sample.mp3″ in the “media” folder in order to work. There should be a certain amount of resilience to errors in the MPEG stream.

We’re not opening up comments at the moment, so please post back to the original pcm wave data article if you have any comments.

3 Responses to “Playing MP3 data using the Flash sound “hack””

  1. FlexibleFactory » Blog Archive » How to load MP3 files from a FileReference Says:

    [...] When “making-some-noise” wasn’t quite so easy, I invested a bit of time messing around with MP3 data to see if my Flash sound hack for playing PCM audio data could be subverted to use MP3 data instead. While I got this partially working, I realised that it was a library without any application. What use was it? I tried to use it for shoutcast streams, but it is not possible to seamlessly stitch together arbitrarily small frames of MP3 data and fire them with a “silent sound”. Unfortunately the ramp-up time of the mp3 decoder means that the signal audibly drops out at the stitch points. [...]

  2. mitesh dave Says:

    i get error end of file…when i load a mp3 file which was WAV and was converted to mp3 any suggestions

  3. mitesh dave Says:

    your library is great but when i load MP3 which was a wav file,the frequency index is set to 0 ,which is different then other MP3’s ,i am trying to find a solution for this….but if you get solution before me please help

Leave a Reply