W3C home > Mailing lists > Public > public-audio@w3.org > April to June 2013

Re: Discrepancy in the definition of calculateNormalizationScale

From: Chris Rogers <crogers@google.com>
Date: Tue, 2 Apr 2013 17:47:51 -0700
Message-ID: <CA+EzO0kn0igdG5NG+iV+hvRQhUHJY21ScoDL=+33ctzqaACmzQ@mail.gmail.com>
To: Ehsan Akhgari <ehsan.akhgari@gmail.com>
Cc: "public-audio@w3.org" <public-audio@w3.org>
On Tue, Apr 2, 2013 at 3:09 PM, Ehsan Akhgari <ehsan.akhgari@gmail.com>wrote:

> The calculateNormalizationScale function in the spec has been copied
> verbatim from the WebKit source code, and the WebKit function has changed
> since then <
> http://trac.webkit.org/browser/trunk/Source/WebCore/platform/audio/Reverb.cpp#L59>.
> If these changes have been intentional, they should be reflected in the
> spec.  Otherwise we should probably file a WebKit bug to revert them.
>

Hi Ehsan, the only differences I can see are that the WebKit code is using
an optimized function vsvesq() and is using "GainCalibration = -58" as a
decibel value (later converted to scalar value) which is essentially
identical to "GainCalibration = 0.00125" in the spec.

I could be missing something, so am happy to change things as necessary...


>
> Also, it seems like that function is specific to an AudioContext with a
> sampling rate of 44100.  If that is the case, the function in the spec
> should be reworded to use AudioContext.sampleRate instead.
>

The code works with an AudioContext of any sample-rate.  The 44100 is a
reference sample-rate, but the actual sample-rate is taken into account.
 What's not really clearly stated in the spec is that the .buffer attribute
must be set to an AudioBuffer of the same sample-rate as the AudioContext.
 That's a quick fix I can do right now...  The good news is that
decodeAudioData() will return an AudioBuffer of this sample-rate, so things
just work out.


>
> Thanks!
> --
> Ehsan
> <http://ehsanakhgari.org/>
>
Received on Wednesday, 3 April 2013 00:48:19 UTC

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