Skip to content

Use the midpoint for unsigned 8-bit playback silence - #645

Merged
mgeier merged 3 commits into
spatialaudio:masterfrom
antonsoo:fix/uint8-playback-silence
Oct 18, 2026
Merged

mgeier merged 3 commits into
spatialaudio:masterfrom
antonsoo:fix/uint8-playback-silence

Conversation

@antonsoo

@antonsoo antonsoo commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

The convenience playback callback fills unmapped channels and the final partial block with zero. For uint8, zero is the negative endpoint; silence is 128, as documented by SoundDevice and PortAudio. This can send a DC signal on a channel intended to be silent.

Choose the fill value from the output dtype and use it at both sites.

Validation:

  • Native PortAudio/ALSA file playback of two WAV assets repairs 14 of 48 configurations and 12,498 incorrect silence samples. All audio payloads and 34 complete callback-window controls stay exact. These checks use isolated file/null PCMs.
  • The existing CI import/device/version smoke commands and Pyright source/example checks pass locally. Hardware and other operating systems were not tested.

The convenience playback callback fills unused channels and the final partial block with silence. Use 128 for uint8 PCM, matching the PortAudio sample format, and retain zero for signed and floating formats. Cover final padding, channel mapping and looped playback.
@mgeier

mgeier commented Oct 18, 2026

Copy link
Copy Markdown
Member

Thanks for this PR!

Similar to #644, this adds both a new feature and a new testing framework. Those should be two separate discussions.

@antonsoo

Copy link
Copy Markdown
Contributor Author

Thanks. I removed the standalone unittest file in 87708d0. The PR now changes only the two silence fills; testing infrastructure can be discussed separately.

@mgeier
mgeier merged commit a4e5f77 into spatialaudio:master Oct 18, 2026
15 checks passed
@mgeier

mgeier commented Oct 18, 2026

Copy link
Copy Markdown
Member

Thanks!

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