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:
#testing if winsound functions
import winsound
import playsound
#The file I want to play, test1.wav, is saved in the same folder as this file.
#Playing the sound using playsound, using a local directory
playsound.playsound('test1.wav')
#this works and plays the sound as intended
#Playing the sound using playsound, using a global directory
playsound.playsound(r'C:\Users\61490\Documents\Python\pano tiles\test1.wav')
#this also works and plays the sound as intended
#Playing the sound using winsound, using a local directory
winsound.PlaySound('test1.wav', winsound.SND_FILENAME)
#This only plays the windows default error sound
#Playing the sound using winsound, using a global directory
winsound.PlaySound(r'C:\Users\61490\Documents\Python\pano tiles\test1.wav', winsound.SND_FILENAME)
#This also only plays the windows default error sound
Does anyone know why this might be?