saebekassebil/teoria — pull request #35 by saebekassebil (2013-05-09 18:51:25+00:00)
Title: Infer chords from notes

This PR is a stab at implementing a method to infer chord names from a collection of notes as discussed in #32. It implements a method `teoria.inferTriad(notes[])` that takes a list of notes, and tries to infer the triad that they constitute.

Examples:
```javascript
// What triad is constituted by a, c and e? An A minor
teoria.inferTriad([teoria.note('a'), teoria.note('c'), teoria.note('e')])
-> teoria.chord('Am')

// What triad is constituted by d, e and a#? A Dsus2#5
teoria.inferTriad([teoria.note('d'), teoria.note('e'), teoria.note('a#')])
-> teoria.chord('Dsus#5')
```

Since I'm not sure whether this is a good way of taking on the problem and I'm also somewhat unsure if this should even make it to the library, I'd like some feedback / suggestions on method and results, so please feel free to comment. Also, this only recognizes triads. Extended chords will be much more difficult because of the wealth of possible alterations.

cc'ing @quickredfox and @ecocity