- bass
- 0.00
- mid
- 0.00
- high
- 0.00
What you’ll learn
Drive buffer geometry directly from audio data, without a React render per frame. Three.js is a separate renderer, not a dependency of audio-bands.
Install three separately. This example loads it on demand and disposes its geometry, material and renderer when you leave.
const { bass, mid, high } = audio.getBands();
for (let i = 0; i < count; i++) {
const wave = Math.sin(i * 0.17 + time);
const radius = 1 + bass * 0.65 + wave * high * 0.3;
positions[i * 3] = base[i * 3] * radius;
positions[i * 3 + 1] = base[i * 3 + 1] * radius;
positions[i * 3 + 2] = base[i * 3 + 2] * radius;
}
geometry.attributes.position.needsUpdate = true;
points.rotation.y += mid * delta;