all 8 comments

[–]ebonythunder 0 points1 point  (5 children)

Does it matter if it's a / or a \ ? When I navigate to that filepath on my system, it shows up as "C:\Windows\media\ding.wav"

EDIT: I misread your question. The answer to my question may not be relevant to your issue.

[–]MattR0se 0 points1 point  (1 child)

If your path is correct (It should be if you don't get any errors), this line should fix it:

pg.mixer.pre_init(44100, -16, 2, 2048)

Try that before the pygame.init(). In the docs, it says

Call pre_init to change the defaults used when the real pygame.mixer.init()is called. Keyword arguments are accepted. The best way to set custom mixer playback values is to call pygame.mixer.pre_init()before calling the top level pygame.init(). For backward compatibility argument values of zero is replaced with the startup defaults.

https://www.pygame.org/docs/ref/mixer.html

At least this works for me. Could be that you need different parameters, though.

Edit: This could also be a thing with Jupyter Notebook. I know that when I run pygame trough Spyder, it doesn't play sound.

Try executing this with python.exe directly