Kodi Community Forum

Full Version: Pulseaudio or Alsa
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

This is not a typical Kodi problem (more a typical linux problem with 3 different implementations and 7 different configurations and all half backed), but perhaps someone could give me a suggestion: I'm running Kodi as a standalone application (X11, Wayland or gba, see other thread) and an additional service with a other user in background accessing microphone and sound output. Should I use Alsa and/or pulesaudio and how it shoud be configured (not how to configure it but pulseaudio as deamon or not and so on). I  don't care about multichannels and DTS and so on, just stereo audio output from both sources the same time and mic input too. I have looked at the wiki but that doesn't answer my question.
Plain Alsa just works, no need for crappy layers on top of it. You can configure other apps to use devices directly (check "aplay -l" and "aplay -L").
(2018-09-03, 17:34)P.Kosunen Wrote: [ -> ]Plain Alsa just works, no need for crappy layers on top of it. You can configure other apps to use devices directly (check "aplay -l" and "aplay -L").
 Even if there are two applications (with different users) using the same output at the same time? Because at https://kodi.wiki/view/PulseAudio is written exactly the opposite: "When would I want ALSA? - You don't need other applications that would access audio in parallel."
ALSA comes with dmix plugin for a long time now. This plugin enables playing multiple sources simultaneously. Practically anything PulseAudio can do (working on top of ALSA) plain ALSA can do. PulseAudio is, as mentioned above, a parasite layer. It can even have negative impact on performance of whole box if there is a weaker CPU, as it may be the case with Kodi frontends.

You can't ask PulseAudio or ALSA, PulseAudio can't make any sound without ALSA.
That's not true. While pulseaudio uses alsa on modern linux desktops under the hood it works nicely with wasapi on windows, with oss and others on freebsd and many more. Also it integrates bluetooth audio without a single alsa bit. Furthermore the OP wants to share audio between different users, not just one user. Pulseaudio is a soundserver providing much more comfort than pure alsa. Mixing chain, seemlessly "combined audio" output. Monitor and handling of input devices. For developers there are even more goodies: On the fly audio device switching handling, policies - and even passthrough with PT priority. Newest PA version is able to PT TrueHD and DTS-HD. The out of the box experience is very good.

Whatever: Your stereo usecase is not the problem. Sharing the device between several different users is. I am curious how you solve that in ALSA.
What apps you need for what outputs/inputs/users? If Kodi has own output without need to share it, config should be quite easy.

Edit: Plain stereo should not be too difficult in any case.
(2018-09-04, 06:45)fritsch Wrote: [ -> ]Whatever: Your stereo usecase is not the problem. Sharing the device between several different users is. I am curious how you solve that in ALSA.
Solve what? I just did 'su - anotheruser', started music player, then started a player as myself and both kept playing, resulting audio wasn't too pleasant with rock and classical mixed, but that's not the point. Shall I mention there is no parasite sound layers in my system?
And OK, if you want to split hair, PulseAudio can be used without ALSA if there is another low level driver in use like OSS4. But it cannot make any sound without.
Furthermore, all inputs and outputs provided by ALSA or OSS4 are free to use for anyone, this is not an exclusive privilege of PA sound server. For instance, I can choose what input I want just by clicking with my mouse in any GUI program like Audacity or Guvcview, same goes for outputs, I can choose what output I want without any parasite like PA involved.
And my BlueZ-5 audio works just great without PA, thank you.
Congratulations! Curious what other "parasite layers" you don't have in your system :-)
Quote:What apps you need for what outputs/inputs/users? If Kodi has own output without need to share it, config should be quite easy.
Kodi is the one (main) source for output, Google Assistant the second one for input and output.

Maybe it should be "quite easy" but I never was able to set it up. I always get errors in the direction that the resource was already in use. And now I would like to start a new try to set it up correctly and that's why I'm asking for a setup that at least could work.
I removed pulseaudio completely from my system and configured alsa according to this in /etc/asound.conf: https://wiki.ubuntuusers.de/.asoundrc/#Softwaremixing

Now it works like expected. Thank you all for your suggestions.