18.2 winsound -- Sound-playing interface for Windows

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 a single function and several constants.

PlaySound (sound, flags)
Call the underlying PlaySound() function from the Platform API. The sound parameter may be a filename, audio data as a string, or 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.

The sound parameter is the name of a WAV file.

The sound parameter should be interpreted as a control panel sound association name.

Play the sound repeatedly. The SND_ASYNC flag must also be used to avoid blocking.

The sound parameter to PlaySound() is a memory image of a WAV file.

Note: This module does not support playing from a memory image asynchonously, so a combination of this flag and SND_ASYNC will raise a RuntimeError.

Stop playing all instances of the specified sound.

Return immediately, allowing sounds to play asynchronously.

If the specified sound cannot be found, do not play a default beep.

Do not interrupt sounds currently playing.

Return immediately if the sound driver is busy.

Send comments on this document to python-docs@python.org.