I'm trying to use Web-Audio's Analyser Node and keep getting weird results from it.
The code:
var self = this;
var bufferSize = 512;
var spectrum = new Float32Array(bufferSize/2);
self.analyser = audioContext.createAnalyser();
self.analyser.fftSize = bufferSize;
self.analyser.smoothingTimeConstant = 0;
self.analyser.minDecibels = -120;
self.analyser.maxDecibels = 0;
self.analyser.getFloatFrequencyData(spectrum);
source.connect(self.analyser);
Even though I explicitly set the values of the max and min decibels, I still get values that are less than -120, for example, -180.
Also, when I console.log the analyser, I see that the values did in fact change, but the FFT still gives me lower values than expected.
I'm using a stereo mp3 file to test it, could this be an issue?
Any ideas?
Min and max decibels only affect the getByteFrequencyData values, not the getFloatFrequencyData values. "The minimum/maximum power value in the scaling range for the FFT analysis data for conversion to unsigned byte values."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With