How It Works — GuitarChordIdentifier

Written by Daniel Murphy | Last updated: June 2026


What This Page Explains

This page documents the exact technical mechanism behind both chord identification modes on GuitarChordIdentifier.com — fret input identification and microphone-based polyphonic identification. It explains what each pipeline calculates, how each stage works, what accuracy each achieves, and what neither mode can determine. For plain-language answers about how to use and interpret results, see the FAQ.


The Theoretical Foundation — Pitch Classes and Chord Identity

A chord is defined by its pitch class set — the set of distinct note names (ignoring octave) present in the chord. C major (C–E–G) and C major voiced as E–G–C–E (open C shape on guitar) share the same pitch class set {C, E, G}. The specific voicing — which octave each note appears in, which string plays which pitch — affects the sound but not the chord identity.

Chord identity is determined by the intervals between pitch classes:

IntervalSemitonesName
Minor second1m2
Major second2M2
Minor third3m3
Major third4M3
Perfect fourth5P4
Tritone6A4/d5
Perfect fifth7P5
Minor sixth8m6
Major sixth9M6
Minor seventh10m7
Major seventh11M7
Octave12P8

A major triad is always defined by the interval set {M3, m3} (major third + minor third stacked). A minor triad is always {m3, M3}. These interval relationships hold regardless of root note, voicing, or octave.

Inversion is determined by the bass note — the lowest note in the chord voicing:

  • Root position: bass note = chord root (e.g. G–B–D: G in bass → G major, root position)
  • First inversion: bass note = chord third (e.g. B–D–G: B in bass → G/B, first inversion)
  • Second inversion: bass note = chord fifth (e.g. D–G–B: D in bass → G/D, second inversion)


Mode 1 — Fret Input Identification Pipeline

Step 1 — Fret Position Input

The user selects which fret and string each finger is placed on using the virtual fretboard interface. The tool records the fret number (0 = open string) and string number (1–6, low E to high E in standard tuning) for each selected note position.

Step 2 — Pitch Calculation from Fret Positions

Each string in standard tuning has a defined open string pitch:

StringNoteMIDI Number
6 (low E)E240
5 (A)A245
4 (D)D350
3 (G)G355
2 (B)B359
1 (high E)E464

The MIDI number of any fretted note is calculated as:

MIDI note = Open string MIDI + Fret number

Worked example — Open G chord (320033 in tablature notation):

  • String 6, fret 3: 40 + 3 = 43 → G2
  • String 5, fret 2: 45 + 2 = 47 → B2
  • String 4, open: 50 + 0 = 50 → D3
  • String 3, open: 55 + 0 = 55 → G3
  • String 2, open: 59 + 0 = 59 → B3
  • String 1, fret 3: 64 + 3 = 67 → G4

Step 3 — Pitch Class Extraction

Each MIDI number is reduced to a pitch class (0–11) by taking the MIDI number modulo 12:

Pitch class = MIDI number mod 12

For the G chord example:

  • G2 (43): 43 mod 12 = 7 → G
  • B2 (47): 47 mod 12 = 11 → B
  • D3 (50): 50 mod 12 = 2 → D
  • G3 (55): 55 mod 12 = 7 → G (duplicate, removed)
  • B3 (59): 59 mod 12 = 11 → B (duplicate, removed)
  • G4 (67): 67 mod 12 = 7 → G (duplicate, removed)

Unique pitch class set: {G, B, D} = {7, 11, 2}

Step 4 — Interval Analysis and Chord Lookup

The tool calculates the intervals between all notes in the pitch class set relative to each possible root, then matches the resulting interval set against a chord definition database covering triads, seventh chords, extended chords, and common guitar-specific voicings (sus2, sus4, add9, power chords, etc.).

For {G, B, D} with G as root:

  • G to B: 4 semitones = major third
  • G to D: 7 semitones = perfect fifth
  • Interval set {M3, P5} = major triad → G major

Step 5 — Inversion Detection

The bass note is the lowest MIDI note in the input. For the G chord:

  • Lowest note: G2 (MIDI 43) → G
  • G is the chord root → Root position

If the lowest note were B2 (as in a first inversion G major):

  • B is the third of G major → First inversion → displayed as G/B


Mode 2 — Microphone Polyphonic Detection Pipeline

Polyphonic chord detection from audio is significantly more complex than monophonic pitch detection. A guitar chord contains multiple simultaneously sounding notes, each with its own fundamental and harmonic series. The pipeline must separate co-occurring fundamentals from each other and from their harmonics.

Step 1 — Microphone Permission and MediaStream Capture

The browser requests microphone permission via getUserMedia(). Once granted, a MediaStream is connected to a MediaStreamAudioSourceNode within an AudioContext. The audio stream is processed entirely locally — never recorded, stored, or transmitted. For full details, see the Data Security page.

Step 2 — FFT Spectral Analysis

The MediaStreamAudioSourceNode feeds into an AnalyserNode configured with a large FFT window (4096 or 8192 samples) for high frequency resolution:

Frequency resolution = Sample rate ÷ FFT size
At 44,100 Hz ÷ 4096 = ~10.8 Hz per bin
At 44,100 Hz ÷ 8192 = ~5.4 Hz per bin

Higher resolution reduces the frequency ambiguity of each spectral peak — important for distinguishing closely spaced guitar notes (e.g. the minor second between E and F is only 1 semitone ≈ 12–24 Hz in the mid guitar range).

Step 3 — Spectral Peak Extraction

The FFT magnitude spectrum is searched for local maxima above a noise floor threshold. These peaks are candidates for either fundamental frequencies or harmonics of lower fundamentals.

Step 4 — Harmonic Series Analysis and Fundamental Separation

For each candidate peak, the tool checks whether it could be a harmonic (integer multiple) of a lower candidate frequency. Peaks that are consistent with being the 2nd, 3rd, or 4th harmonic of a confirmed lower fundamental are de-prioritised. The remaining candidates are evaluated as potential fundamental frequencies.

The core challenge: Guitar harmonics are strong — a guitar string’s 2nd harmonic (one octave up) is often as loud as the fundamental. Incorrectly interpreting a harmonic as a separate note produces false chord identifications. The harmonic series filter reduces but does not eliminate this error source.

Step 5 — Pitch Class Extraction and Chord Matching

The confirmed fundamental frequencies are converted to MIDI note numbers:

MIDI = 69 + 12 × log₂(f ÷ 440)

Each MIDI note is reduced to a pitch class (mod 12), and the resulting set is matched against the chord database using the same interval analysis as the fret input mode.

Step 6 — Result Display

The identified chord name, detected notes, and inversion (if applicable) are displayed. Where the detected pitch class set matches multiple possible chord names — for example, {C, E, G, B} matching both Cmaj7 and Em/C — the tool displays the most common interpretation and notes the alternative.


Accuracy Comparison

ModeTypical AccuracyPrimary Limitation
Fret input (standard voicings)Near 100%User input error
Fret input (unusual voicings)High — limited by chord database coverageRare extended or altered chords
Microphone (simple triads, clean tone)~80–90%Harmonic series interference
Microphone (complex voicings, distortion)~50–70%Multiple harmonics competing with fundamentals

What This Tool Cannot Determine

Harmonic context and functional role Identifying a chord as Gmaj7/B tells you the chord name and inversion. It does not tell you whether the chord is functioning as a tonic, a secondary dominant, or a passing chord in a larger progression. Harmonic function requires musical context that neither identification mode can provide.

Microtonal tuning variations Guitar strings that are slightly out of tune produce fundamentals that fall between standard pitch classes. The fret input mode assumes standard tuning; the microphone mode maps detected frequencies to the nearest standard pitch class, which may not match a detuned or capo’d guitar correctly.

Chord quality from muted or lightly touched strings In the fret input mode, strings not selected are assumed muted. In microphone mode, ghost notes, light touches, and string buzz may introduce spurious frequencies that affect chord matching.


Related Pages

  • FAQ — plain-language answers about chord identification results and common questions
  • Troubleshooting — what to do when the microphone mode returns an unexpected chord or fails to detect
  • Data Security — how microphone audio is handled in the audio detection mode
  • About GuitarChordIdentifier.com — who runs this site and why it was built

Written by Daniel Murphy, founder of GuitarChordIdentifier.com. Last updated: June 2026.

Scroll to Top