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) → 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”)
Parameters: - note – Note index in a Scale I, II, …, VIII
- quality – Quality of a chord (m7, sus4, …)
- scale – Base scale (Cmaj, Amin, F#maj, Ebmin, …)
- diatonic – Adjust certain chord qualities according to the scale
-
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]]] = None)[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