In a script I play a sound ( .ogg file) using /usr/bin/play. The sound is played fine, but there is an annoying delay of a couple of seconds after the sound has been played before the program (play) terminates. Why is that, and can it be fixed?

The script is a git-commit hook. It just calls play -q filename.ogg. I have the same experience from the command line.

I'm on 10.04 if that’s relevant.


There's no need to wait for the sound to be completed, right? So you could just

play file.ogg </dev/null &>/dev/null &

(or look here for more intense detaching). Also try ogg123 or mplayer instead of play, or try a different audio output.


I would attribute that to the time it takes for the application to shut down. It really depends how you wrote the script.

This might be more of scripting issue than a ubuntu one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.