Skip to content

synthio: keep MidiTrack's timing accurate for long delays - #11661

Merged
dhalbert merged 1 commit into
mainfrom
synthio-miditrack-long-delays
Oct 24, 2026
Merged

dhalbert merged 1 commit into
mainfrom
synthio-miditrack-long-delays

Conversation

@tyeth

@tyeth tyeth commented Oct 23, 2026

Copy link
Copy Markdown
Member

Fourth of five stacked PRs; targets the branch of the previous one.

span.dur is a uint16_t, so a delay longer than 65535 samples wrapped. At 44.1kHz that is any gap beyond 1.5 seconds, so a held note or a rest of ordinary length came out far too short. The conversion overflowed too: delta * sample_rate does not fit in 32 bits for a long delay.

Compute the duration in 64 bits and carry whatever does not fit in span.dur in a separate field, handing it over a chunk at a time.

Verification

Builds clean on arm and xtensa. This path is timing-only and was not measured on a device.

Size

About +160 bytes of flash on nrf52840, plus four bytes per MidiTrack object.

🤖 Generated with Claude Code

@tyeth
tyeth added this pull request to stack #11668 October 23, 2026 22:57
span.dur is a uint16_t, so a delay longer than 65535 samples wrapped: at
44.1kHz that is any gap beyond 1.5 seconds, and a held note or a rest of
ordinary length came out far too short. The conversion overflowed too,
because delta * sample_rate does not fit in 32 bits for a long delay.

Compute the duration in 64 bits and carry whatever does not fit in
span.dur in a separate field, handing it over a chunk at a time.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dhalbert
dhalbert force-pushed the synthio-miditrack-long-delays branch from 3a31177 to 6dfa7e5 Compare October 24, 2026 12:29
Base automatically changed from synthio-miditrack-note-off-velocity to main October 24, 2026 12:32
@dhalbert
dhalbert merged commit 78a7693 into main Oct 24, 2026
546 of 547 checks passed
@dhalbert
dhalbert deleted the synthio-miditrack-long-delays branch October 24, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants