Availability: Windows.
New in version 1.5.2.
The winsound module provides access to the basic sound-playing machinery provided by Windows platforms. It includes two functions and several constants.
None
. Its interpretation depends on the
value of flags, which can be a bit-wise ORed combination of
the constants described below. If the system indicates an error,
RuntimeError is raised.
All Win32 systems support at least the following; most systems support many more:
PlaySound() name | Corresponding Control Panel Sound name |
---|---|
'SystemAsterisk' |
Asterisk |
'SystemExclamation' |
Exclamation |
'SystemExit' |
Exit Windows |
'SystemHand' |
Critical Stop |
'SystemQuestion' |
Question |
For example:
import winsound # Play Windows exit sound. winsound.PlaySound("SystemExit", winsound.SND_ALIAS) # Probably play Windows default sound, if any is registered (because # "*" probably isn't the registered name of any sound). winsound.PlaySound("*", winsound.SND_ALIAS)
Note: This module does not support playing from a memory image asynchronously, so a combination of this flag and SND_ASYNC will raise RuntimeError.
See About this document... for information on suggesting changes.