Repository navigation
fix(Oscillator): cache periodic waves by sample rate - #1528
Merged
tambien merged 2 commits intoOct 22, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1528 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 209 209
Lines 23584 23608 +24
Branches 1030 1032 +2
=======================================
+ Hits 23330 23354 +24
Misses 251 251
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
thanks so much for the fix! |
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.
Fixes #1323.
The static
Oscillatorcache can reuse a nativePeriodicWavecreated at a different sample rate. In Chromium, a 440 Hz rotated sine renders at approximately 480 Hz after warming the cache at 44.1 kHz and rendering at 48 kHz; reversing the rates gives approximately 404 Hz.FatOscillatoralso reaches this cache through its phase-shifted oscillators.Include the context's
sampleRatein both cache lookups and in each entry. Same-rate reuse and the existing 100-entry limit are preserved.Eight browser regression tests compare rendered rotated/custom sine waves with an analytic reference in both rate orders, plus same-rate controls that verify cache reuse. Against the original production source, the complete Oscillator test file has 54 passing tests and four failing mixed-rate cases; with the fix, all 58 pass.
Validation on Linux, Node 22.14.0 and Chromium 149:
npm test: 3,108 passed, 0 failed, 43 skipped (upstream: 3,100 passed, 43 skipped).npm run lint,npm run spellcheck,npm run build, and Prettier checks for both changed files: passed. The build retains the upstream webpack bundle-size warnings.Firefox validation was blocked by a browser automation timeout before a page could be created. Safari was not tested.