Path: blob/main/files/en-us/web/api/analysernode/frequencybincount/index.md
6538 views
------{{APIRef("Web Audio API")}}
The frequencyBinCount read-only property of the {{domxref("AnalyserNode")}} interface is an unsigned integer half that of the {{domxref("AnalyserNode.fftSize")}}. This generally equates to the number of data values you will have to play with for the visualization.
Value
An unsigned integer, equal to the number of values that {{domxref("AnalyserNode.getByteFrequencyData()")}} and {{domxref("AnalyserNode.getFloatFrequencyData()")}} copy into the provided TypedArray.
For technical reasons related to how the Fast Fourier transform is defined, it is always half the value of {{domxref("AnalyserNode.fftSize")}}. Therefore, it will be one of 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, and 16384.
Examples
The following example shows basic usage of an {{domxref("AudioContext")}} to create an AnalyserNode, then {{domxref("window.requestAnimationFrame()","requestAnimationFrame")}} and {{htmlelement("canvas")}} to collect frequency data repeatedly and draw a "winamp bar graph style" output of the current audio input. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 108-193 for relevant code).
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}