Scale waveform bars from stored amplitudes to the renderer's range - #5815
Open
lukemelia wants to merge 1 commit into
Open
Scale waveform bars from stored amplitudes to the renderer's range#5815lukemelia wants to merge 1 commit into
lukemelia wants to merge 1 commit into
Conversation
Contributor
Preview deployments |
Every envelope producer persists bars as 0..1 amplitudes — decoded RMS of float samples, MP3's peak-normalized side-info envelope, the WAV streaming envelope — while AudioPreview draws bar heights from 0-100 percentages with a minimum sliver height. The projection clamped values into [0, 100] but never rescaled, so a full-scale 1.0 bar computed a height below the sliver minimum and every waveform rendered as an identical flat dashed line, indistinguishable from silence. waveformBarsFor now scales by 100 before clamping. No stored data ever used the 0-100 scale the clamp implied, so there is no compatibility concern. Tests pin the contract: a full-scale bar projects to 100, out-of-range values clamp, and resampling operates on the projected scale. Fixes CS-12556. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
lukemelia
force-pushed
the
cs-12556-audio-waveforms-render-flat-projection-passes-01-amplitude
branch
from
August 18, 2026 20:58
4867aa4 to
9010dc9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Every audio waveform rendered as a flat dashed line of identical minimum-height slivers — indistinguishable from silence — regardless of the track's dynamics. The cause is a scale mismatch across the projection seam:
AudioPreviewdraws bar heights from 0–100 percentages ((v / 100) * 96) with a 1.5 minimum sliver, so a full-scale 1.0 bar computes a 0.96 height — below the minimum — and every bar clamps to the identical sliver.waveformBarsForinfile-view-model.ts, whose contract (perAudioPreview's own comment) is to deliver bars "already normalized to 0–100". It clamped into [0, 100] but never rescaled.waveformBarsFornow scales by 100 before clamping. There is no compatibility concern: no producer ever emitted the 0–100 scale the clamp implied, so every persisted envelope is 0..1.Test plan
packages/host/tests/unit/file-view-model-test.ts: new contract test — a full-scale 1.0 bar projects to 100 (full height rather than the minimum sliver), out-of-range values clamp to [0, 100]; the existing resample and under-budget tests now feed 0..1 amplitudes and assert the projected scale. FullUnit | file-formatsmodule: 23 tests, 58 assertions, passing locally against a full dev stack.Fixes CS-12556.
🤖 Generated with Claude Code