Skip to content

fix audiospeed.SpeedChanger direct playback, fixes #11020#11022

Merged
tannewt merged 1 commit into
adafruit:mainfrom
todbot:main
May 22, 2026
Merged

fix audiospeed.SpeedChanger direct playback, fixes #11020#11022
tannewt merged 1 commit into
adafruit:mainfrom
todbot:main

Conversation

@todbot

@todbot todbot commented May 22, 2026

Copy link
Copy Markdown

Fix by setting "single_buffer = false".

When single_buffer = true, the DMA driver sets up a hardware loop that resets the read address back to buffer[0] at full DMA speed, never calling get_buffer again. This caused SpeedChanger to replay its first 128-frame output buffer indefinitely when connected directly to audioio/audiobusio.

Setting single_buffer = false enables the double-buffering path w/ DMA interrupts, which keeps calling get_buffer() so the phase accumulator can advance through the source audio correctly.

Using AudioMixer as an intermediary masks the bug since Mixer/mix_down_one_voice() calls get_buffer() on its voices directly, bypassing the single_buffer optimization.

Fix by setting "single_buffer = false".
When single_buffer = true, the DMA driver sets up a hardware loop that
resets the read address back to buffer[0] at full DMA speed, never calling
get_buffer again. This caused SpeedChanger to replay its first 128-frame
output buffer indefinitely when connected directly to audioio/audiobusio.

Setting single_buffer = false enables the double-buffering path w/ DMA
interrupts, which keeps calling get_buffer() so the phase accumulator can
advance through the source audio correctly.

Using AudioMixer as an intermediary masks the bug since
Mixer/mix_down_one_voice() calls get_buffer() on its voices directly,
bypassing the single_buffer optimization.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@tannewt tannewt merged commit 6b4970b into adafruit:main May 22, 2026
195 checks passed
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