Skip to content

Add a logarithmic frequency scale to SpectrumCanvas#142

Merged
i-afaqrashid merged 2 commits into
mainfrom
issue-142-log-spectrum
May 29, 2026
Merged

Add a logarithmic frequency scale to SpectrumCanvas#142
i-afaqrashid merged 2 commits into
mainfrom
issue-142-log-spectrum

Conversation

@i-afaqrashid
Copy link
Copy Markdown
Owner

@i-afaqrashid i-afaqrashid commented May 29, 2026

Summary

Adds a scale prop to SpectrumCanvas ("log" | "linear", default "log"). The log scale aggregates the full FFT into log-spaced bars (peak per band) so the whole audible range is visible, instead of only the lowest ~1 kHz. scale="linear" keeps the previous one-bin-per-bar behavior.

How verified

  • New pure readSpectrumBarValue helper with unit tests (null/empty, linear one-bin read, log peak aggregation that surfaces high bins, in-bounds mapping).
  • React package tests pass (57); scale documented in docs/api.md.
  • pnpm verify passes locally.

Closes #141

Adds a scale prop ("log" | "linear", default "log"). On the log scale the
canvas reads the full FFT and aggregates bins into log-spaced bars (peak
per band), so the whole audible range shows instead of only the lowest
bins. Linear keeps the previous one-bin-per-bar behavior. Includes a pure
readSpectrumBarValue helper with unit tests and documents the prop.

Closes #142
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webaudio-kit-site Ready Ready Preview, Comment May 29, 2026 11:53am

Adds unit tests for readSpectrumBarValue (null/empty, linear one-bin read,
log peak aggregation that surfaces high bins, in-bounds mapping) and a
docs/api.md bullet for the SpectrumCanvas scale prop.
@i-afaqrashid i-afaqrashid merged commit a2716f4 into main May 29, 2026
12 checks passed
@i-afaqrashid i-afaqrashid deleted the issue-142-log-spectrum branch May 29, 2026 11:55
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.

Add a logarithmic frequency scale to SpectrumCanvas

1 participant