https://help.adobe.com/en_US/air/reference/html/flash/media/Sound.html
Sound.loadPCMFromByteArray(bytes:ByteArray, samples:uint, format:String = "float", stereo:Boolean = true, sampleRate:Number = 44100.0):void
Don't know what "sound" library you are using but those mp3 assets are just a ByteArray
.
So you can load that ByteArray
from disk and into your Sound driver eg Sound
or whatever is in your implementation.
EDIT : Actually, since I don't use Sound class I have no idea if they are asking for RAW PCM data without the header or it parses the header and uses the RAW data from the ByteArray. You should get the idea of what you need to do though. Guessing from the arguments after bytes
, guessing it's RAW PCM without the header. The header defines sample rate, bitdepth, channels format etc.
EDIT2: 🙂 Rereading everything again, I can't really help, I will leave my stream on consciousness though. The fact is, PCM is uncompressed audio data and mp3 is compressed audio data, so I doubt loadPCMFromByteArray()
will do anything with an mp3.
The bottom line is you HAVE the bytes from the unzipped assets archive. So you just need to take those bytes from disk and load them in some type of mp3 player that can take in bytes. Maybe even Sound will use a local file URL so it can do the decoding. I have never used the Sound class, so it's just a guess. All my audio stuff has been native.