Skip to content
Advertisement

python winsound.playsound unable to find my sound file

I’ve been trying to add some music to the game I’ve been making. I’ve been trying to use winsound because it allows you to stop a sound mid-way through playing. The problem is that winsound seems unable to locate my sound file.

I’ve tried using different modules such as the playsound module, which is able to play my music just fine, but winsound can’t for some reason. Unfortunately I can’t just use the playsound module for my game because it doesn’t provide a way to stop sounds midway through playing.

Here’s what I’ve tried:

JavaScript

Does anyone know why this might be?

Advertisement

Answer

For me, it works with the winsound.SND_FILENAME just like you tried, but I know that you can replace the SND_FILENAME tag with SND_ALIAS and it should work, but since the other way doesn’t work for you it is possible that it still won’t work.

So it should give you this:

JavaScript

So if it doesn’t make sure that you’ve installed the library correctly or

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement