Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A computer scientist is someone who fixes things that aren't broken.


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

SubjectAuthor
* Re: Regarding inability of Python Module Winsound to produce beep inChris Angelico
`- Re: Regarding inability of Python Module Winsound to produce beep injak

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

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Regarding inability of Python Module Winsound to produce beep in
decimal frequency
Date: Sat, 14 Aug 2021 02:17:05 +1000
Lines: 31
Message-ID: <mailman.381.1628871438.4164.python-list@python.org>
References: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
<sf644o$14e0$1@ciao.gmane.io>
<CAPTjJmqwz0Rjin9Xj-Lskj8TxUOu=Pxfk2ZgLpkDk7r6z-ef7g@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 0phiWAiph20+K5KJaXh6NAe5DKjQl+ao111iWa3dvLQA==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=ZTo0Bhaj;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04;
'traceback': 0.04; '(most': 0.05; 'error:': 0.05; 'last):': 0.05;
'float': 0.07; 'aug': 0.09; 'terry': 0.09; 'typeerror:': 0.09;
'subject:Python': 0.12; 'problem': 0.15; 'chrisa': 0.16;
'decimal': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'instruments.': 0.16; 'integer': 0.16;
'subject:Module': 0.16; 'subject:frequency': 0.16; 'using.': 0.16;
'wrote:': 0.16; 'python': 0.16; 'developer': 0.17; 'automation':
0.20; 'round': 0.23; 'sat,': 0.23; 'to:addr:python-list': 0.23;
'project.': 0.24; 'student': 0.24; 'notes': 0.27; 'function':
0.28; 'am,': 0.31; 'to:name:python': 0.32; 'message-
id:@mail.gmail.com': 0.33; 'program': 0.33; 'using': 0.33;
'received:209.85.166': 0.33; 'header:In-Reply-To:1': 0.33;
'received:google.com': 0.34; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'received:209.85': 0.38; 'file':
0.38; "it's": 0.38; 'received:209': 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; 'hope': 0.61; 'thus': 0.65;
'skip:w 20': 0.65; 'future': 0.67; 'changing': 0.69; 'shows':
0.70; 'accuracy': 0.71; '2021': 0.84; 'itself.': 0.84; 'musical':
0.84; 'parts.': 0.84; 'quality,': 0.84; 'frequency': 0.91;
'subject:Regarding': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=PlVSAPoKbmDvfD+5cnuaFx8+pI3715XH/6JIzpEN0Nk=;
b=ZTo0Bhaj0Xkc07fGX8Oqo91j/3jSec6FCPxsknCKT0P2K+G60hYfN53kEJTRlNupZ5
k20j2Q653+LJxRyQoYKKR1Gcvl9/ZttpDfLf+Dt1eBfRj1rtdA1Q20Qa3YscvKQqHlYX
MgRgswVzfuWXdtvnQm9Dzgx3eCunE6iE3KgN3WgS3ceLkzGgCdKfKz0Cda/f6nrisSeV
Q2qwi8lyD/NxGFMGZwImWUqNEf3MgTf4/14cUUjY0nncKS1XmrpkbZxhTxzPC5gSSFiI
FDpzKAFvCiOy0huWQjJ3mKG/lg9gkW9R6BkWalWu8eIcYSi0+JMek49EmTXd6c1XBta6
x4ag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=PlVSAPoKbmDvfD+5cnuaFx8+pI3715XH/6JIzpEN0Nk=;
b=eRxp8H00vLkyaZfvIhii9ABxAGb+fOXJHthTS5/0wNbKdtmqYoWG5vi9psObAQo0Pj
7849KYj2vt73I8LRk+VVVj6IeTT6JsNuUV3AKnadOTnpikhO5zFnQ30w2GpRpEyB8j16
apChs2fpPjDNm1Shua0o5OgoH5recXO9pcpYSRsNXk59k36Jaa9TUSEWsNKGXCWpN4Hq
7lxdhBjpb/QJ9TeGoPnlkUuTv4NSbDlNF1c1fYq8u2xXXUpCQWaAxwmVF/rrVrtIYNB8
RwqJ7u7L5DvLl7m9mfuQr/9KDNk1XrVCHwg/s6SamvuYvT5YZq8thzhBD/Ic43q3GxvJ
8Hyg==
X-Gm-Message-State: AOAM5339MuH62ZLuJewhAbMRWR9HHz7edDkQKTruTawDEB9/UNFRlAqa
Q8twxOx9v+5LkArAidoDPJpb2tLfEzU+c2ab0a3J29KS
X-Google-Smtp-Source: ABdhPJx1yofw+PHtQNm+kuOFsrIfS17mBolAEqdPE2o9PYEi3ZVHVD7hvWSRcII4Vn+RzXPUrDEZik+yHIdjWt9VU/4=
X-Received: by 2002:a02:2a07:: with SMTP id w7mr3051117jaw.96.1628871436229;
Fri, 13 Aug 2021 09:17:16 -0700 (PDT)
In-Reply-To: <sf644o$14e0$1@ciao.gmane.io>
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: <CAPTjJmqwz0Rjin9Xj-Lskj8TxUOu=Pxfk2ZgLpkDk7r6z-ef7g@mail.gmail.com>
X-Mailman-Original-References: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
<sf644o$14e0$1@ciao.gmane.io>
 by: Chris Angelico - Fri, 13 Aug 2021 16:17 UTC

On Sat, Aug 14, 2021 at 2:11 AM Terry Reedy <tjreedy@udel.edu> wrote:
>
> 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.
> >

Is it really? In my experience, no human ear can distinguish 277Hz
from 277.1826Hz when it's played on a one-bit PC speaker, which the
Beep function will be using.

ChrisA

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

<sfaj16$1oqh$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!f3Ja+IUlF3LLNCdyvqay1w.user.46.165.242.91.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.python
Subject: Re: Regarding inability of Python Module Winsound to produce beep in
decimal frequency
Date: Sun, 15 Aug 2021 10:25:07 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sfaj16$1oqh$1@gioia.aioe.org>
References: <CAGnkz7FtQ5krADv6Z67eZFk1Cx+9dA6-FYd39L9jm9aQn33x4g@mail.gmail.com>
<sf644o$14e0$1@ciao.gmane.io>
<CAPTjJmqwz0Rjin9Xj-Lskj8TxUOu=Pxfk2ZgLpkDk7r6z-ef7g@mail.gmail.com>
<mailman.381.1628871438.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="58193"; posting-host="f3Ja+IUlF3LLNCdyvqay1w.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: it
X-Notice: Filtered by postfilter v. 0.9.2
 by: jak - Sun, 15 Aug 2021 08:25 UTC

Il 13/08/2021 18:17, Chris Angelico ha scritto:
> On Sat, Aug 14, 2021 at 2:11 AM Terry Reedy <tjreedy@udel.edu> wrote:
>>
>> 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.
>>>
>
> Is it really? In my experience, no human ear can distinguish 277Hz
> from 277.1826Hz when it's played on a one-bit PC speaker, which the
> Beep function will be using.
>
> ChrisA
>

Hi,
you could use a trick to get a better approximation:
277 * 4 = 1108
278 * 1 = 278
1108 + 278 = 1386
1386/5 = 277.2
now, respecting the duration of the tone, in accordance with its simple
rate, the buffer to be played will become:
277, 277, 277, 277, 278, 277,
277, 277, 277, 278, 277, 277,
.... and so on.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor