fix: implement gradual lag correction to prevent note rushing (#3882)#5095
Merged
walterbender merged 1 commit intosugarlabs:masterfrom Jan 28, 2026
Merged
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
7se7en72025
added a commit
to 7se7en72025/musicblocks
that referenced
this pull request
Feb 2, 2026
…abs#3882) (sugarlabs#5095) Add tests for getPitchInfo and pitch calc Update musicutils tests: normalize object literal keys (use unquoted numeric keys and property names) and change notePitches index to a numeric key. Replace a TODO with comprehensive unit tests for getPitchInfo (alphabet, alphabet/letter class, solfege fixed/movable, pitch class, scalar class, scale degree, nth degree, staff y, pitch in hertz, pitch-to-color/shade, and invalid input) and add tests for _calculate_pitch_number (standard note parsing and relative pitch comparison). These tests increase coverage for pitch-related utilities. Improve frequency handling and code formatting Introduce a newFrequency variable and use parseFloat once, replacing exact equality checks with a tolerant comparison (Math.abs(... - value) < 0.001) to avoid floating-point equality bugs when finding/inserting stairs. Clean up arithmetic/parentheses in width calculation and unify use of newFrequency when pushing/splicing stairs. Also apply small formatting and style tweaks: reformat long chained assignments (decoration bitmap scales), normalize toTitleCase declaration/brace style, and compress widgetWindow.addButton onclick lambdas for readability. These changes are intended to improve correctness around frequency comparisons and overall code consistency.
walterbender
pushed a commit
that referenced
this pull request
Feb 3, 2026
…er (#5468) * fix: implement gradual lag correction to prevent note rushing (#3882) (#5095) Add tests for getPitchInfo and pitch calc Update musicutils tests: normalize object literal keys (use unquoted numeric keys and property names) and change notePitches index to a numeric key. Replace a TODO with comprehensive unit tests for getPitchInfo (alphabet, alphabet/letter class, solfege fixed/movable, pitch class, scalar class, scale degree, nth degree, staff y, pitch in hertz, pitch-to-color/shade, and invalid input) and add tests for _calculate_pitch_number (standard note parsing and relative pitch comparison). These tests increase coverage for pitch-related utilities. Improve frequency handling and code formatting Introduce a newFrequency variable and use parseFloat once, replacing exact equality checks with a tolerant comparison (Math.abs(... - value) < 0.001) to avoid floating-point equality bugs when finding/inserting stairs. Clean up arithmetic/parentheses in width calculation and unify use of newFrequency when pushing/splicing stairs. Also apply small formatting and style tweaks: reformat long chained assignments (decoration bitmap scales), normalize toTitleCase declaration/brace style, and compress widgetWindow.addButton onclick lambdas for readability. These changes are intended to improve correctness around frequency comparisons and overall code consistency. * Update pitchstaircase.js
vanshika2720
pushed a commit
to vanshika2720/musicblocks
that referenced
this pull request
Feb 11, 2026
…er (sugarlabs#5468) * fix: implement gradual lag correction to prevent note rushing (sugarlabs#3882) (sugarlabs#5095) Add tests for getPitchInfo and pitch calc Update musicutils tests: normalize object literal keys (use unquoted numeric keys and property names) and change notePitches index to a numeric key. Replace a TODO with comprehensive unit tests for getPitchInfo (alphabet, alphabet/letter class, solfege fixed/movable, pitch class, scalar class, scale degree, nth degree, staff y, pitch in hertz, pitch-to-color/shade, and invalid input) and add tests for _calculate_pitch_number (standard note parsing and relative pitch comparison). These tests increase coverage for pitch-related utilities. Improve frequency handling and code formatting Introduce a newFrequency variable and use parseFloat once, replacing exact equality checks with a tolerant comparison (Math.abs(... - value) < 0.001) to avoid floating-point equality bugs when finding/inserting stairs. Clean up arithmetic/parentheses in width calculation and unify use of newFrequency when pushing/splicing stairs. Also apply small formatting and style tweaks: reformat long chained assignments (decoration bitmap scales), normalize toTitleCase declaration/brace style, and compress widgetWindow.addButton onclick lambdas for readability. These changes are intended to improve correctness around frequency comparisons and overall code consistency. * Update pitchstaircase.js
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 #3882
Limits lag correction to 25% of each note's duration instead of catching up all at once. This prevents notes from being rushed while still synchronizing with the master clock over time.