winsound

Using built in Window Sounds

import winsound

winsound.PlaySound("SystemExit", winsound.SND_ALIAS)

You can change SystemExit for SystemAsterisk, SystemExclamation, SystemHand or

SystemQuestion to play different system sounds.

Note make sure you include the capital letters where they are positioned

Playing .wav sounds in the same folder as your program

import winsound

winsound.PlaySound("scream.wav", winsound.SND_FILENAME)

Make sure you place the sound file (eg scream.wav) in the same folder as your python program file.

Note don't name your program winsound.py or any import name

Create your own sounds

import winsound

winsound.Beep(1500,200) #frequency, duration

Note you need to experiment to find the best frequency and duration

Sounds in a loop

import winsound

freq=1000

for i in range(30):

winsound.Beep(freq,200) #Watch out for capital B! in Beep

freq=freq+50