Skip to content
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

[linux] [chromeOS] Recording with BufferSize < 1024 leads to bad audio #873

Open
kris-ava opened this issue Apr 5, 2024 · 0 comments
Open

Comments

@kris-ava
Copy link

kris-ava commented Apr 5, 2024

On ChromeOS, using the Linux subsystem the cpal library seems to work correctly and records audio. However if I request buffer size smaller than 1024 (I used 480 and 960 for single-channel, 48 kHz 10 ms or 20 ms chunks) I receive buffers of the requested size that result in incorrect audio when played back (the audio is shorter than expected, higher pitched and has artifacts). After much investigation it seems like those are 1024-buffers truncated to the requested size and the truncated data is lost (instead of being passed in the next callback invocation). Requesting buffers of size 480 leads to ~0.5x audio length, and 960 is almost okay (with just some artifacts), which led me to the 1024 bytes conclusion. If requested BufferSize is >= 1024 then all the audio data is received correctly.

In such cases it would be nice for cpal to report the minimal buffer size as 1024, as opposed to 1.

This is not reproducible on my other Linux machines, and I have no clue which layer of the stack is responsible for truncation.

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

No branches or pull requests

1 participant