[alsa-devel] Period size setting is ignored when dmix is used
I would like to set different period size (or time) values for different ALSA applications, in order to optimize latency and processor load based on specific application needs. For example, a telephony application will use a shorter period size/time than a media player application, so that low latency does not affect the quality of the call. I found out that if dmix plugin is used in the ALSA path, period size/time settings are completely ignored and forced to default values (supposedly read from the ALSA driver of the HW card).
For example, not using dmix, period size value is correctly accepted (but of course I cannot play audio from multiple applications at the same time): aplay -vv --period-size=4096 -D plug:hw <WAV file name> Plug PCM: Hardware PCM card 0 'HDA Intel' device 0 subdevice 0 ... period_size : 4096 ...
Adding dmix instead, I can play audio from multiple applications at the same time, but period size is ignored and I cannot therefore set different latencies for different applications: aplay -vv --period-size=4096 -D plug:dmix <WAV file name> Plug PCM: Hardware PCM card 0 'HDA Intel' device 0 subdevice 0 ... period_size : 1024 ...
Am I missing something? Is there a way to implement mixing + different latency settings in ALSA applications, without using an audio server?
Thanks Andrea
Dne 02. 10. 19 v 15:56 Andrea Narciso - ART S.p.A. napsal(a):
I would like to set different period size (or time) values for different ALSA applications, in order to optimize latency and processor load based on specific application needs. For example, a telephony application will use a shorter period size/time than a media player application, so that low latency does not affect the quality of the call. I found out that if dmix plugin is used in the ALSA path, period size/time settings are completely ignored and forced to default values (supposedly read from the ALSA driver of the HW card).
For example, not using dmix, period size value is correctly accepted (but of course I cannot play audio from multiple applications at the same time): aplay -vv --period-size=4096 -D plug:hw <WAV file name> Plug PCM: Hardware PCM card 0 'HDA Intel' device 0 subdevice 0 ... period_size : 4096 ...
Adding dmix instead, I can play audio from multiple applications at the same time, but period size is ignored and I cannot therefore set different latencies for different applications: aplay -vv --period-size=4096 -D plug:dmix <WAV file name> Plug PCM: Hardware PCM card 0 'HDA Intel' device 0 subdevice 0 ... period_size : 1024 ...
Am I missing something? Is there a way to implement mixing + different latency settings in ALSA applications, without using an audio server?
You must set these parameters in the dmix configuration which is shared by all clients. You cannot set the buffer settings per application for the shared buffer.
Jaroslav
participants (2)
-
Andrea Narciso - ART S.p.A.
-
Jaroslav Kysela