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