2 people found this helpful
I have seen mp3 encoders written in actionscript. Googling "Actionscript MP3 Encoder" turns up one as the first result. So it is possible. There isn't one that is part of the Adobe Actionscript APIs however.
Hmm according to me, the code I posted is not correct. Ideally the code should mix the 2 audio files in one job, right now it's mixing on every SampleDataEvent .
I'm looking for something like:
var ba:ByteArray = new ByteArray();
ba.endian = Endian.LITTLE_ENDIAN;
sound.extract( ba, 44100 * 2 );
var ba1:ByteArray = new ByteArray();
ba1.endian = Endian.LITTLE_ENDIAN;
sound.extract( ba1, 44100 * 2 );
// mix ba and ba1 together...
shaderJob = new ShaderJob(shader, ba,width, height);
// capture bytearray result of the entire mix
// send to server
I read your question as specifically asking about MP3 encoding, not about the processing itself.
It is pretty simple to append the results of each SampleDataEvent to a separate ByteArray. When you are done processing the input, this new ByteArray will have the entire audio file.
The ShaderJob would work, if you had the entire MP3 file decoded into a byte array of audio samples before you passed it to the shaderJob.