Disponibilidad: Windows.
Nuevo en la versión 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.
- Beep (frequency, duration)
-
Beep the PC's speaker.
The frequency parameter specifies frequency, in hertz, of the
sound, and must be in the range 37 through 32,767 (
0x25
through 0x7fff
). The duration parameter specifies the
number of milliseconds the sound should last. If the system is not
able to beep the speaker, RuntimeError is raised.
Nuevo en la versión 1.5.3.
- 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.
- SND_FILENAME
-
The sound parameter is the name of a WAV file.
- SND_ALIAS
-
The sound parameter should be interpreted as a control panel
sound association name.
- SND_LOOP
-
Play the sound repeatedly. The SND_ASYNC flag must also
be used to avoid blocking.
- SND_MEMORY
-
The sound parameter to PlaySound() is a memory
image of a WAV file.
Note: This module does not support playing from a memory
image asynchronously, so a combination of this flag and
SND_ASYNC will raise a RuntimeError.
- SND_PURGE
-
Stop playing all instances of the specified sound.
- SND_ASYNC
-
Return immediately, allowing sounds to play asynchronously.
- SND_NODEFAULT
-
If the specified sound cannot be found, do not play a default beep.
- SND_NOSTOP
-
Do not interrupt sounds currently playing.
- SND_NOWAIT
-
Return immediately if the sound driver is busy.
Ver Sobre este documento... para obtener información sobre sugerencias.