[Tutor] Musical Pitch

kevin parks kp8 at mac.com
Tue Feb 24 03:47:26 EST 2004


Hi all.... I am here once again seeking some advice... You see i do 
lots of stuff with music (and python) and i am starting to think that 
there may be a better way of dealing with musical pitch. One problem is 
that there are a lot of different ways to represent a note and 
sometimes you want one and other times you need another representation, 
and more often than not, you need ways of moving fluidly between the 
two. So far i have just been sort of making things up as i go along, 
making huge silly lists or dictionaries. In order to spare the list 
some bandwidth i'll just post a URL showing the type of monstrous 
kludgy constructs i have been using:

http://www.people.virginia.edu/~kpp9c/pitchname.py.html

But i am wondering if maybe it is time for me to take another (possibly 
OO ? gasp!) oriented approach or just build a pitch module that i can 
import and reuse.

Here are some possible representations just to give you a taste of what 
i am up against (here i am talking 12 tone equal temperament, i have 
other tools i use for dealing with tuning ratios)

1. Old fashioned letter names : A4 (C#3, and  the like)
2. Frequencies in Hz : 440.00
3. MIDI note numbers: 69
4. Octave point pitch-class: 8.09 (middle c = 8.00, there are 12 pitch 
classes in an octave, 8.12 would = 9.00)
5. Octave point decimal : 8.75 (middle c = 8.00, but now the 
pitch-class continuum is 100/12 (8.333..) * number of half steps. An 
octave run of which would look something like this:

C    8.000000
C#    8.083335
D    8.166671
D#    8.249998
E    8.333333
F     8.416668
F#    8.500004
G    8.583331
G3    8.666666
A    8.750001
A#    8.833337
B    8.916664

So in all, 5 different representations of pitch....

Then there would be a slew of modulo 12 operations that maybe could be 
functions or methods if i decide to get fancy such as transposition, 
inversion, reducing to 1 oct range, compliment, pitch mapping.... etc.

All of which i hope to build up over time....

so... I am wondering:

1. anyone already have something like this hacked together?
2. anyone bored and want to take a whack helping me get started?
Or even just suggest some possible paths?

cheers,

kp







More information about the Tutor mailing list