This is a continuation to the issue I wanted to solved in this topic. It just went to different places so I though I will open a new topic to this problem I'm facing.
I have a pd patch that doing some audio playback reading some files from buffer. I'm running it on my Pi4.
I wanted it to start on boot every time and to be able to reset itself if crashing for some reason.
I was suggested to use that service script:
[Unit]
Description=My PureData service
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/usr/bin/puredata -nogui -open /home/pi/mypatch.pd
WorkingDirectory=/home/pi
User=pi
Group=pi
Restart=always
# Restart service after 10 seconds if service crashes
RestartSec=10
[Install]
WantedBy=multi-user.target
The above was working great using the built in 3.5mm audio jack.
I then bought UGREEN USB audio interface as I was facing with some poor audio quality at the output.
I set the audio preference in PD to choose the USB Audio Interface as the output.
When I boot the Pi I'm getting this error from the service (see picture)
If I'm typing sudo systemctl restart my_puredata.service
the PD patch is back to work just fine. No Alsa error, but on the initial boot it is not working.
Any idea why this happen when using the USB AudioInterface? anything I can do in order to make it work?
So If to conclude:
When I start the same pd patch using the same service script but without a USB audio interface is working just fine.
When I start the same pd patch with the USB audio interface but using the autostart file:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Is also working just fine.
But the combination of the USB audio interface and the service script is just not working.
Thanks for any help.