pychord package¶
Subpackages¶
Submodules¶
pychord.analyzer module¶
-
pychord.analyzer.
find_chords_from_notes
(notes: List[str]) → List[pychord.chord.Chord][source]¶ Find possible chords consisted from notes
Parameters: notes – List of note arranged from lower note. ex) [“C”, “Eb”, “G”] Returns: List of chord
pychord.chord module¶
-
class
pychord.chord.
Chord
(chord: str)[source]¶ Bases:
object
Class to handle a chord.
- Attributes:
- _chord: Name of the chord. (e.g. C, Am7, F#m7-5/A) _root: The root note of chord. (e.g. C, A, F#) _quality: The quality of chord. (e.g. maj, m7, m7-5) _appended: The appended notes on chord. _on: The base note of slash chord.
-
appended
¶ The appended notes on chord
-
chord
¶ The name of chord
-
components
(visible: bool = True) → Union[List[str], List[int]][source]¶ Return the component notes of chord
Parameters: visible – returns the name of notes if True else list of int Returns: component notes of chord
-
components_with_pitch
(root_pitch: int) → List[str][source]¶ Return the component notes of chord formatted like [“C4”, “E4”, “G4”]
Parameters: root_pitch – the pitch of the root note Returns: component notes of chord
-
classmethod
from_note_index
(note: int, quality: str, scale: str, diatonic: bool = False, chromatic: int = 0) → pychord.chord.Chord[source]¶ Create a Chord from note index in a scale
Chord.from_note_index(1, “”, “Cmaj”) returns I of C major => Chord(“C”) Chord.from_note_index(3, “m7”, “Fmaj”) returns IIImin of F major => Chord(“Am7”) Chord.from_note_index(5, “7”, “Amin”) returns Vmin of A minor => Chord(“E7”) Chord.from_note_index(2, “”, “Cmaj”) returns II of C major => Chord(“D”) Chord.from_note_index(2, “m”, “Cmaj”) returns IImin of C major => Chord(“Dm”) Chord.from_note_index(2, “”, “Cmaj”, diatonic=True) returns IImin of C major => Chord(“Dm”) Chord.from_note_index(2, “”, “Cmin”, chromatic=-1) returns bII of C minor => Chord(“Db”)
Parameters: - note – Scale degree of the chord’s root (1-7)
- quality – Quality of the chord (e.g. m7, sus4)
- scale – Base scale (e.g. Cmaj, Amin, F#maj, Ebmin)
- diatonic – If True, chord quality is determined using the base scale (overrides :param quality)
- chromatic – Lower or raise the scale degree (and all notes of the chord) by semitone(s)
-
on
¶ The base note of slash chord
-
quality
¶ The quality of chord
-
root
¶ The root note of chord
pychord.parser module¶
pychord.progression module¶
-
class
pychord.progression.
ChordProgression
(initial_chords: Union[str, pychord.chord.Chord, List[Union[str, pychord.chord.Chord]]] = [])[source]¶ Bases:
object
Class to handle chord progressions.
- Attributes:
- _chords: component chords of chord progression.
-
append
(chord: Union[str, pychord.chord.Chord]) → None[source]¶ Append a chord to chord progressions
Parameters: chord – A chord to append
-
chords
¶ Get component chords of chord progression
-
insert
(index: int, chord: Union[str, pychord.chord.Chord]) → None[source]¶ Insert a chord to chord progressions
Parameters: - index – Index to insert a chord
- chord – A chord to insert
pychord.quality module¶
-
class
pychord.quality.
Quality
(name: str, components: Tuple[int, ...])[source]¶ Bases:
object
Chord quality
-
append_on_chord
(on_chord, root)[source]¶ Append on chord
To create Am7/G q = Quality(‘m7’) q.append_on_chord(‘G’, root=’A’)
Parameters: - on_chord (str) – bass note of the chord
- root (str) – root note of the chord
-
get_components
(root='C', visible=False)[source]¶ Get components of chord quality
Parameters: - root (str) – the root note of the chord
- visible (bool) – returns the name of notes if True
Return type: list[str|int]
Returns: components of chord quality
-
quality
¶ Get name of quality
-
pychord.utils module¶
-
pychord.utils.
note_to_val
(note: str) → int[source]¶ Get index value of a note
>>> note_to_val("C") 0 >>> note_to_val("B") 11