There is an application that plays sounds. After setting up the /etc/asound.conf file in which the priorities of the sound cards are assigned, everything happens as it should, I run the application from the user, the sound goes to the external card.

The problem is that I need to run this program as a service, for this I registered it in systemd. Everything is OK, the application starts when raspberry is turned on, but the sound goes to the internal sound card.

A little later, I realized that the problem is precisely that when launching from the root, for example through sudo, the sound goes to the inside.

How to make it so that the sound from the root goes where necessary?

I use the https://blokas.io/patchbox-os distribution

  • So do not run from the superuser, business something! - 0andriy
  • @digital_tutorials The problem is not that “from the root”, but that root and the ordinary user have different software environments. And the root ENV lacks something that the average user has. Tip: run the env command from as a regular user and as root . See what the difference is about alsa. Add the missing ENV variables to the script that runs your application as root . I think everything will work fine. - Sergey
  • yes most likely plays from the user through a pulsaudio. Start the pulsaudio from the root - eri
  • but in general I will pound such services in systemd / user - eri

1 answer 1

It was necessary to switch the output of the application to alsa .

In my case, the pd -alsa .

Alsa, as it turned out, runs with the system, and jack , which went by default, started with the user.