Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a small reminder-app and want to play a system sound once the timer has reached 0. What is the easiest way to play that sound, and which sound would you recommend?

share|improve this question
up vote 14 down vote accepted

The easiest way would probably be to shell out:

system("/usr/bin/canberra-gtk-play --id='bell'")

This will work in other programming languages as well.

/usr/bin/canberra-gtk-play will play a sound from the current sound theme. See the sound naming spec for a list of available sounds and their meanings. Beware that (as far as I know) there isn't a sound theme that provides all of these sounds.

Use ls /usr/share/sounds/ubuntu/stereo to see what sounds are supported by the 'ubuntu' sound theme which is default, and rarely changed (due to no easy way to install sound themes) on Ubuntu.

share|improve this answer
Thanks! Do you have any hint on where I can find more ids? Because 'bell' does not really suit me. – Ingo Nov 3 '10 at 20:23
See updated answer. – dv3500ea Nov 3 '10 at 20:24
For safety, I recommend using subprocess. String-based execution can lead to dangerous situations. For example: import subprocess;['/usr/bin/canberra-gtk-play','--id','bell']) – Kees Cook Nov 3 '10 at 20:24
@Kees Cook, Please explain how executing the above command via system() can lead to "dangerous situations". – Cerin Mar 15 '12 at 15:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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