accompy.chord_resolvers#
Chord resolvers — convert chord symbols to MIDI note numbers.
Registered converters: ChordSequence -> NoteSequence
Multiple backends, each wrapping a different music theory library:
pychord: lightweight, good coverage of standard chord types
music21: comprehensive, heavyweight, handles edge cases well
mingus: pure Python music theory, no C dependencies
tonal: the existing accompy dependency (thorwhalen/tonal)
Each resolver is a function: chord_symbol (str) -> list[int] (MIDI notes). We also provide converters that operate on whole ChordSequences.
Functions
Convert ChordSequence to NoteSequence using mingus. |
|
Convert ChordSequence to NoteSequence using music21. |
|
Convert ChordSequence to NoteSequence using pychord. |
|
Convert ChordSequence to NoteSequence using tonal. |
|
|
Resolve a chord symbol to MIDI notes using mingus. |
|
Resolve a chord symbol to MIDI notes using music21. |
|
Resolve a chord symbol to MIDI notes using pychord. |
|
Resolve a chord symbol to MIDI notes using the tonal package. |
- accompy.chord_resolvers.chordseq_to_noteseq_mingus(cs)#
Convert ChordSequence to NoteSequence using mingus.
- Return type:
- accompy.chord_resolvers.chordseq_to_noteseq_music21(cs)#
Convert ChordSequence to NoteSequence using music21.
- Return type:
- accompy.chord_resolvers.chordseq_to_noteseq_pychord(cs)#
Convert ChordSequence to NoteSequence using pychord.
- Return type:
- accompy.chord_resolvers.chordseq_to_noteseq_tonal(cs)#
Convert ChordSequence to NoteSequence using tonal.
- Return type:
- accompy.chord_resolvers.resolve_with_mingus(symbol, *, root_octave=3)[source]#
Resolve a chord symbol to MIDI notes using mingus.
>>> resolve_with_mingus("Cmaj7") [36, 40, 43, 47]
- accompy.chord_resolvers.resolve_with_music21(symbol, *, root_octave=3)[source]#
Resolve a chord symbol to MIDI notes using music21.
Handles the widest range of chord types including altered chords.
>>> resolve_with_music21("Cmaj7") [48, 52, 55, 59]