[Tutor] Regarding inability of Python Module Winsound to produce beep in decimal frequency

Umang Goswami go.umang108 at gmail.com
Fri Aug 13 06:53:52 EDT 2021


Hi There, Hope you find this mail in good health.

I am Umang Goswami, a Python developer and student working on a huge
project for automation of music instruments. I am producing the musical
notes using the Beep function of Winsound Module(
https://docs.python.org/3/library/winsound.html) by passing frequency as a
argument to the function.

Now whenever i provide frequency of any note in decimal(for example
277.1826 for C4 note) it shows following error:
Traceback (most recent call last):
  File "C:\Users\Umang Goswami\Desktop\Umang  Goswami\test.py", line 2, in
<module>
    winsound.Beep(111.11,111111)
TypeError: integer argument expected, got float

Now I have  to round up the frequencies. This is hurting the quality,
accuracy ,authenticity and future of the project. Almost all the notes have
the frequencies  in decimal parts. Rounding up means changing semitones and
quatertones thus whole note itself. This problem is technically making my
program useless.

Its my humble request to you all, I beg you, Please tell me how to overcome
this issue. I have consulted many sources both online and offline but I
remained unsatisfied. I can not make audio files of each note because there
are many many notes and so practically making so many files of different
time length wont help.

Please suggest to me the way to resolve this issue or is there any other
module to produce the sound of decimal frequency.

Waiting in your reply,

Umang Goswami


More information about the Tutor mailing list