fix(editor): keep the preview's boosted audio from clipping at the speakers - #918
Conversation
…eakers The preview raises a take by its loudness gain (up to +12 dB) and the output trim, with no limiter, so a loud take's peaks went past full scale and the audio device clipped them. The export holds them at -1.5 dBFS. Measured on a real take: a -7.1 dBFS peak raised 8.9 dB, 92 samples over. The mix now reaches the speakers through a WaveShaperNode: the identity up to the export's ceiling, then a tanh knee towards full scale. A curve has no state, so the preview still plays everything under the ceiling exactly as the export writes it. Checked in Chromium with an OfflineAudioContext: -120 dB error under the ceiling, and a +1.77 dBFS sine goes from 18800 samples over full scale to none. Refs #911
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe preview audio graph now applies inverse headroom gain and a WaveShaper ceiling curve before audio reaches the destination. The curve preserves levels through the export ceiling and applies a tanh knee above it. Cleanup and tests cover the added nodes and routing. ChangesPreview audio ceiling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The preview ceiling preserves ordinary playback levels and bounds boosted peaks, with correct routing and cleanup. No actionable merge-blocking issue remains; merge after normal checks. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change remains within browser-local audio playback and introduces no observed new privileges, data exposure, or network access. Successful playback gains an amplitude ceiling. Existing fallback paths do not provide the same ceiling guarantee. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Refs #911. Second defect found while isolating the crackle; the capture holes themselves are fixed in #916.
Cause
Fix
WaveShaperNode: the identity up to the export's ceiling, then a tanh knee towards full scale.headroomgain (÷16, +24 dB) brings the mix into the shaper's [−1, 1] input range.Verification
Rendered in Chromium with an
OfflineAudioContext(440 Hz sine, 1 s):Tests:
src/components/ai-editionpasses, exceptLeftPanel.copyMessage, which fails under load and passes alone (unrelated).tsc(app and tests) and Biome pass.🤖 Generated with Claude Code
Summary by CodeRabbit