Recently, after performing the routine update in my Ubuntu system (19.10), the command /usr/bin/play cannot play from Cron anymore (works fine on the command line). It was working great before for long time.
My script (which is called periodically by cron):
#! /bin/bash
...
/usr/bin/play <path-to-soundfile> 2> /tmp/log.txt
...
I get the error
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
/usr/bin/play FAIL sox: Sorry, there is no default audio device configured
I tried other players like mplayer, aplay and cvlc, but no luck. After doing some research about the issue, I tried these lines at the beginning of my bash script:
XDG_RUNTIME_DIR=/run/user/<userid>
export DISPLAY=:0
export XAUTHORITY=/home/<username>/.Xauthority
but to no avail.
Also, I added my user to the audio group. Still no change.
Any ideas?