W3C home > Mailing lists > Public > public-xg-audio@w3.org > February 2011

Large AudioBuffers in Web Audio API

From: Ryan Berdeen <ryan@ryanberdeen.com>
Date: Sun, 27 Feb 2011 19:25:39 -0500
Message-ID: <AANLkTi=JfEKruWYgS3372Rfz6_PtRWN4D2iWGR5K+FaL@mail.gmail.com>
To: public-xg-audio@w3.org
Using the Web Audio API, how should I access the data of an audio file
longer than a minute?

>From the current specification on AudioBuffers at
http://chromium.googlecode.com/svn/trunk/samples/audio/specification/specification.html#AudioBuffer-section:

> Typically, it would be expected that the length of the PCM data would be
> fairly short (usually somewhat less than a minute). For longer sounds,
> such as music soundtracks, streaming should be used with the audio
> element and MediaElementAudioSourceNode.

I can use AudioBuffers in conjunction with JavaScriptAudioNodes to
manipulate the audio data, but I don't see a way to do this with a
MediaElementAudioSourceNode. Let's say I wish to play an MP3 file of a
typical 3 minute long song backwards. How should I accomplish this?
The API discourages me from loading the song into an AudioBuffer due
to it's length, but this seems to be the only way to directly access
and manipulate the audio data.

For comparison, with Flash and ActionScript 3, I can load an MP3 as a
Sound object and use the "extract" method to get a subset of the audio
data: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html#extract()

- Ryan
Received on Monday, 28 February 2011 15:52:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:38:00 UTC