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
0
votes
0 answers

Why can't python access a .mp3 file?

I have been building a game and I have been trying to add some background music for the menu. When I run the code though, all I get is a windows sound (Either notification or error sound, I don't know which) and then it just runs the rest of the…
SmartBaby
  • 11
  • 4
0
votes
0 answers

Winsound slow down python program

I want to play a beep sound when there's a face show on webcam. The program works, but it slows down when I use winsound.Beep(). Is there any other way where I can play a sound like an alarm sound when someone's face shows up without lagging? Here…
0
votes
1 answer

Why does the sound play before the rest of the code?

I want to have the block turn green and the sound play together, or if that's not possible then I would like to have the block turn green first. but I can't find out why the sound is playing first... Here is my code: def number(*args): try: x =…
LFGaming
  • 5
  • 1
  • 5
0
votes
1 answer

Program not playing sound

I am programmin a text based game in Python and I want to play effects music over the battle music, I have written the following module to play sounds #Music.py: #V2 import winsound as ws def playS(a): …
IDK
  • 1
  • 1
0
votes
0 answers

Is there a way to change the speed of printing something to match the speed of a currently playing audio file?

I am using the winsound module to play audio files from a folder, and am trying to create a transcript system for a project I am working on. But currently my process of making this is slow and is as follows: Run code: speech from audio file does…
0
votes
1 answer

Winsound causing my tkinter GUI to open slowly

I'm working on a tkinter GUI in Python to produce error messages in a new window. When running the code as shown below, the error noise plays, then it pauses for several seconds before opening the window. If I comment out the line with winsound, it…
csulli245
  • 140
  • 7
0
votes
1 answer

How to pause song winsound with tkinter buttons?

I'm trying to make a music interface using tkinter and winsound, but when I press the button to play the song I can't click anything in the interface again until the song has finished playing. I'd like to be able to play and pause every song using…
0
votes
1 answer

Can I include music in my python game inside the code?

I want to use the winsound module in my text-based python game to play some background music, however I don't want the user to have to put the music files in the same folder as the game just to play it. Is there any way I can include the music in…
Amber Cahill
  • 106
  • 8
0
votes
0 answers

Python play sound if pixel on screen

I'm trying to make a script using the winsound, keyboard, and pyautogui modules. I want it to play when a pixel at the dedicated coordinates on screen is white and when the quit key (q) isn't pressed. Here is what I've tried while…
Mitchell
  • 27
  • 4
0
votes
1 answer

How can i print and play sound at the same time? (winsound)

I'm trying to make a morse code machine that plays the beep and then prints the morse code. Instead, it plays all the sounds and only then prints the message. pls help. code: (lettr2morse is a dictionary that has letters turned into morse) …
namnam
  • 19
  • 2
0
votes
0 answers

Using opencv to detect faces and play music at the same time

I wrote a program that will play a warning sound when a face is detected (play audio file) However, the sound file will always start playing after 10 ~ 30 seconds when the detection condition is triggered. And if it is removed from the conditional…
0
votes
2 answers

How to play different sound consecutively and asynchronously?

To be specific, I need to play sound in a while loop which is fast to execute. And the audio needs to be played separately. I've tried various functions/libraries: playsound, winsound, vlc. But none of them meet my demand. Either the sounds are…
Dean Chong
  • 25
  • 1
  • 6
0
votes
1 answer

Can't play the rest of the code when using winsound

I am writing a simple game but when I try to use the winsound command to play some music, it will play it but everything after it doesn't work. I tried to put it in the end but then the music starts when I quit the game.
Eliaz
  • 28
  • 2
0
votes
2 answers

Playing random wav files with winsound issue

I am pretty new to Python. I've been trying to make a sciript that plays random WAV files from a specific folder whenever run. if I try a single wav file it works all fine but doesn't work with random/file. I have tried pygame and some other modules…
Jeager
  • 1
0
votes
3 answers

Iteration in dict and string with function of 2 variables

In order to play a note, we need to know its frequency and how long it should play. To do this, in exercise I have the following two variables: A dictionary called freqs where the keys are strings representing a character name and the values ​​are…