Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

But what can you do with it? -- ubiquitous cry from Linux-user partner


devel / comp.lang.python / Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

SubjectAuthor
o Re: Regarding inability of Python Module Winsound to produce beep inTerry Reedy

1
Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

<mailman.380.1628870990.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14590&group=comp.lang.python#14590

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: tjre...@udel.edu (Terry Reedy)
Newsgroups: comp.lang.python
Subject: Re: Regarding inability of Python Module Winsound to produce beep in
decimal frequency
Date: Fri, 13 Aug 2021 11:46:30 -0400
Lines: 46
Message-ID: <mailman.380.1628870990.4164.python-list@python.org>
References: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
<sf644o$14e0$1@ciao.gmane.io>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 54wTfUDcvVLLhOD2wPPLIAn6tH8QCHe2Z52hrgGwoEgQ==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04;
'traceback': 0.04; '(most': 0.05; 'error:': 0.05; 'issue.': 0.05;
'last):': 0.05; 'pygame': 0.05; 'pypi': 0.05; 'float': 0.07;
'message-id:@ciao.gmane.io': 0.09; 'received:ciao.gmane.io': 0.09;
'received:gmane.io': 0.09; 'received:list': 0.09; 'terry': 0.09;
'typeerror:': 0.09; 'subject:Python': 0.12; 'cc:no real
name:2**0': 0.13; 'problem': 0.15; 'add-in': 0.16; 'builtin':
0.16; 'cc:addr:tutor': 0.16; 'consulted': 0.16; 'decimal': 0.16;
'frequencies,': 0.16; 'from:addr:udel.edu': 0.16; 'generates':
0.16; 'instruments.': 0.16; 'integer': 0.16; 'practically': 0.16;
'received:116.202': 0.16; 'received:116.202.254': 0.16;
'received:116.202.254.214': 0.16; 'stuck': 0.16; 'subject:Module':
0.16; 'subject:frequency': 0.16; 'wrote:': 0.16; 'python': 0.16;
'developer': 0.17; 'cc:addr:python.org': 0.19; 'all,': 0.19;
'automation': 0.20; 'issue': 0.20; 'interface': 0.23; 'round':
0.23; 'anyone': 0.23; 'to:addr:python-list': 0.23; 'help.': 0.24;
'project.': 0.24; 'anything': 0.24; 'student': 0.24; 'suggest':
0.25; 'cc:2**0': 0.27; 'length': 0.27; 'notes': 0.27; 'suspect':
0.27; 'function': 0.28; 'module': 0.28; 'header:User-Agent:1':
0.31; 'there': 0.31; 'sfxlen:2': 0.31; 'but': 0.31; 'am,': 0.31;
'hardware': 0.31; 'looked': 0.31; 'do.': 0.32; 'resolve': 0.32;
'program': 0.33; 'using': 0.33; 'unless': 0.33; 'header:In-Reply-
To:1': 0.33; 'files': 0.33; 'functions': 0.34; 'following': 0.35;
'request': 0.35; 'windows': 0.36; 'way': 0.37; 'file': 0.38; 'url-
ip:151.101.36.223/32': 0.38; 'url-ip:151.101.36/24': 0.38;
'means': 0.40; 'example': 0.40; 'could': 0.40; 'search': 0.61;
'hope': 0.61; 'online': 0.62; 'thus': 0.65; 'skip:w 20': 0.65;
'look': 0.66; 'future': 0.67; 'produce': 0.69; 'changing': 0.69;
'generator': 0.69; 'shows': 0.70; 'audio': 0.71; 'received:116':
0.71; 'accuracy': 0.71; 'knowing': 0.71; 'sources': 0.75; 'card':
0.77; 'beg': 0.84; 'integral': 0.84; 'itself.': 0.84; 'musical':
0.84; 'parts.': 0.84; 'quality,': 0.84; 'remained': 0.84;
'frequency': 0.91; 'subject:Regarding': 0.95
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
Content-Language: en-US
X-Mailman-Approved-At: Fri, 13 Aug 2021 12:09:49 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <sf644o$14e0$1@ciao.gmane.io>
X-Mailman-Original-References: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
 by: Terry Reedy - Fri, 13 Aug 2021 15:46 UTC

On 8/13/2021 6:53 AM, Umang Goswami wrote:
> 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.

Without knowing what sources you have already looked at, anything anyone
might say might be duplication. However,...

If the builtin hardware sound generator only generates integral
frequencies, you are stuck unless you get an add-in card that is more
flexible. If the Windows interface to the hardware only accepts
integral frequencies, which I suspect might be true, ditto, unless you
get custom software. You could look at pygame and see what its sound
functions do. And search pypi for 'sound generator' or 'frequency
generator'.

--
Terry Jan Reedy

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor