web-audio-api icon indicating copy to clipboard operation
web-audio-api copied to clipboard

decodeAudioData support for more formats

Open sebpiq opened this issue 12 years ago • 2 comments
trafficstars

Using aurora it should be possible to support mp3 and aac : https://github.com/audiocogs

sebpiq avatar Aug 16 '13 20:08 sebpiq

FYI, I just added a few methods that should make this use case much easier for you to implement.

First, I added a more robust version of your BufferSource, and some methods on AV.Asset and AV.Player to easily create instances of those classes fromBuffer. The buffer source can also accept buffer lists if you have a sequence of buffers to decode.

Second, I added a decodeToBuffer method to AV.Asset which allows easily decoding an entire file into a single Float32Array. You'll still need to deinterleave unfortunately, but it should make this much easier. As a subscript to that, the data events and that new method now do the proper conversions so that the data is always returned in floating point format rather than the raw data from the decoder (this was previously done in the player only).

I've updated the documentation as well, both for these new methods and some others added earlier. Just thought I'd let you know, since you have been asking questions and I'm excited to see this project come to fruition! :)

devongovett avatar Sep 03 '13 04:09 devongovett

@devongovett amazing!!! Thanks a lot for this :) it will help me a lot indeed! I'll refactor to use those new features immediately.

sebpiq avatar Sep 03 '13 09:09 sebpiq