I think I've found a nice way to represent and build chords. At least,
at the moment it satisfy me, maybe later I'll understand how it sucks.

I'm using two separate classes: one represent a chord and is
implemented as a set of Notes; the other represents the structure
(type) of the chord and is a set of Intervals.

I can build a chord in different ways, but the general idea is that I
need a root note and a structure.

The structure isn't bound to any particular chord, because it doesn't
contain notes, but just intervals. So I can have the structure of
minor chord, of a major chord and apply them to two different notes
and build my chords.

So what is important is just the parsing of the structure. The
structure will be a string: at the moment I'm considering it space
separated, so kind of: 'min 9 no5'

I split it in a list and start from the third. I check if there's a
no3, then if there's 'min' and I put a minor third. I do the same for
the fifth. Then the first element will be the main chord structure,
because it could be a 7, a 9, a 11, a 13 and so on. I have a
dictionary with this structures, in this way:

chord_structs = {'9': ['b7', '9'], '11': ....., '13': .....}

So if the element is in the dictionary, I add the intervals listed,
else I just add the element. That's the case of the 7, or 6 etc. Then
I'll add the rest of the structure.

This is not complete or perfect, neither explained so well, but that's
the main idea.

Thanks for the help :D
bye
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to