saebekassebil / teoria

Javascript taught Music Theory
http://saebekassebil.github.io/teoria
MIT License
1.32k stars 114 forks source link

Infer chords from notes #35

Closed saebekassebil closed 11 years ago

saebekassebil commented 11 years ago

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:

// 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

saebekassebil commented 11 years ago

This will not make it to the library. Instead I've factored this code out into its own library, which I'll hopefully release soon.

saebekassebil commented 11 years ago

I've release più which deals with inferring/recognizing chords from collections of notes.