Hacker News new | ask | show | jobs
by donio 2095 days ago
I don't have PA on my system and I am able to play audio from many sources at the same time using ALSA only. Not sure if this requires hardware/driver support or something, I don't have any special ALSA config.

I don't know about the audio quality improvement though, unless OP is talking about avoiding latency that comes from going through PA.

2 comments

I avoided PA for years because "alsa just works". It is not until one tries to build a native linux app that you see the issue with alsa once you venture into the alsa library docs.

Indeed, alsa only supports one audio stream. This was the purpose of all the other sound daemons (arts, esd, etc) of times past. Alsa added "native" software mixing via a "dmix" [0] plugin. The end user is left with a setup that can handle multiple streams to a single sound card, however, one looses the ability to better tune how those streams are mixed.

For instance, most sound cards only support sample rates of 48khz. What happens when you have one application playing 44.1khz 16bit sound with another playing 44.1khz 32bit all while something else is playing 48khz sound? Dmix will resample and mix them into one 48khz stream, but it does so in the sloppiest way. It can be tuned somewhat, but that just makes the application linked into the alsa library consume even more CPU cycles.

Pulseaudio is much more better in this situation. It can change its sample rate on the fly. For the above scenario, it could have upsampled the one 44.1khz 16bit stream to 32 bit, and resampled the 48khz stream to 44.1khz and then piped this single 44.1khz stream to the sound card (if it supports 44.1khz audio) at much better efficiency and less work. There is really no reason to fight it anymore.

[0]: https://www.alsa-project.org/main/index.php/Asoundrc#dmix

You may have hardware support or dmix in your config.