W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: Pitch preservation in AudioBufferSourceNode

From: Chris Rogers <crogers@google.com>
Date: Mon, 3 Dec 2012 13:08:33 -0800
Message-ID: <CA+EzO0k1x5MUt+SHJq3J4PV5_3YkAveoZZPL=5kcRogqYgpUwA@mail.gmail.com>
To: Karl Godard <karl@indiloop.com>
Cc: public-audio@w3.org
On Thu, Nov 29, 2012 at 4:26 PM, Karl Godard <karl@indiloop.com> wrote:

> Hello all,
> I was wondering if there were plans to provide an option to preserve the
> pitch of an audio source when the playbackRate is changed on an
> AudioBufferSourceNode. I know that this happens in the HTMLMediaElement
> class, so I was wondering why it hasn't been implemented in the web audio
> api as well.
> Cheers!
> -Karl

There are a couple of things making me very hesitant to add
pitch-preservation to AudioBufferSourceNode *directly*.  There is no
standard pitch-shifting / time-stretching algorithm, and depending on the
algorithm chosen, the result can be radically different.  Also the nature
of the source material can affect the choice of what general type of
algorithm would be used.  This type of processing is also fairly expensive
and difficult to implement / embed directly in AudioBufferSourceNode given
all the different variations of playback that are possible.

But, the good news is that it's possible to use the building blocks of the
Web Audio API to implement different pitch-shifting / time-stretching
algorithms.  I've seen people implement phase vocoder algorithms directly
in JavaScript.  And I've been playing with some time-domain algorithms
using simple overlap-add approaches, and more recently have been playing
with some code to estimate pitch for PSOLA (Pitch Synchronous Overlap and
Add).  It's not fully baked yet, but I can put up an example once I've
cleaned it up a bit.

Received on Monday, 3 December 2012 21:09:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:14 UTC