FFT webaudio AnalyserNode values ​​out of range

I am trying to use Web-Audio Analyzer Node and get weird results from it.

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 if I explicitly set the max and min decibels values, I still get values ​​that are less than -120, such as -180.

Also, when I console.log

parse, I see that the values ​​did change, but the FFT still gives me lower values ​​than expected.

I am using a stereo mp3 file to test it, could this be the problem?

Any ideas?

+3


source to share


1 answer


Minimum and maximum decibels only affect getByteFrequencyData values, not getFloatFrequencyData values. "Minimum / maximum power value in the scaling range for FFT analysis data to convert to unsigned byte values."



+1


source







All Articles