Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the range of the values returned by analyser.getByteFrequencyData in the web audio API?

I would like to work with percentages while doing some FFT with the web audio API.

To do so I need to know the range of the values the analyser.getByteFrequencyData returns.

I can't find anything about that, maybe someone knows?

Thanks

like image 822
xavier.seignard Avatar asked Dec 19 '22 04:12

xavier.seignard


1 Answers

analyser.getByteFrequencyData returns a normalized array of values between 0 and 255.

The length of the array is half the value of analyzer.fftSize. So if analyzer.fftSize = 1024 analyser.getByteFrequencyData will return an array with 512 values. Also see https://stackoverflow.com/a/14789992/4303873 for more information.

like image 165
RafaelKr Avatar answered Dec 24 '22 01:12

RafaelKr