Reputation: 1279
I have a program that I would like to play a set frequency sound from constantly without gaps until I tell it to stop. I have seen this answer but this requires an external module (I am working in an offline environment so this is not possible).
Also, this answer is also not very practical as it will have playback gaps (creating the file is possible though). I hope what I am asking for is not impossible but I have a feeling it is.
Thanks in advance.
Upvotes: 0
Views: 335
Reputation: 4964
I am sure I have made that from an stdlib module, just don't remember how or in what platform. But this looks pretty much what you want (for windows, at least), , from the python help:
winsound.Beep(frequency, duration)
Beep the PC’s speaker. The frequency parameter specifies frequency,
in hertz, of the sound, and must be in the range 37 through 32,767.
The duration parameter specifies the number of milliseconds the sound
should last.
If the system is not able to beep the speaker, RuntimeError is raised.
Upvotes: 1