audioio: increase Linux ALSA/Pulse buffer from 30ms to 80ms - #83
Open
rafael2k wants to merge 1 commit into
Open
Conversation
Raspberry Pi USB audio suffers from isochronous transfer jitter that causes buffer underruns with small 10ms periods. The resulting gaps in TX audio manifest as crackling noise that prevents reliable decoding by remote stations (e.g. VARA HF at ~5% decode rate). Both ALSA and PulseAudio backends share this buffer length config. Increasing to 80ms (3 periods of ~27ms) gives the Pi's dwc_otg USB driver sufficient headroom to avoid underruns. Closes #81
This was referenced Jun 12, 2026
rafael2k
added a commit
that referenced
this pull request
Jun 14, 2026
The 8 kHz -> 48 kHz playback (TX) upsampler interpolated each read- period in isolation: at the last sample of every period it set next=current, flattening the tail, then the next period jumped to its first sample. The signal transition across the boundary was never interpolated, producing a step discontinuity — an audible click once per audio period. This matches every report in issue #81: a pop at the start of each period, its rate scaling with the period count, and bigger buffers only lowering the pop *rate* (PR #83 masked it, did not fix it). Fix: make the interpolator stateful — bridge the PREVIOUS input sample to the current one and carry it across periods (resamp_prev), so the output is continuous over period boundaries. Silence now also ramps cleanly in/out. Also widens the interpolation product to 64 bit (cur-prev spans 2^32 at full scale). Offline test (tests/audioio/test_resampler.c, no sound card needed): the old algorithm's worst sample-to-sample jump lands exactly on a period boundary at 6.0x the smooth signal slope (~71% of full scale); the new one is 0.41x — continuous — and chunked-vs-whole output is bit-identical, proving boundaries are invisible. Does NOT address the separate image-rejection weakness of linear interpolation (the residual aliasing/'wavetable' quality also noted in Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pedromessetti
pushed a commit
to pedromessetti/mercury
that referenced
this pull request
Jul 1, 2026
The 8 kHz -> 48 kHz playback (TX) upsampler interpolated each read- period in isolation: at the last sample of every period it set next=current, flattening the tail, then the next period jumped to its first sample. The signal transition across the boundary was never interpolated, producing a step discontinuity — an audible click once per audio period. This matches every report in issue Rhizomatica#81: a pop at the start of each period, its rate scaling with the period count, and bigger buffers only lowering the pop *rate* (PR Rhizomatica#83 masked it, did not fix it). Fix: make the interpolator stateful — bridge the PREVIOUS input sample to the current one and carry it across periods (resamp_prev), so the output is continuous over period boundaries. Silence now also ramps cleanly in/out. Also widens the interpolation product to 64 bit (cur-prev spans 2^32 at full scale). Offline test (tests/audioio/test_resampler.c, no sound card needed): the old algorithm's worst sample-to-sample jump lands exactly on a period boundary at 6.0x the smooth signal slope (~71% of full scale); the new one is 0.41x — continuous — and chunked-vs-whole output is bit-identical, proving boundaries are invisible. Does NOT address the separate image-rejection weakness of linear interpolation (the residual aliasing/'wavetable' quality also noted in Rhizomatica#81) — that needs a polyphase anti-imaging filter and follows next. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Raspberry Pi USB audio suffers from isochronous transfer jitter that causes buffer underruns with small 10ms periods. The resulting gaps in TX audio manifest as crackling noise that prevents reliable decoding by remote stations (e.g. VARA HF at ~5% decode rate).
Both ALSA and PulseAudio backends share this buffer length config. Increasing to 80ms (3 periods of ~27ms) gives the Pi's dwc_otg USB driver sufficient headroom to avoid underruns.
Closes #81