如何将我的文件转换为TypedArray?

时间:2013-03-10 18:44:43

标签: javascript audio html5-audio codec

高,

我正在编写这个编解码器,我创建了一个Unt8Array对象,它将TypedArray作为参数。如何将我的音频文件转换为TypedArray,以便我可以将其加载到Uint8Array并继续生活?这是我的JsFiddle,这是一段代码摘录:

   var buf = new Uint8Array(128); // this wants a typedArray or unsigned long
            if (buf.byteLength == 128) {
                alert("Yes, we have a 128 byte buffer");
            } else {
                alert("Nope, it's not 128 bytes");
            }
            var bitstream = new BitStream(buf);
            bitstream.writeBits(12, 0xfff);
            bitstream.seekTo(0);
            var bs = bitstream.readBits(6);
            bitstream.readBits(10);
            console.log("did some stuff with bitstream...");
            // let's call some amr functions...
            //var dcoded = jigg.decode(bs);//decode() takes a "bitstream" as argument

谢谢,

学家井

0 个答案:

没有答案