winsound.Beep() frequencies
Bengt Richter
bokr at oz.net
Tue Sep 3 20:55:57 EDT 2002
On 3 Sep 2002 13:29:23 -0700, megabytemonster at hotmail.com (Stuart) wrote:
>While looking at the python documentation, I noticed that there are no
>frequency/pitch tables for using with the winsound module. Does
>anyone know whether this documentation exists, and/or what the
>corresponding frequencies to pitches are?
>
Well, 440 hz is an A, I believe. And an octave is a factor of 2.
But I believe the best sounding scale will not have 12 equal ratios
of 2**(1/12).
Google is your friend...
http://ccrma-www.stanford.edu/CCRMA/Courses/220a/unjung/wellScale.html
(this table does appear to be based on equal ratios).
... which is easy to compute with Python:
>>> notes = 'A Bb B C Db D Eb E F Gb G Ab'.split()
>>> notes
['A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab']
>>> def noteFreq(name, oct):
... return (27.5*2**oct)*2.0**(notes.index(name)/12.)
...
>>> noteFreq('A',4)
440.0
>>> noteFreq('F',2)
174.61411571650194
>>> noteFreq('C',4)
523.25113060119725
>>> noteFreq('A',0)
27.5
>>> noteFreq('Ab',7)
6644.875161279122
Here's more. Careful, it's easy to get interested ;-)
http://www.organicdesign.org/peterson/tuning/
Regards,
Bengt Richter
More information about the Python-list
mailing list