W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2013

AnalyzerNode - magnitude/phase

From: Chris Lowis <chris.lowis@gmail.com>
Date: Fri, 27 Sep 2013 10:22:52 +0100
Message-ID: <CAMy=AAKRpZ6A0xi4nWn0DH+giwsfOh=vTYQmMm1m7=mt+7YgyQ@mail.gmail.com>
To: public-audio@w3.org
Hi,

I recently demoed and talked about the Web Audio API at an event for
audio engineers and academics. A few of them had played with the API.
One thing that came up a couple of times was that the AnalyzerNode
only provides an accessor the magnitude of the frequency spectrum. The
use cases they were suggestion went beyond visualisation of data
(ambisonics and beat detection were mentioned), and I think this would
be a really useful change.

It is currently under-specified exactly what getFloatFrequencyData
should do, but I think the Webkit implementation returns an array of
floating point values corresponding to the magnitude of the calculated
spectrum.

There's a few options perhaps:

i) Allow getFloatFrequencyData() to return an array of complex values somehow.
ii) Add methods for getRealFrequencyData() and getImaginaryFrequencyData()
iii) Add getFloatPhaseData() which would return the phase of the
calculated spectrum, and leave getFloatFrequencyData() returning the
magnitude.

I can create an issue against the spec for this if we agree it's a
change worth making. I think option iii is pretty good as it won't
break existing code, but option i is probably neater.

What do you think?

Cheers,

Chris
Received on Friday, 27 September 2013 13:48:53 UTC

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