Bill's Conversational Musings

Reverse Chord Finder

Reverse Chord Finder

Changing up the melody

Reharmonization is the process of transforming familiar melodies with different and fresh chord progressions. A simple example might be taking a familiar chord progression like C-G-Am-F (e.g., "Somewhere Over the Rainbow") and replacing the Am with an E7, creating a new harmonic flavor.

Why this works

A minor and E7 share the common note of E natural.
Am = A, C, E
E7 = E, G#, B, D

The Request

For this purpose, I wanted a way to find chords that shared a common note across all keys. I have used the following prompt on various GenAI tools with not much success until now.

Identify all chords that include the note B as one of their notes. Only include chords if B is the third, fifth, seventh, or any other part of the chord. You are to exclude chords where B is in the root. You are to exclude chords that include the notes B-flat (Bb) or B-sharp (B#). If the note B does not appear, do not include it.

Every other AI tool tried to list chords and then would include chords that didn't have the correct note request in it. When I asked it why it gave me a chord that didn't qualify, the response was, "You are right! Here is another list."

Enter Grok 4

xAI recently released Grok 4 or SuperGrok and it has changed the way problems are solved. Giving the exact same prompt as above it went to work. First it started analyzing chord composition, then it started exploring additional chord types, then refined itself by clarifying chord spelling, and did a ton of different searches, 28 websites in all, but what it did next really surprised me.

Enter Python

Things changed when I saw this line appear.

Coding a list of common chords with their roots and notes will help identify matches.

Code? What code?

Grok opens a window and starts writing out python code to start building the list. (see below for the actual code)

And then finally give me the list.

Cmaj7, Cminmaj7, C#7, C#m7, C#m7b5, Ddim7, Ebaug, E, Em, E7, Em7, Emaj7, Eminmaj7, Fdim, Fdim7, Fm7b5, G, Gaug, G7, Gmaj7, G#m, G#m7, G#m7b5, G#minmaj7, G#dim, G#dim7

382 seconds of thinking

It even included chords like Fm7b5 (Notes: F, Ab, Cb, Eb) where Cb is technically B natural.

The next evolution

Next I give it the request

Take the python script that was developed to output the previous response and turn it into an HTML page where any note can be entered and the chords that match the criteria will be displayed.

It does more thinking and presents me the HTML page you see below.

Here is a page where you use the reverse chord finder directly!

Conclusions

Needless to say this is impressive. I know I'm not calculating orbital mechanics but this isn't easy content for even some humans to comprehend. I think we just crossed into a new way working with and solving our problems.

Python code and Grok's thinking below.

Python Code

chords = [
    {"name": "C", "root": "C", "notes": ["C", "E", "G"]},
    {"name": "Cm", "root": "C", "notes": ["C", "Eb", "G"]},
    {"name": "Caug", "root": "C", "notes": ["C", "E", "G#"]},
    {"name": "Cdim", "root": "C", "notes": ["C", "Eb", "Gb"]},
    {"name": "C7", "root": "C", "notes": ["C", "E", "G", "Bb"]},
    {"name": "Cm7", "root": "C", "notes": ["C", "Eb", "G", "Bb"]},
    {"name": "Cmaj7", "root": "C", "notes": ["C", "E", "G", "B"]},
    {"name": "Cminmaj7", "root": "C", "notes": ["C", "Eb", "G", "B"]},
    {"name": "Cm7b5", "root": "C", "notes": ["C", "Eb", "Gb", "Bb"]},
    {"name": "Cdim7", "root": "C", "notes": ["C", "Eb", "Gb", "A"]},
    {"name": "C#", "root": "C#", "notes": ["C#", "F", "G#"]},
    {"name": "C#m", "root": "C#", "notes": ["C#", "E", "G#"]},
    {"name": "C#aug", "root": "C#", "notes": ["C#", "F", "A"]},
    {"name": "C#dim", "root": "C#", "notes": ["C#", "E", "G"]},
    {"name": "C#7", "root": "C#", "notes": ["C#", "F", "G#", "B"]},
    {"name": "C#m7", "root": "C#", "notes": ["C#", "E", "G#", "B"]},
    {"name": "C#maj7", "root": "C#", "notes": ["C#", "E#", "G#", "B#"]},
    {"name": "C#minmaj7", "root": "C#", "notes": ["C#", "E", "G#", "B#"]},
    {"name": "C#m7b5", "root": "C#", "notes": ["C#", "E", "G", "B"]},
    {"name": "C#dim7", "root": "C#", "notes": ["C#", "E", "G", "Bb"]},
    {"name": "Db", "root": "Db", "notes": ["Db", "F", "Ab"]},
    {"name": "Dbm", "root": "Db", "notes": ["Db", "Fb", "Ab"]},
    {"name": "Dbaug", "root": "Db", "notes": ["Db", "F", "A"]},
    {"name": "Dbdim", "root": "Db", "notes": ["Db", "Fb", "Abb"]},
    {"name": "Db7", "root": "Db", "notes": ["Db", "F", "Ab", "Cb"]},
    {"name": "Dbm7", "root": "Db", "notes": ["Db", "Fb", "Ab", "Cb"]},
    {"name": "Dbmaj7", "root": "Db", "notes": ["Db", "F", "Ab", "C"]},
    {"name": "Dbminmaj7", "root": "Db", "notes": ["Db", "Fb", "Ab", "C"]},
    {"name": "Dbm7b5", "root": "Db", "notes": ["Db", "Fb", "Abb", "Cb"]},
    {"name": "Dbdim7", "root": "Db", "notes": ["Db", "Fb", "Abb", "Bb"]},
    {"name": "D", "root": "D", "notes": ["D", "F#", "A"]},
    {"name": "Dm", "root": "D", "notes": ["D", "F", "A"]},
    {"name": "Daug", "root": "D", "notes": ["D", "F#", "A#"]},
    {"name": "Ddim", "root": "D", "notes": ["D", "F", "Ab"]},
    {"name": "D7", "root": "D", "notes": ["D", "F#", "A", "C"]},
    {"name": "Dm7", "root": "D", "notes": ["D", "F", "A", "C"]},
    {"name": "Dmaj7", "root": "D", "notes": ["D", "F#", "A", "C#"]},
    {"name": "Dminmaj7", "root": "D", "notes": ["D", "F", "A", "C#"]},
    {"name": "Dm7b5", "root": "D", "notes": ["D", "F", "Ab", "C"]},
    {"name": "Ddim7", "root": "D", "notes": ["D", "F", "Ab", "B"]},
    {"name": "Eb", "root": "Eb", "notes": ["Eb", "G", "Bb"]},
    {"name": "Ebm", "root": "Eb", "notes": ["Eb", "Gb", "Bb"]},
    {"name": "Ebaug", "root": "Eb", "notes": ["Eb", "G", "B"]},
    {"name": "Ebdim", "root": "Eb", "notes": ["Eb", "Gb", "A"]},
    {"name": "Eb7", "root": "Eb", "notes": ["Eb", "G", "Bb", "Db"]},
    {"name": "Ebm7", "root": "Eb", "notes": ["Eb", "Gb", "Bb", "Db"]},
    {"name": "Ebmaj7", "root": "Eb", "notes": ["Eb", "G", "Bb", "D"]},
    {"name": "Ebminmaj7", "root": "Eb", "notes": ["Eb", "Gb", "Bb", "D"]},
    {"name": "Ebm7b5", "root": "Eb", "notes": ["Eb", "Gb", "A", "Db"]},
    {"name": "Ebdim7", "root": "Eb", "notes": ["Eb", "Gb", "A", "C"]},
    {"name": "E", "root": "E", "notes": ["E", "G#", "B"]},
    {"name": "Em", "root": "E", "notes": ["E", "G", "B"]},
    {"name": "Eaug", "root": "E", "notes": ["E", "G#", "C"]},
    {"name": "Edim", "root": "E", "notes": ["E", "G", "Bb"]},
    {"name": "E7", "root": "E", "notes": ["E", "G#", "B", "D"]},
    {"name": "Em7", "root": "E", "notes": ["E", "G", "B", "D"]},
    {"name": "Emaj7", "root": "E", "notes": ["E", "G#", "B", "D#"]},
    {"name": "Eminmaj7", "root": "E", "notes": ["E", "G", "B", "D#"]},
    {"name": "Em7b5", "root": "E", "notes": ["E", "G", "Bb", "D"]},
    {"name": "Edim7", "root": "E", "notes": ["E", "G", "Bb", "Db"]},
    {"name": "F", "root": "F", "notes": ["F", "A", "C"]},
    {"name": "Fm", "root": "F", "notes": ["F", "Ab", "C"]},
    {"name": "Faug", "root": "F", "notes": ["F", "A", "C#"]},
    {"name": "Fdim", "root": "F", "notes": ["F", "Ab", "B"]},
    {"name": "F7", "root": "F", "notes": ["F", "A", "C", "Eb"]},
    {"name": "Fm7", "root": "F", "notes": ["F", "Ab", "C", "Eb"]},
    {"name": "Fmaj7", "root": "F", "notes": ["F", "A", "C", "E"]},
    {"name": "Fminmaj7", "root": "F", "notes": ["F", "Ab", "C", "E"]},
    {"name": "Fm7b5", "root": "F", "notes": ["F", "Ab", "B", "Eb"]},
    {"name": "Fdim7", "root": "F", "notes": ["F", "Ab", "B", "D"]},
    {"name": "F#", "root": "F#", "notes": ["F#", "A#", "C#"]},
    {"name": "F#m", "root": "F#", "notes": ["F#", "A", "C#"]},
    {"name": "F#aug", "root": "F#", "notes": ["F#", "A#", "D"]},
    {"name": "F#dim", "root": "F#", "notes": ["F#", "A", "C"]},
    {"name": "F#7", "root": "F#", "notes": ["F#", "A#", "C#", "E"]},
    {"name": "F#m7", "root": "F#", "notes": ["F#", "A", "C#", "E"]},
    {"name": "F#maj7", "root": "F#", "notes": ["F#", "A#", "C#", "E#"]},
    {"name": "F#minmaj7", "root": "F#", "notes": ["F#", "A", "C#", "E#"]},
    {"name": "F#m7b5", "root": "F#", "notes": ["F#", "A", "C", "E"]},
    {"name": "F#dim7", "root": "F#", "notes": ["F#", "A", "C", "Eb"]},
    {"name": "G", "root": "G", "notes": ["G", "B", "D"]},
    {"name": "Gm", "root": "G", "notes": ["G", "Bb", "D"]},
    {"name": "Gaug", "root": "G", "notes": ["G", "B", "D#"]},
    {"name": "Gdim", "root": "G", "notes": ["G", "Bb", "Db"]},
    {"name": "G7", "root": "G", "notes": ["G", "B", "D", "F"]},
    {"name": "Gm7", "root": "G", "notes": ["G", "Bb", "D", "F"]},
    {"name": "Gmaj7", "root": "G", "notes": ["G", "B", "D", "F#"]},
    {"name": "Gminmaj7", "root": "G", "notes": ["G", "Bb", "D", "F#"]},
    {"name": "Gm7b5", "root": "G", "notes": ["G", "Bb", "Db", "F"]},
    {"name": "Gdim7", "root": "G", "notes": ["G", "Bb", "Db", "E"]},
    {"name": "G#", "root": "G#", "notes": ["G#", "C", "D#"]},
    {"name": "G#m", "root": "G#", "notes": ["G#", "B", "D#"]},
    {"name": "G#aug", "root": "G#", "notes": ["G#", "C", "E"]},
    {"name": "G#dim", "root": "G#", "notes": ["G#", "B", "D"]},
    {"name": "G#7", "root": "G#", "notes": ["G#", "C", "D#", "F#"]},
    {"name": "G#m7", "root": "G#", "notes": ["G#", "B", "D#", "F#"]},
    {"name": "G#maj7", "root": "G#", "notes": ["G#", "B#", "D#", "G"]},
    {"name": "G#minmaj7", "root": "G#", "notes": ["G#", "B", "D#", "G"]},
    {"name": "G#m7b5", "root": "G#", "notes": ["G#", "B", "D", "F#"]},
    {"name": "G#dim7", "root": "G#", "notes": ["G#", "B", "D", "F"]},
    {"name": "A", "root": "A", "notes": ["A", "C#", "E"]},
    {"name": "Am", "root": "A", "notes": ["A", "C", "E"]},
    {"name": "Aaug", "root": "A", "notes": ["A", "C#", "F"]},
    {"name": "Adim", "root": "A", "notes": ["A", "C", "Eb"]},
    {"name": "A7", "root": "A", "notes": ["A", "C#", "E", "G"]},
    {"name": "Am7", "root": "A", "notes": ["A", "C", "E", "G"]},
    {"name": "Amaj7", "root": "A", "notes": ["A", "C#", "E", "G#"]},
    {"name": "Aminmaj7", "root": "A", "notes": ["A", "C", "E", "G#"]},
    {"name": "Am7b5", "root": "A", "notes": ["A", "C", "Eb", "G"]},
    {"name": "Adim7", "root": "A", "notes": ["A", "C", "Eb", "Gb"]},
    {"name": "Bb", "root": "Bb", "notes": ["Bb", "D", "F"]},
    {"name": "Bbm", "root": "Bb", "notes": ["Bb", "Db", "F"]},
    {"name": "Bbaug", "root": "Bb", "notes": ["Bb", "D", "F#"]},
    {"name": "Bbdim", "root": "Bb", "notes": ["Bb", "Db", "E"]},
    {"name": "Bb7", "root": "Bb", "notes": ["Bb", "D", "F", "Ab"]},
    {"name": "Bbm7", "root": "Bb", "notes": ["Bb", "Db", "F", "Ab"]},
    {"name": "Bbmaj7", "root": "Bb", "notes": ["Bb", "D", "F", "A"]},
    {"name": "Bbminmaj7", "root": "Bb", "notes": ["Bb", "Db", "F", "A"]},
    {"name": "Bbm7b5", "root": "Bb", "notes": ["Bb", "Db", "E", "Ab"]},
    {"name": "Bbdim7", "root": "Bb", "notes": ["Bb", "Db", "E", "G"]},
    {"name": "B", "root": "B", "notes": ["B", "D#", "F#"]},
    {"name": "Bm", "root": "B", "notes": ["B", "D", "F#"]},
    {"name": "Baug", "root": "B", "notes": ["B", "D#", "G"]},
    {"name": "Bdim", "root": "B", "notes": ["B", "D", "F"]},
    {"name": "B7", "root": "B", "notes": ["B", "D#", "F#", "A"]},
    {"name": "Bm7", "root": "B", "notes": ["B", "D", "F#", "A"]},
    {"name": "Bmaj7", "root": "B", "notes": ["B", "D#", "F#", "A#"]},
    {"name": "Bminmaj7", "root": "B", "notes": ["B", "D", "F#", "A#"]},
    {"name": "Bm7b5", "root": "B", "notes": ["B", "D", "F", "A"]},
    {"name": "Bdim7", "root": "B", "notes": ["B", "D", "F", "Ab"]},
]

result = []

for chord in chords:
    if chord["root"] == "B":
        continue
    notes = chord["notes"]
    if "B" not in notes:
        continue
    if "Bb" in notes or "B#" in notes:
        continue
    result.append(chord["name"])

print(', '.join(sorted(result)))

Initial Request Thinking

Analyzing chord composition

The task is to find chords containing the note B as the third, fifth, seventh, or other parts.
Chords where B is the root, like B major or B minor, should be excluded.
The question specifies excluding chords with B-flat (Bb) or B-sharp (B#).
Let's focus on triads and seventh chords where B appears but isn't the root.
For B as the third in a major chord, the root is G, forming G B D.
Exploring additional chord types

For B as the fifth, E major (E G# B) and E minor (E G B) both include B.
Listing all possible chords is too broad, so let's consider standard major and minor triads.
The question's exclusion of Bb or B# means avoiding chords with those pitches.
It's tricky to determine if a chord includes Bb or B# based on naming versus pitch.
The intent may be to include chords spelled with natural B, not enharmonic equivalents like Cb.
For diminished chords, G# B D is a candidate, with B as the third in standard spelling.
Clarifying chord spelling

Chords must be spelled with B, not enharmonic equivalents like Cb, to be included.
Augmented triads like G aug (G B D#) include B as the third without Bb or B#.
For major seventh chords, C maj7 (C E G B) has B as the seventh.
Let's search for chord databases to find more examples.
Currently looking for common chords with B natural as a non-root note to narrow down options.
Searching for "common chords that include the note B but not as root"
reddit.com
music.stackexchange.com
guitartricks.com
masterclass.com
Show all (10)

Search results didn't directly list chords with B not as root, focusing on inversions and analyses.
Let's try searching for "chords that contain the note B" to find more relevant info.
Evaluating seventh chords

Common seventh chords like C maj7 (C E G B) and G7 (G B D F) include B as non-root.
For C# dominant 7, the chord C# E# G# B has B as the seventh, without Bb.
The seventh in C#7 is B natural, correcting earlier confusion about Bb.
Searching for chord resources

Maybe searching for "reverse chord finder" will help identify sites listing chords with B.
Searching for "chords containing the note B"
classicalguitarshed.com
scales-chords.com
flowkey.com
darkworld.com
Show all (19)

Scales-Chords offers a chord identifier by notes, which could help.
Coding a solution in Python could list common chords with 'B' not as root, excluding 'Bb' or 'B#'.
Let's compute notes for common chords, checking if 'B' is included, not the root, and excluding 'Bb' or 'B#'.
E major (E G# B) includes B as the fifth, fitting the criteria without Bb or B#.
Considering half-diminished chords

G#m7b5 (G# B D F#) includes B as the third, with no Bb or B#.
I think I can list them by writing Python code to define chord notes.
For each chord, check if 'B' is in the notes, root isn't 'B', and exclude if 'Bb' or 'B#' appears.
To exclude chords where the root is B, check if the chord name starts with 'B'.
For Ab minor, notes are Ab Cb Eb; since B doesn't appear as "B", it's excluded.
Coding a list of common chords with their roots and notes will help identify matches.
Building chord list

C#7 includes B as the seventh, with notes C# E# G# B, no Bb or B#.
For D dim7, notes are D F Ab B, including B as the seventh without Bb or B#.
Eb aug (Eb G B) has B as the third, with no Bb or B# in the notes.
F dim (F Ab B) includes B as the fifth, with no Bb or B# in the notes.
G major (G B D) has B as the third, fitting the criteria without Bb or B#.
G#m7b5 includes B as the third, with notes G# B D F#, no Bb or B#.
Finalizing chord selection

The code lists chords like Cmaj7, C#7, E, Em, G, G#, and more, all with B not as root.
For some chords like C#maj7, standard spelling uses B#, so they'll be excluded.
Adjusting chord spellings

For G#maj7, spelling includes B#, so it's excluded due to the B# rule.

Webpage Request

Clarifying the request

The request asks to identify chords including the note B, but not as the root, and excludes Bb or B#.
Previously, a list was provided: Cmaj7, Cminmaj7, C#7, C#m7, C#m7b5, Ddim7, Ebaug, E, Em, E7, Em7, Emaj7, Eminmaj7, Fdim, Fdim7, Fm7b5, G, Gaug, G7, Gmaj7, G#m, G#m7, G#m7b5, G#minmaj7, G#dim, G#dim7.
Now, the task is to create an HTML page where any note can be entered, showing matching chords.
Let's search for info on how to build an HTML page with JavaScript for chord calculations.
I'm thinking of creating a Python script first to generate the chord list, then turn it into HTML with JavaScript.
Planning the HTML implementation

The HTML page needs an input for any note and a display for matching chords.
For simplicity, let's define notes using sharps and map to standard names.
The input can be any note like B, A#, or Bb, and must exclude chords with flats or sharps of that note.
For a given note N, exclude chords with N flat or N sharp, like Bb or B# for N=B.
Currently looking for a way to generate the chord list for any note using Python, then adapt it for JavaScript in HTML.
Exploring chord generation

The list includes chord types like major, minor, 7th, and diminished, across 12 keys.
To simplify, let's search for a list of common chords and their note compositions online.
Search results are being gathered to find reliable data on chord compositions.
Searching for "list of all common chords and their notes in all keys including triads seventh diminished augmented"
muted.io
learnjazzstandards.com
hoffmanacademy.com
en.wikipedia.org
Show all (20)

Found a useful page at muted.io with a piano chord chart for all types.
Browsing https://muted.io/chords/

The page started explaining chord generation based on formulas but cut off before completing.
Now, let's check another page at Piano Keyboard Guide for a comprehensive chord list.
Browsing https://www.piano-keyboard-guide.com/piano-chords.html

Generating chord data

The tool output for the page was cut off at "E augmented," notes starting with ["E", "G♯",.
To handle spellings, it's tricky, but for standard chords, I can use a dictionary for each type's intervals in semitones, and a way to name the note.
Let's create a Python script to generate the chord list for a given note, focusing on standard spellings.
The instruction "include the note B" likely refers to the pitch class, not just the spelling.
Chords must include the pitch B natural, not as root, and exclude if they have Bb or B# pitches.
Refining chord spelling

For Fdim, standard spelling is F Ab Cb, but the list includes it, suggesting pitch B is considered.
The exclusion is based on the specific name 'Bb' or 'B#' appearing in the note list.
For Fdim, if spelled F Ab B, it has 'B' and no 'Bb' or 'B#', which might be acceptable in some contexts.
Always use sharp spellings where possible, like Bb as A# and B# as C, to avoid flats in chord names.
For Ddim7, standard spelling is D F Ab Cb, but using sharps, it could be D F G# B, including 'B' without 'Bb' or 'B#'.
Implementing chord logic

Since browse results are truncated, let's use Python to define chord types with semitones.
Perhaps the final response is the HTML code.
To match the original, use standard spellings that sometimes use flats, like Bb for certain chords.
Adjusting for tool limitations

The browse output was cut off, so let's try finding a page with a full chord list.
To get a comprehensive list, perhaps use Python to create all chords with standard note spellings.
Standardizing note naming

For flat roots like Eb, use flat note names such as Eb, Gb, Ab, Bb.
For sharp roots, use sharp note names to maintain consistency in chord spellings.
Improving chord naming accuracy

Proper chord naming requires letter sequence: C D E F G A B, adjusting accidentals for intervals.
Natural note semitones are C=0, D=2, E=4, F=5, G=7, A=9, B=11.
To get the semi for a root like 'C#', parse the root and calculate its semitone position.
Calculating note positions

Letter indices are calculated by adding steps like 0, 2, 4 for triads, then finding the required semitone.
The trick is to generate for all possible root names, and for each chord, if all notes have |d| <=1, include it, otherwise skip.
Implementing in Python

Currently writing a Python script to list chords for note 'B', using defined functions for note-to-semitone conversion.
The script defines chord types with symbols like '' for major, 'm' for minor, and intervals in semitones.
Finalizing chord filtering

Chords must include 'B' in their note names, not as the root, and exclude if 'Bb' or 'B#' appears.
If root_semi equals 11, exclude the chord.
For Fdim, standard spelling F Ab Cb doesn't include 'B', but the list suggests using F G# B in some contexts.
Simplifying chord spellings

For dim chords like Fdim, using sharp spellings like F G# B includes 'B' without 'Bb' or 'B#'.
The original list suggests using pitch class, so let's adjust the script to match that logic.
Generalizing for any note

The script will take any note as input and find chords with that note, not as root, excluding flats or sharps.
C7 is not in the list, likely because it includes Bb, while C#7 with A# is included, suggesting name-based exclusion.
Revisiting exclusion criteria

The term "notes B-flat (Bb) or B-sharp (B#)" likely means the names, not pitches.
'B#' is the name, not the pitch, for exclusion purposes.
Planning HTML implementation

For Gaug, notes G B D# include 'B', fitting the criteria.
Testing the Python script to see if it outputs the previous response for note 'B'.
Verifying chord examples

For D# aug, notes include 'B', matching the list's Ebaug variant.
The system using sharp names works, as C7 isn't included due to lacking 'B', while Cmaj7 has 'B'.
Finalizing HTML design

The HTML will have an input for the note, then compute the list using this logic, and display the chords.
Enhancing root name options

To match the list, add flat roots like 'Db', 'Eb', and use flat note names for them.
For aug chords at pitch 3, both D#aug and Ebaug are generated, including 'B'.
Finalizing HTML code

The final response will be the HTML code using the sharp system, accepting the slight naming differences like D#aug for Ebaug.
Implementing JavaScript logic

The HTML includes predefined notes and chord types with their semitone intervals.
The JavaScript function finds chords containing the input note, excluding those with flats or sharps.