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

FFT demo and some questions

From: Stephen C Phillips <steve@scphillips.com>
Date: Tue, 8 Sep 2015 21:21:05 +0100
Message-ID: <CAEsoz9myEjB0M+=T3a91yhQ+MVGHaSEKoQHi4hJqDbkLqEpRmw@mail.gmail.com>
To: public-audio@w3.org
Hi,

I've only just joined the mailing list, so please accept my apologies if I
ask questions already resolved - I can't find answers from my searches.


First, I'd love it if you took a look at an application I have just
published on my Morse code website to listen to the microphone and attempt
to decode any Morse code sounds that are audible. It uses the Web Audio API
of course and the FFT function in particular. I haven't seen many (any?)
demos that have a practical use of the FFT so I did wonder if you'd like to
add it to the demos list?

The page is here: http://morsecode.scphillips.com/labs/decoder/


Secondly, in writing the application I came across some limitations with
the API and wondered if they had been discussed:


1. It would be useful to set the sample rate.

Chrome has it set to 48 kHz which of course gives a maximum sampled
frequency of 24 kHz. For the Morse code decoder, a max frequency of 4 kHz
would have been fine. The reason it might matter is that my application
uses a 512 point FFT which gives a time-step of 10ms (between samples) and
a frequency resolution of 93 Hz. if it was sampled at 6 kHz (say) then you
could do a 64 point FFT to give the same resolutions while still having a
max frequency higher than required - saving some processing time.


2. The time resolution of the analysis is limited by the fact that the FFT
input data samples cannot overlap.

Or at least I assume this to be so. My application uses the AnalyzerNode
with a 512 point buffer and a ScriptProcessorNode of the same size. When
the ScriptProcessorNode is called (every 512 frames) it inspects the
contents of the AnalyzerNode to get the frequency-domain data.

What I'd like, is to be able to do a FFT using a moving window of input
data (i.e. a FIFO queue of samples) in order to get a higher time
resolution. Combined with a slower sampling period (see (1)) this might be
feasible.

I'm wondering whether it would be fast enough to use a ScriptProcessorNode
to do the FFT itself in this way (i.e. implement the FFT in JavaScript) but
have not tried yet.


Thanks for your time in reading this and developing the API.

Regards,
Stephen Phillips.
Received on Thursday, 10 September 2015 21:37:44 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 10 September 2015 21:37:45 UTC