-
-
Notifications
You must be signed in to change notification settings - Fork 113
[WIP] Fix MIDI clock sync to update BPM Faster #1032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@copilot - try that again, but don't try to build the project and push to git. Not sure what you're doing there buddy, but there are mega errors. Just look at the code, make changes if needed, and a I'll pull and check locally. |
Key changes: - DelayLockedLoop: Added adaptive bandwidth (starts high for fast convergence, transitions to lower bandwidth for stability) - MidiClock: Reduced sync period from 48 to 24 ticks (~1 beat) - MidiClock: Reduced BPM update interval from 1.0s to 0.25s - MidiClock: Added hysteresis (0.5 BPM threshold) to prevent jitter - Changed M_PI/M_SQRT2 from float to double for precision Co-authored-by: mfisher31 <[email protected]>
|
|
Made the code changes in commit 7411ba1. I've improved the DelayLockedLoop algorithm with adaptive bandwidth (fast initial convergence, stable tracking once locked) and updated MidiClock to update BPM every 0.25s instead of 1.0s. Ready for you to pull and test locally. |
|
Hey @copilot go ahead and write a unit test for this as well. make sure to check the CMakeLists.txt and other tests to see exactly how to do it. Make no assumptions. Don't do guess work. Look at the existing build system to see what to do. Also remember KISS. Don't be a newbie on this one, got it? |
Tests cover: - DelayLockedLoop construction, reset, convergence, and locking - MidiClockMaster construction and tempo changes Co-authored-by: mfisher31 <[email protected]>
Added unit tests in commit c653f81. Created |
- Add testTempoChangeConvergence: tests DLL convergence speed (120→140 BPM) - Add testLargeTempoSwing: tests extreme tempo change (20→120 BPM, 6x increase) - Add testRapidTempoChanges: tests stability with large tempo shifts - Add testTempoChangeAccuracy: tests accuracy across 60-200 BPM range - Add testJitterRejection: tests filtering of timing jitter - Add testExtremeTempos: tests behavior at 40 and 240 BPM - Add MidiClockMaster tests for clock generation and tempo change response Verifies implementation meets pro audio standards (lock within 1-4 beats)
- Format the code - fix a datapath testing problem with archlinux in docker - Refactor code for consistency and clarity in various files
DelayLockedLoopalgorithm andMidiClockimplementationSummary of Changes
DelayLockedLoop (
src/delaylockedloop.hpp)floattodoublefor better precisionisLocked()andgetPeriod()helper methodsMidiClock (
src/engine/midiclock.hpp,src/engine/midiclock.cpp)syncPeriodTicksfrom 48 to 24 (signal acquired after 1 beat instead of 2)bpmChangeThreshold = 0.5BPM to prevent jittery updates when tempo is stablelastReportedBpmtracking to implement hysteresisUnit Tests (
test/engine/MidiClockTest.cpp)DelayLockedLoop: construction, reset, convergence, and locking behaviorMidiClockMaster: construction and tempo changestest/CMakeLists.txtThese changes should make MIDI clock sync respond immediately when receiving external clock, while maintaining stability once locked.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.