Forum: music.stackexchange.com
Tags: <theory><chords><chord-progressions><chord-theory><diatonic-harmony>
Title: Looking for letter-based chord identification algorithms, and related literature
Question: I'm searching for chord recognition algorithms that will assign a chord name(s) to a group of notes, and related literature.   Sometimes known as reverse chord identification, where you feed notes to the algorithm, and it will produce a list of possible names.   An example: If we give the algorithm the notes C, E, G, the algorithm should name that group of notes as "C major triad  in root position ".

Answers:
sents: text: In addition the to answers already made, you should be aware that using the algorithmic-generated chord names can be "musically inaccurate" in the context of an harmonic analysis.
text: Depending of the context, you can have for instance BDF ("B dim") play the role of GDBF ("G Major 7").
text: If it's resolving to a C Major, you'll want to see BDF as a rootless dominant 7, not as a B diminished triad.
text: Rootless voicings is only an example : a software will have a difficult time with these little nice "implicit/ambiguous" things that make music an art :)
answer_details: author: music.stackexchange.com/users/7047/kurto
score: 3
sents: text: Perhaps you can contact the developer of "Chords"...
text: the android app that is almost, ...
text: almost...
text: all anyone ever needs in chord naming, inversions, locations on the fretboard etc. https://play.google.com/store/apps/details?id=com.rabugentom.chord&hl=en
answer_details: author: music.stackexchange.com/users/7240/kelly johnson
score: 2
sents: text: A while back I worked on a Python module that performs similar tasks.
text: Take a look at the –triadType flag.
answer_details: author: music.stackexchange.com/users/820/grimmdude
score: 2
sents: text: Lilypond is open source and has the ability to give chord names from tones.
text: So it must be somewhere in the code base.
answer_details: author: music.stackexchange.com/users/8682/Meaningful Username
score: 1
sents: text: First issue would be deciding what the root note is, otherwise as kurto says you'll get several answers for one set of note letters.
text: Would the order of the letters matter?
text: Maybe you could adopt a rule that the first letter is always the root ?
text: Assuming you tackle that somehow (or just accept several answers)
text: , you could ...
text: Assign a number to each letter (presumably you're accepting sharps and flats too?)
text: and use that to calculate the interval between the notes, in semitones eg what we calla 4th = from A to D is actually 5 semitones.
text: You could then use the intervals to match a set of known chord patterns against the root note: C E G as in your example, in semitones = 1-4-7 =
text: [rootnote] major =
text: the relative pattern for a major triad.
text: C
text: Eb G = 1-3-7 = pattern for minor chord.
text: 1-4-7-10 = Cmaj 7
text: Each time you're just reporting the root note with a comment about how the rest of the notes are arranged.
text: The limitation would be where a chord is percieved but the root note is missing - but that could be interpreted as some other chord anyway.
text: The more pattern templates you identify, the better it'll become
text: but you only need to define them relative to a root note in semitone numbers.
text: If somenthing fits noneof the patterns (perhaps you haven't set one up for chord A4) then you just write the return the root note with extra note number (not semitone number).
text: So you need a way to convert all letters (sharps and flats) to numbers =
text: a lookup table / associative array a way to identify the root note a way to identify the intervals of all letters from the root note = turn into numbers and subtract the root note number.
text: Modulus by 13 to keep it within 1 octave (or not if you want to get more advanced and handle negative intervals, for notes beneath the root note) a way to define pattern templates for known chords, with name text associated a way to compare semitone numbers to patterns (= an array comparison) a way to turn semitone intervals into note numbers (eg 5 semitones =
text: 4th note on scale) so that you can return things like A4 If you wanted to return all possibilities for a set of notes
text: then you could return the result for your routine, using each note in the chord as the root, in turn.
text: I'm thinking on my feet here
text: but I think that's how I'd go about it.
answer_details: author: music.stackexchange.com/users/7337/user2808054
score: 1

Summary of the answers:
Lilypond is open source and has the ability to give chord names from tones.
Lilypond might be suitable software to perform this task.