I have a python script that plays a
.wav file on the speakers.
from playsound import playsound playsound('a.wav')
This works correctly if I execute the script on my local machine.
However, if I push the script on my remote Raspberry PI (along with the
.wav file) and execute it through an SSH session, the sound doesn't come out of the speaker plugged on the Raspberry PI.
I already had some question related, when I needed to open the web browser on the remote Raspberry PI device, but it doesn't seem to fix it.
DISPLAY=:0 python3 my_script.py
None of them do play the file on the raspberry PI's speakers.
omxplayer a.wav does play the file on the remote speakers properly. But I do not want to call a 'shell' command for that, I'd like this to be done through a python script.