9

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".

3
  • 1
    Are you looking for something more than the answers you got on this SO question?
    – Ben Miller
    Commented Oct 18, 2013 at 15:24
  • @BenMiller Yes I am. I'm specially interested in methodology and/or literature and/or research on the subject. I'm also interested in the input from musicologists, in contrast with the input of software engineers that SO provides. Commented Oct 18, 2013 at 16:03
  • Also, take a look at <music.stackexchange.com/a/86992/49789>. These posts provide workable solutions. Commented Jul 21, 2019 at 0:56

5 Answers 5

1

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.

Would the order of the letters matter? Maybe you could adopt a rule that the first letter is always the root ?

Assuming you tackle that somehow (or just accept several answers), you could ...

Assign a number to each letter (presumably you're accepting sharps and flats too?) 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.

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 = 0-4-7 = [rootnote] major = the relative pattern for a major triad.

C Eb G = 0-3-7 = pattern for minor chord.

0-4-7-10 = Cmaj 7

Each time you're just reporting the root note with a comment about how the rest of the notes are arranged. 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.

The more pattern templates you identify, the better it'll become but you only need to define them relative to a root note in semitone numbers.

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).

So you need

  • a way to convert all letters (sharps and flats) to numbers = 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. Modulus by 12 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 = 4th note on scale) so that you can return things like A4

If you wanted to return all possibilities for a set of notes then you could return the result for your routine, using each note in the chord as the root, in turn.

I'm thinking on my feet here but I think that's how I'd go about it.

0
3

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.

Depending of the context, you can have for instance BDF ("B dim") play the role of GDBF ("G Major 7"). 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.

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 :)

1
  • "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": why? The normal resolution of viiº is to the tonic chord.
    – phoog
    Commented Apr 17, 2023 at 6:08
2

Perhaps you can contact the developer of "Chords"... the android app that is almost, ...almost... 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

2

A while back I worked on a Python module that performs similar tasks.

Take a look at the –triadType flag.

2

Lilypond is open source and has the ability to give chord names from tones. So it must be somewhere in the code base.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.