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

Invalid period size specification for ALSA? #913

Open
abique opened this issue Sep 21, 2024 · 0 comments · May be fixed by #917
Open

Invalid period size specification for ALSA? #913

abique opened this issue Sep 21, 2024 · 0 comments · May be fixed by #917

Comments

@abique
Copy link
Contributor

abique commented Sep 21, 2024

hw_params.set_period_size_near((v / 4) as alsa::pcm::Frames, alsa::ValueOr::Nearest)?;

Hi,
The code above seems wrong to me.
As I understand it, a cpal buffer size correspond to an alsa period size.
So the alsa buffer size should be: nperiods * cpal_buffer_size.

While it is currently cpal_buffer_size / 4 and I suppose that nperiods == 4.

I think that better defaults for cpal would be a nperiods == 2.

Cheers,
Alex

abique added a commit to abique/cpal that referenced this issue Sep 21, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 21, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 21, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 22, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 22, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 22, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 22, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 24, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods.
The default was far too large, 1024 samples is a much more reasonable default (still too large for real-time audio).

Fixes RustAudio#913
@abique abique linked a pull request Sep 24, 2024 that will close this issue
abique added a commit to abique/cpal that referenced this issue Sep 24, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods ideally.

The default is now set to 1024 samples which is a reasonable default,
yet still too large for real-time audio.

The default value now uses the same code path as custom values.

Fixes RustAudio#913
abique added a commit to abique/cpal that referenced this issue Sep 25, 2024
With ALSA, the buffer size is `nperiod * period_size`.
We want 2 periods ideally.

The default is now set to 1024 samples which is a reasonable default,
yet still too large for real-time audio.

The default value now uses the same code path as custom values.

Fixes RustAudio#913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment