Demonstration of my “ABC Tune Backup Chord Solver” utility tool matches your tune measure-per-measure against tunes with similar meter and key/mode in thesession.org tune database to inject backup chords.
The tool is at:
Source code available in my GitHub repo:
A bit more detail about how the ABC Tune Backup Chord Solver works:
This tool is not a normal “chord finder.”
Some other ABC chord tools try to determine the chords directly from the notes in the tune.
This one takes a different approach.
It looks for similar measures in a large collection of already-chorded tunes from The Session, then uses those existing chorded measures as the source material.
For example, if the input tune is a reel in D major, the solver first looks at usable chorded measures from other D major reels in the database.
It compares the notes in the current measure against the candidate measures and looks for the closest match.
It does not search every reel in the database. It narrows the search first by normalized meter, key, mode, and rhythm type. So a D major reel is compared first against D major reels in a compatible meter.
If there is no good match at the selected match threshold, it tries a slightly loosened threshold while still staying within the same rhythm type. Only after that does it fall back to other compatible rhythm types in the same meter/key/mode bucket.
So for a D major reel, the basic order is:
D major reels at the selected match level
D major reels at the loosened match level
Other compatible D major 4/4 tune types at the selected match level
Other compatible D major 4/4 tune types at the loosened match level
It also pays some attention to where the measure is in the tune.
The start of a tune or part is a little different from the middle of a tune. The end of a repeated part is also a little different from a normal middle measure.
So when the solver is working on the start of a tune, part, or repeated section, it first tries to match against measures that were also used at the start of something in the database.
Likewise, when it is working on an ending measure, including first and second endings, it first tries to match against measures that were also endings in the database.
That gives it a better chance of finding a chord pattern that makes sense in that position. If that does not work, it just falls back to the normal measure matching.
There is also a small key/mode tie-breaker.
The melody match still comes first. The tool is not doing full harmonic analysis.
But sometimes two database measures are very close melodically and suggest different chords. In those cases, the solver gives a little preference to the chord pattern that fits the current key and mode better.
For example, in G major, if two very similar matches suggest G or Bm, it will tend to prefer G.
For tune, part, and repeated-section starts, that tie-breaker is allowed a little more room. That helps with cases where the start of a repeated part has two close matches, but one starts on a chord that makes more sense for the key or mode.
For example, in E Dorian, if one close match starts with C and another close match starts with Em, the solver can prefer Em.
This does not mean those other chords are blocked. It just means that when the melodic matches are close, the tool gives a little extra weight to the chord choice that seems more at home in the current key or mode.
For something like a jig in A Dorian, the same general idea applies.
It first searches A Dorian jigs in 6/8. Since Dorian and minor tunes can often share similar backup chord ideas, it can also check A minor material and use the best measure-level result.
The tool also restricts where the copied chords are allowed to go.
In 4/4, chords are only placed on beats 1 and 3. In 6/8, they are only placed on beats 1 and 4. This helps keep copied chord patterns from landing on odd beats just because a source setting happened to have extra chord symbols.
It also skips tunes that are likely to give unreliable results, such as tunes that change key or mode in the middle, or tunes with multiple voices.
There is also an optional feature that allow the tool to find and correct tunes that have the incorrect key or mode specified in their K: tag.
For example an E Dorian tune that has K:D or a D Mixolydian tune that has K:G.
The tool will detect the incorrect key and mode and solve the chords based on the correct key and mode but does not change the underlying K: tag itself.
The goal is not to produce a final authoritative chord setting.
It is meant to create a useful first pass: a set of backup chord suggestions based on what has already been used in similar traditional tune settings.
Once the chords are added, since it’s just ABC text, you can always change them, delete them, do whatever you require.