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

How to play winsound.playsound('file.wav', 0) and have the next line of code executed?

I'm trying to make a super simple adventure print("") game, and I'd like to have music in the background. This is my current code. import time import winsound winsound.PlaySound('file.wav', 0) print("Hello player! This is a simple project I'm…
Realism
  • 11
  • 1
0
votes
0 answers

python winsound.PlaySound SND_ASYNC is not working

it is not working because of the flag, which is winsound.SND_ASYNC, but there aren't any error messages. import winsound winsound.PlaySound('C:/Users/aaa/Desktop/alarm.wav', winsound.SND_FILENAME | winsound.SND_LOOP | winsound.SND_ASYNC) However,…
0
votes
1 answer

winsound.Beep is so inconsistent

So, I wrote a little script to try out what's called a "microbreak" during my work. It's pretty simple, all it does is play a sound every random time between 20-30 minutes to notify me to take a break for a random range between 30 to 60 seconds.…
0
votes
1 answer

I want to make a sound button that deletes itself and plays music, while making a new mute button and vice versa. Python-Turtle

I want to make a sound button that deletes itself and plays music, while making a new mute button and vice versa. Python-Turtle what's wrong with my code? import turtle, random, math from turtle import* from tkinter import* import winsound def…
jmin100
  • 9
  • 1
0
votes
0 answers

How can I stop my variables working, and make them work only when I want them to?

import winsound # ok1 = oktav 1 # ok2 = oktav 2 ok2C = winsound.Beep(65,500) ok2c0 = winsound.Beep(69,500) ok2D = winsound.Beep(73,500) ok2d0 = winsound.Beep(77,500) ok2E = winsound.Beep(82,500) ok2F = winsound.Beep(87,500) ok2f0 =…
0
votes
1 answer

Windows error sound plays a second time when closing the error window

I have a working python program that searches through a .pak file and modifies certain values, according to the user's choices, copies it while assigning it a name, and generates it in the directory. I'm using checkboxes for the user to select…
Basile
  • 13
  • 3
0
votes
0 answers

doing a task outside my program to avoid pausing program (pyside6) (python)

In this program I'm playing a sound when my pushbutton is clicked and then changing the label here's my code : from PySide6.QtCore import (QCoreApplication,QMetaObject, QRect, Qt) from PySide6.QtGui import (QFont) from PySide6.QtWidgets import…
0
votes
1 answer

How to run an audio and gdi effect in python without audio cutting

I made a python script that runs a GDI PATCOPY effect. I wanted to add audio while it works so I used python's winsound module for making beeps and python's Threading module to run the GDI effect and the beeping at the same time, however when I run…
SkyKrye
  • 1
  • 3
0
votes
0 answers

Please is there an equivalent for winsound on Mac?

I am trying to build a security camera which will produce a beep sound when motion is detected and I need an equivalent for win sound to produce the sound I tried installing pygame and had errors
Chrysler
  • 1
  • 1
0
votes
0 answers

Why is winsound.Beep in Python so delayed on laptop speakers?

I have an issue where the winsound.Beep function has an extremely high latency on my Windows 10 laptop speakers. It is so bad that the terminal would have completed execution of my code and then the beep sound would continue in the background(an…
LesleyH84
  • 1
  • 1
0
votes
0 answers

Why does winsound execute after Tkinter displays window when threading is applied

I amended code from a previous post from stackoverflow. It is suppose to display the window and trigger a sound after some calculation is completed. import tkinter as tk import winsound import threading class Calculate_Window: def…
Kent Choo
  • 35
  • 5
0
votes
1 answer

Winsound not playing sounds

I want to loop the sound with winsound but it doesn't work with winsound.PlaySound(song[0], winsound.SND_ASYNC + winsound.SND_LOOP and winsound.PlaySound(song[0], winsound.SND_FILENAME | winsound.SND_ASYNC + winsound.SND_LOOP The code just closes…
0
votes
0 answers

Why is the stop_ sound function not working using winsound and tkinter?

from tkinter import * import winsound from winsound import PlaySound, SND_FILENAME, SND_LOOP, SND_ASYNC root = Tk() root.configure(background='light green') def playing(): PlaySound('alarm', SND_FILENAME) def stop_sound(): PlaySound(None,…
0
votes
1 answer

winsound not playing sound

I am trying to use winsound, but it just plays the default OS sound, meaning it cant find the path. Is there something wrong with my path? I have already tried double slashes and raw…
waisinz
  • 5
  • 2
0
votes
1 answer

How to avoid audio lag using threading with OpenCV and Python?

I am implementing and alarm system with OpenCV and Python. I have the following: import cv2 import winsound import threading # Tracker and camera configuration # ... def beep(): winsound.Beep(frequency=2500, duration=1000) try: while…