I've been searching for some information regarding reverse chord lookup and various libraries that might help me with some software I'm writing. I've tried tonal.js and various other JS music theory libraries, and the one that was most consistent with inversions and the like was music21 (python, not JS port). A majority of the libraries I've found had a lot of trouble recognizing a minor 7th chord in 3rd inversion (C D F A for example), but music21 had no issues. Only problem thus far is that it struggles with some of the more basic things like a basic voicing of a 6th chord (D F# A B for example) - it interprets that as a Bm7 even though a 6 chord is the 'easier' avenue.


That top part is just for context and my motivations in asking this: is there a dictionary (JSON format would be nice, I can make one if I find the right resources) with a chord and all possible voicings, from most to least likely? Something like a D6/9 chord could just be R 3 5 6 9, but could be voiced much nicer as a stack of 5ths (tonal.js has no idea what chord I'm playing and music21 interprets it as a B major pentatonic scale). Similarly, a D6 chord in first inversion is output as a Bm7 chord. This may be true, but it would be nice to have possibilities in the output.

In lieu of this, perhaps a simple algorithm that would detect a minor 7th chord, and then also suggest a 6 chord built on the minor 3rd of the root would suffice, but since chord detection is fairly static (there are only a set number of possibilities) I feel like dictionary lookup will always be the most reliable and low-latency method.

Any ideas?

  • 1
    There may be a problem with chords that are ambiguous when viewed in isolation. For example C-E-G-A could be C with a non-harmonic A or an A-minor seventh. Likewise C-E-G-Bb could be heard as C-E-G-A# with differing interpretations (even a single instance may be approached as a C7 and left as a German Seventh or vice versa.) – ttw Feb 3 '20 at 4:01
  • @ttw I'm still trying to work out the specifics of how best to use this in an app. Lemme bounce this off you: Any given input chord is displayed on a staff with the guess as to what it is. From there the user can be like, "actually I meant it to be this" which can overwrite the guess. None of that really matters I guess, I'm just trying to think of an algorithmic way to maximize either consonant or dissonant intervals. Something like prioritizing 3rd/6th, 4th/5th, or 2nd/7th intervals. You would also be able to choose which notes of chord you wanted to ommit as well (5th in extended) – Matthew Farstad Feb 3 '20 at 4:15
  • @MatthewFarstad: I once built a similar system, and faced the same problem (obviously): Inversions and omitted notes (I wrote it for guitars). I seem to recall that I based likelihood of a chord on proximity to a "perfect" stacking of continuing triads from the root. So CEGA is either [1-3-5-7 (ACEG)], [1-3-5-6(CEGA)], [1-3-4-6(EGAC)], or [1-2-4-6(GACE)]. ACEG is "perfect" in triad building and reported as most likely, CEGA is 2nd in amount of deviation from the "perfect" triads, then EGAC, and GACE. Can't remember the details anymore, but I hope it makes sense. – Willem van Rumpt Feb 3 '20 at 10:38
  • @WillemvanRumpt Yeah that makes sense. I like that idea and just might steal it. Just kind of bummed I have to reinvent the wheel a bit. – Matthew Farstad Feb 3 '20 at 15:47
  • @MatthewFarstad: Well, it's not reinventing: There's no invention out there. I had a routine promoting "even" intervals (2nd, 4th, 6th) , to 9th, 11th and 13th, just to give 9th chords (and friends) a fair chance. Technically (I think) a sus2 (9th?) or sus4 (11th?) chord doesn't have a 3rd. But given only 6 strings, notes are frequently omitted, and exact nature is determined by the rest. Attributing "complexity" or "commonness" to a chord doesn't work. So I went with "Chords are triads added to a root, non triads are more complex". I don't think there's a generic "resolve the chord" method. – Willem van Rumpt Feb 3 '20 at 16:26

I've actually created this exact thing you're looking for https://www.solfej.io/chords

  • -1. c,d,e,g reports "C7no5 Chord". The 5th is definitely there. The 7th isn't. It could've reported "C add9" or something similar. Worst case Csus2. None of the alternative even take the "D" into account. – Willem van Rumpt Feb 3 '20 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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