Skip to content

Spectrogram helper centralization

Choose a tag to compare

Centralizes two pieces of spectrogram logic that were duplicated across packages, so a format/math change can no longer silently diverge the two rendering pipelines (the #554/#556 drift bug class). Behavior-preserving refactor — no user-facing behavior changes. Resolves #560 (PR #564).

What changed

  • Padded FFT sample-range math is now single-sourced in computePaddedFftRange (@dawcore/spectrogram). Both SpectrogramOrchestrator and the React computeChunkSampleRange delegate to it.
  • Canvas-ID ${clipId}-ch${channelIndex}-chunk${n} contract is now single-sourced in buildSpectrogramCanvasId / parseSpectrogramCanvasId (@waveform-playlist/core) — the only home reachable by all four parsers and both builders. A build∘parse roundtrip test acts as the cross-package regression guard.

Minor internal tightening: extractChunkNumber and the SpectrogramChannel unmount parser now reject malformed IDs lacking a -ch{N}- segment. Real canvas IDs are always full-format, so no production path is affected.

Published packages

Package Version
@waveform-playlist/core 12.5.0
@dawcore/spectrogram 0.0.5
@waveform-playlist/ui-components 13.1.1
@waveform-playlist/spectrogram 13.0.5
@dawcore/components 0.0.32

New public API

@waveform-playlist/core now exports buildSpectrogramCanvasId, parseSpectrogramCanvasId, and the SpectrogramCanvasIdParts type.