What is winsound.SND_ALIAS in Python?

winsound is a module in Python that enables the sound-playing mechanism in Windows systems. It includes several functions and constants, one of which is the SND_ALIAS constant.

PlaySound method

PlaySound is a built-in method of the winsound module, which allows us to play any sound. The syntax of the function is:

PlaySound(sound, flag)

The sound parameter can be a filename, audio data as a bytes-like object, or None.

The flag parameter is used to provide a value to interpret the sound.

SND_ALIAS

SND_ALIAS is one such flag used in the PlaySound function, which can be interpreted as a control panel sound association name. Following are the basic sounds supported by a Win32 system:

Sound name in PlaySound Control panel sound name
‘SystemAsterisk’ Asterisk
‘SystemExclamation’ Exclamation
‘SystemExit’ Exit Windows
‘SystemHand’ Critical Stop
‘SystemQuestion’ Question

If the sound name is not registered, the system default sound is played unless SND_NODEFAULT is specified.

Example

The following piece of code plays the windows exit sound:

import winsound
# Play Windows exit sound.
winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved