The costrunction of a chord is based on a root note and a structure,
so by default, giving just a note, it creates a major chord adding the
third and fifth note.

Quite some time ago I wrote something to solve the reverse problem: given a list of note names, find out a chord name. (http://chordrecognizer.sourceforge.net/ )

I used a look-up table to made a correspondence between the chord-name and the notes from which the chord is built. The notes are expressed as
a distance from the root note.

E.g. starting from a chromatic scale built on C, the distances would be:
C:0  C#:1  D:2  D#:3  E:4  F:5  F#:6  G:7  G#:8  A:9  A#:10  B:11
(and similar for flats, double sharps and double flats, ...)

Any chord thus can be constructed from a root note + the distance information.

example distance information:

 { 'm' : [ 0, 3, 7 ],    # minor triad
   ''  : [ 0, 4, 7 ],    # major triad
   '7' : [ 0, 4, 7, 10]  # etc...
...
 }

How does one e.g. construct the E7 chord from this information?

1. generate the chromatic scale starting from E, and annotate with note distance to root note:

E:0  F:1  F#:2  G:3  G#:4  A:5  A#:6  B:7  C:8  C#:9  D:10  D#:11

2. take the recipe for a '7' chord from the distance information:
[0, 4, 7, 10]

3. map the numbers from step 2. to the note names from step 1.: E G# B D

If you care about proper enharmonic spelling of the chord's note names (i.e. do not confuse F# and Gb), you will need to add some extra information in the look-up tables or you need to pass extra information to the chord construction recipe at the moment of creating a chord, but that is left as an excercise to you - the interested reader ;)

HTH,
Stefaan.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to