captbaritone / captbaritone/webamp

Spectrum Analyser draws the wrong number of bars

Open
#81 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
796
PR merge metrics
No merged PRs in 30d

Description

The `analyser.getByteFrequencyData` method gives us an array of values, which is just what we want! Unfortunately, the number of values in the array is always a power of two (half of `analyser.fftSize`) and we need 19.

I think our only option is to use far more bins than we need, and simply average length/19 of the bins for each bar. It's going to lead to some inaccuracy along the way, but I can't see a better approach.

Currently we are getting 32 bins and drawing all of them, even though many are off the canvas. Gross.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.