- bass
- 0.00
- mid
- 0.00
- high
- 0.00
What you’ll learn
Normalize FFT bytes from 0–255 and draw them in a canvas animation loop.
const { fft } = audio.snapshot();
if (fft) {
ctx.clearRect(0, 0, width, height);
const step = width / fft.length;
fft.forEach((value, i) => {
const bar = (value / 255) * height;
ctx.fillRect(i * step, height - bar, step - 1, bar);
});
}