x17
x17

Reputation: 27

im trying to use winsound to play wav file ONCE

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

Upvotes: 2

Views: 248

Answers (2)

Michalor
Michalor

Reputation: 377

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

Upvotes: 1

med benzekri
med benzekri

Reputation: 603

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)

Upvotes: 0

Related Questions