This works okay I guess but it’s platform specific : (
private function playSound(ba:ByteArray):Void
{
context = new AudioContext();
var arrayBuffer:ArrayBuffer = new ArrayBuffer(ba.length);
var bufferView:Uint8Array = new Uint8Array(arrayBuffer);
for(i in 0...ba.length)
{
bufferView[i] = ba.readByte();
}
context.decodeAudioData(arrayBuffer, onDecode);
}
private function onDecode(audioBuffer:AudioBuffer):Void
{
trace("decoded");
var source:AudioBufferSourceNode = context.createBufferSource();
source.buffer = audioBuffer;
source.connect(context.destination);
source.start(0);
}