Math Errors in alsa backend? #788
Replies: 4 comments 14 replies
-
The above Currently it looks like this with
|
Beta Was this translation helpful? Give feedback.
-
Quick reply here while I’m gardening 😄 I think you might be onto something here. One thing that crosses my mind is that in Rust Alsa, the In the end the buffer should be big enough to hold the number of bytes that we’re writing. |
Beta Was this translation helpful? Give feedback.
-
Dealing strictly in periods and time also opens up the possibility for a |
Beta Was this translation helpful? Give feedback.
-
Closing this in favor of #789. |
Beta Was this translation helpful? Give feedback.
-
Here the intention seems to be to find the period size:
Putting this after it yields
Period Size: 5512
forS16
:But it yields
8268
forS24_3
,11025
forS24
and11025
forS32
.The scale used seems to be 1 byte is assumed to be 2756 for some reason? At least that's what the above equation works out to be.
S16
= 2 bytes, 2 * 2756 = 5512,S24_3
= 3 bytes, 3 * 2756 = 8268,S24
andS32
= 4 bytes, 4 * 2756 = 11025.An ALSA Frame = a sample, so 44100 audio has 44100 Frames per sec, it has nothing to do with the format, given the same sampling rate it should not change. If you want a period time of 125ms that would mean 5512.5 (44100/8) (ALSA will round that up to 5513) so the math kinda checks out for
S16
but it should not grow as you up the format.The end result is that the
period_size
andbuffer_size
(as percat /proc/asound/card*/pcm*p/sub*/hw_params
) are not set to correct values on formats other thanS16
andself.buffer
inalsa.rs
ends up beingup to twice the size as it really needs to bethe wrong size.I have a wip branch I'm working on that I think is a better solution. @roderickvd if you could take a look at it and tell me that you think that would be great?
Beta Was this translation helpful? Give feedback.
All reactions