This is my current code:
import winsound as wav
wav.PlaySound("music.wav", wav.SND_LOOP | wav.SND_ASYNC)
input()
wav.PlaySound("beep.wav", wav.SND_ASYNC | wav.SND_NOSTOP)
From the python winsound documentation: "[Winsound's] interpretation [of the file] depends on the value of flags, which can be a bitwise ORed combination of the constants described below"
The music itself plays asynchronously, and loops. However, when the above code plays the beep, it throws an error (sprites.py is the code's file):
Traceback (most recent call last):
File ".../sprites.py", line 5, in <module>
wav.PlaySound("beep.wav", wav.SND_ASYNC | wav.SND_NOSTOP)
RuntimeError: Failed to play sound
Swapping SND_ASYNC and SND_NOSTOP produces an identical error, and removing the SND_NOSTOP results in the beep playing, but the music cuts out.
Why is this happening, and if it's unfixable, is there another way I can cause the beep to play without cutting off the music?
The Sound files are here, if that's important.
This question exists, however it does not appear to have an answer.