Questions tagged [winsound]

Use this tag for questions related to winsound module.

The winsound is a python module for playing sound on Windows. This API allow python script to invoke Windows system sound (e.g. SystemExit) and external wav files or memory stream.

79 questions
4
votes
1 answer

Is there any way to pause music using winsound?

I was programming a game and want to pause the music at certain positions for dramatic effect. The reason I can't just use winsound.PlaySound(None, winsound.SND_ALIAS) is because if I do so when I call the function and try to resume my music, the…
Richard Su
  • 343
  • 1
  • 2
  • 10
4
votes
2 answers

Python winsound, ASYNC flag not working?

I'm using python 3.5 and I'm trying to play a sound while continuing right away with my script; according to https://docs.python.org/3.5/library/winsound.html the flag "winsound.SND_ASYNC" should be the way to go. However the following doesn't…
Alex Stamate
  • 41
  • 1
  • 3
2
votes
1 answer

Why is winsound.PlaySound not playing the sound from the specified file?

I made a Morse code translator which works fine. Then I wanted to make beep sounds corresponding to the encoded message. I tried the winsound module. But it isn't playing any sound. I collected the dots and dashes sound from an online Morse Code…
2
votes
2 answers

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
x17
  • 27
  • 3
2
votes
1 answer

How do I save a winsound.Beep() to an audio .wav file in python?

I've been trying to do something that I thought would be fairly simple, and that si to save winsound.Beep(8000,1000) to a .wav file called LongBeep.wav . Can someone pls reply with a solution. I have searched and searched for an answer but have…
Magnolia
  • 21
  • 1
2
votes
0 answers

winsound in python - low latency on monitor, high latency on laptop why?

I am using winsound to play a short sound frequency = 800 duration = 10 winsound.Beep(frequency, duration) The code is in an endless loop in a condition. If the condition is True, the sound plays. I am on Windows 10. Everything works well, if I…
P Wolf
  • 21
  • 2
2
votes
1 answer

Playing a sound continuously with winsound and stop it with a button click

I'm trying to work with winsound in Python 3. To start the sound I do it like this: play = lambda: PlaySound('Sound.wav', SND_FILENAME) play() This only plays the sound one time, but I want to loop it. Is there a built in function to loop the…
Kevin.a
  • 4,094
  • 8
  • 46
  • 82
2
votes
1 answer

Playing sound loops through winsound python

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…
Travis
  • 163
  • 1
  • 3
  • 17
1
vote
1 answer

How do I write sound files in python using wave?

I am trying to make a text-to-sound-file converter with python, it reads the binary data of an input and writes a sound file that matches the data. 1 is a higher note (440 hz) and 0 is a lower note(330 hz). I have tried so many different things and…
HSRM15
  • 11
  • 1
1
vote
2 answers

How to stop triggering the key while holding the key in pynput?

I am using the pynput and winsound modules to make a program that makes the pc play the sound of the keys and mouse. The problem is that when I press a key and hold it down the key is triggered repeatedly, which causes the sound to play repeatedly…
edif
  • 105
  • 1
  • 9
1
vote
1 answer

Need help exporting game that plays sound file

I was making a Tetris-like game, and I would like my friends to try it so I'm going to export it as an .exe file, but I'm playing the track in the background this way: winsound.PlaySound('C:/Users/User/folder/project/tetris/tetrismusic.wav', …
Mr. Goose
  • 11
  • 1
1
vote
1 answer

Music suddenly stops playing while using winsound in python script

I have a computer project where I am using tkinter to make a GUI application. The user has the option to either switch on or switch off the music through radiobuttons in the window. I made the below code so that you guys can replicate it and try it…
1
vote
0 answers

Continuous background music with winsound module

So, I have been working on this game called Space Invader. Everything is doing great except for one thing which is the sound. As in the below code, I've imported winsound module and it is not doing well. When I fire the bullet it makes the fire…
HaRrY
  • 13
  • 3
1
vote
2 answers

Python SimpleHTTPRequestHandler to play sound async

I can't figure out how to make this small http server reply the get request and play a sound in parallel. Current code, does not close the get request until the sound "winsound.PlaySound("SystemExit", winsound.SND_ALIAS)" end playing. What i need is…
Uniextra
  • 133
  • 3
  • 17
1
vote
1 answer

python winsound.playsound unable to find my sound file

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…
Matthew B
  • 358
  • 2
  • 11
1
2 3 4 5 6