Web Audio node parser getByteFrequencyData parser returning an empty array

I am trying to access FFT data from a node analyzer using analyser.getByteFrequencyData(array) , but it seems to return an empty array:

 var array = new Uint8Array(analyser.frequencyBinCount); analyser.getByteFrequencyData(array); 

However, using analyser.getFloatFrequencyData(array) returns an array of data:

 var array = new Float32Array(analyser.frequencyBinCount); analyser.getFloatFrequencyData(array); 

I use the signal chain as follows:

SourceAnalyserScriptProcessorContext Destination

So why can't I get the frequency data in byte form?

Thanks in advance.

+4
source share
3 answers

Without seeing more of my code, I think that you have minDecibels and maxDecibels set in a range that exceeds the data that you pump through the analyzer, so it is reset to zero.

+1
source

What are the chances that one of you received the data before starting playback, so there was nothing else to read? If this may be the case, try calling getByteFrequencyData after starting playback.

+1
source

Make sure smoothingTimeConstant set to 1 . When this is the case, getFloatFrequencyData always returns an array of zeros.

0
source

All Articles