PythonMusic Theory

CTN — ChordToNote

A command-line tool that converts chord names to their constituent notes. Handles a wide range of chord types including extended harmonies and slash chords. No dependencies — pure Python.

Features

  • Major, minor, dominant: standard triads and seventh chords
  • Extended chords: 9ths, 11ths, 13ths (maj9, m11, aug13, etc.)
  • Altered and suspended: dim, aug, sus2, sus4, power (5), half-diminished
  • Accidentals: sharps and flats in root notes (F#, Bb)
  • Slash chords: specify a bass note independent of the chord root (Gm/E)
  • Enharmonic equivalents: picks the correct spelling based on context
  • Case insensitive: Cm7, CM7, and cm7 all work

Examples

```bash $ python3 src/main.py "Cm7" Chord: Cm7 Notes: C Eb G Bb

$ python3 src/main.py "F#maj7" Chord: F#maj7 Notes: F# A# C# F

$ python3 src/main.py "Gm/E" Chord: Gminor/E Notes: E G Bb D ```

Supported Chord Types

  • Triads: major, minor, dim, aug, sus2, sus4, power (5)
  • Seventh chords: maj7, m7, 7, m7b5, dim7, aug7, augmaj7, mmaj7, 7sus4, 7sus2
  • Extended: maj9, m9, 9, m9b5, aug9, augmaj9, mmaj9
  • Eleventh and thirteenth: maj11 through mmaj13 (full matrix)

How It Works

The program parses the chord name to extract a root note and a chord quality suffix. It then maps that quality to an interval pattern (e.g. minor seventh = [0, 3, 7, 10]) and applies the intervals to the root, with enharmonic correction to pick the most readable note names.

Slash chords are split on / and the bass note is prepended to the note list.

Tech Stack

  • Language: Python 3.8+
  • Dependencies: None