Skip to content

Conversation

@thomasyuill-livekit
Copy link
Contributor

@thomasyuill-livekit thomasyuill-livekit commented Jan 14, 2026

Issue

Depending on the # of audio bands, there is a strange clipping (low-pass filter) effect on the visualizer

  • Math.ceil-based chunking causes trailing bands to be zeroed out
  • loPass/hiPass options are not using merged defaults
Screen.Recording.2026-01-13.at.6.22.06.PM.mov

Explaination

We initially fill an array of "bins" with zeros, then we process the frequency bands.

  • Rounding up results in frequency range being processed too quickly, resulting in tailing bins not getting filled
  • Rounding down results in bins getting filled faster, and tailing frequencies being clipped

Proportional filling tries to optimize for filling all the bins while processing all frequencies

Solution

  • Use proportional distribution based chunking to avoid loosing tailing bands
  • Use loPass/hiPass options from merged defaults
Screen.Recording.2026-01-13.at.9.00.57.PM.mov

Test plan

  • run pnpm dev:storybook and reviewe the various visualizers
  • switch state to speaking
  • adjust the number of bands being rendered

Checklist

  • Verify frequency bands are evenly distributed when changing bands count
  • Confirm no trailing zeros appear in the returned array due to rounding
  • Test with various bands values (5, 7, 10, 20, 50) to ensure consistent behavior

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 686c2f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@livekit/components-react Patch
@agents-ui Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

size-limit report 📦

Path Size
LiveKitRoom only 6 KB (0%)
LiveKitRoom with VideoConference 32.46 KB (0%)
All exports 43.4 KB (+0.02% 🔺)

@thomasyuill-livekit thomasyuill-livekit merged commit 8558fe9 into main Jan 14, 2026
6 checks passed
@thomasyuill-livekit thomasyuill-livekit deleted the ty/fix-useMultibandTrackVolume-clipping branch January 14, 2026 17:21
@github-actions github-actions bot mentioned this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants