0

Currently I have the following.

import winsound


winsound.Beep(1000, 1000)

And it works. But it does appear to sleep the thread. In the program I'm developing, sleeping the main thread will be a big no no. I could multi-thread it, but only as a last resort. Does anyone have any other ways to generate tones on Windows?

Turret
  • 133
  • 8
  • Welcome to StackOverflow. How about pyaudio? Take a look at https://stackoverflow.com/questions/9770073/sound-generation-synthesis-with-python for example. – rajah9 Nov 19 '20 at 13:06
  • PyAudio isn't seeming to want to install on this system. It errors out with exit status 1 when I install it. – Turret Nov 19 '20 at 16:58

1 Answers1

0

You can beep in another thread as simple as that:

import threading
import winsound

threading.Thread(
    target=lambda: winsound.Beep(1000, 1000)
).start()
viilpe
  • 767
  • 1
  • 5
  • 10