2

heres my code

import winsound
winsound.PlaySound('filename.wav',winsound.SND_LOOP)

i want to play it ONCE not in a loop. i tried removing

SND_LOOP

but it didnt work

x17
  • 27
  • 3

2 Answers2

1

Just don't use the winsound.SND_LOOP flag. Use 0 or winsound.SND_ASYNC flag instead.

import winsound
winsound.PlaySound('filename.wav',0)

Documentation

Michalor
  • 363
  • 3
  • 14
0

i don't have windows os to test it but according to the docs try this :

import winsound
winsound.PlaySound('filename.wav',winsound.SND_FILENAME)
med benzekri
  • 490
  • 6
  • 19