2

I am trying to play background music through winsound, but even though I put in

winsound.SND_LOOP

It still wasn't looping, just playing once. My code is as follows

import winsound
import os
os.chdir('C:\\Users\\Travis\\Downloads')
winsound.PlaySound('SS.wav',winsound.SND_LOOP)
allan.simon
  • 3,886
  • 6
  • 35
  • 60
Travis
  • 163
  • 1
  • 3
  • 17

1 Answers1

4

You need to use:

winsound.PlaySound('C:/Windows/Media/notify.wav', winsound.SND_LOOP + winsound.SND_ASYNC)

This will loop the sound until the program closes.

EgMusic
  • 136
  • 17
  • I can't play the sound without SND_FILENAME. After putting SND_ASYNC in, my program terminate right away. –  May 23 '20 at 13:26