I would like to capture fourier transform of a small time window (ie ~1 second).
let audioCtx = new AudioContext();
let analyser = audioCtx.createAnalyser()
let buffer = new Uint8Array(analyser.frequencyBinCount);
//given an audio stream 'stream'
let source = audioCtx.createMediaStreamSource(stream);
setInterval(()=>{
analyser.getByteFrequencyData(buffer);
//Do some analysis with buffer...
},1000)
Using WebAPI's AnalyserNode I can get fourier data in bins of width 44100/analyser.fftSize = 22050/analyser.frequencyBinCount, allowing for specifying the resolution by setting analyser.fftSize. What is unclear to me from the documentation is how the time window is set.
From the API:
Rendering an audio graph is done in blocks of 128 samples-frames. A block of 128 samples-frames is called a render quantum, and the render quantum size is 128.
Does this imply a time window of 128/44100Hz=2.9ms?