How can I play a system sound with Python?
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?
The easiest way would probably be to shell out:
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 freedesktop.org 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.
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.
The following works in Linux and MacOS (haven’t tried Windows):