I am experimenting with audio players in the command line, and noticed something weird: if the sound is very short, most players will take up to a second or two after playback has finished, before they finally exit, and yield control back to the terminal!
ffplay seems to run a spectrogram when started with an audio file, and the advice to fix that is:
<hypnocat> how can i turn off the spectrogram display? <sacarasc_> Why would you want to? <hypnocat> i don't want an extra window to appear, or for ffplay to waste extra processing power displaying it <hypnocat> it's distracting, annoying, and wasteful <sacarasc_> Minimise it, and if it's wasteful, your computer is either really, really old or you're overly sensitive to waste... <hypnocat> my computer is old
... so I wouldn't really count that as a command line player; but I've tried these commands on my Ubuntu 11.04's
aplay --buffer-size=10 -q /usr/share/sounds/speech-dispatcher/test.wav canberra-gtk-play -c never -f /usr/share/sounds/speech-dispatcher/test.wav mplayer -really-quiet /usr/share/sounds/speech-dispatcher/test.wav pacat -p --rate 16000 --channels 1 --latency-msec=1 --process-time-msec=2 /usr/share/sounds/speech-dispatcher/test.wav play -q /usr/share/sounds/speech-dispatcher/test.wav # with sox
speech-dispatcher/test.wav sound itself is 0.542 sec, yet these programs claim the terminal for about one or two seconds (or more) after that file has finished playing. Why does this happen - and how could I avoid that? If it is impossible for these applications, are there command line audio players in existence, which do exit immediately after an audio file has finished playing?
EDIT: for those interested, this is what I needed this for Question #208391 : Questions : “xorg” package : Ubuntu: Getting X11 XBell event to play through PulseAudio; and I worked around the waiting time issue by starting the player (in that case,
canberra-gtk-play) as a process (with
&). But I'd still like to know why this exit delay happens on short files? And how come
cvlc, as per @Anthon's answer, can for instance exit immediately??