Search code examples
javascriptweb-audio-apifrequency-analysis

What does the values of the Array returned by getByteFrequencyData() mean?


I'm a little bit confused what exactly all the values of the Uint8Array retured by getByteFrequencyData() mean/represent?

How can I understand their value? And why are most of the first values defined and the later ones are most 0?


Solution

  • The latest spec explains getByteFrequencyData in more detail. Basically, it's the magnitude of the FFT of the data converted to dB and scaled to a byte value between 0 and 255. If the later values are 0, it's because there is very little frequency content there.