pychord package¶
Subpackages¶
Submodules¶
pychord.analyzer module¶
-
pychord.analyzer.
get_all_rotated_notes
(notes)[source]¶ Get all rotated notes
get_all_rotated_notes([1,3,5]) -> [[1,3,5],[3,5,1],[5,1,3]]
Return type: list[list[str]]
pychord.chord module¶
-
class
pychord.chord.
Chord
(chord)[source]¶ Bases:
object
Class to handle a chord.
Parameters: - _chord (str) – Name of the chord. (e.g. C, Am7, F#m7-5/A)
- _root (str) – The root note of chord.
- _quality (pychord.Quality) – The quality of chord. (e.g. m7, 6, M9, …)
- _appended (list[str]) – The appended notes on chord.
- _on (str) – The base note of slash chord.
-
appended
¶ The appended notes on chord
-
chord
¶ The name of chord
-
components
(visible=True)[source]¶ Return the component notes of chord
Parameters: visible (bool) – returns the name of notes if True else list of int Return type: list[(str or int)] Returns: component notes of chord
-
components_with_pitch
(root_pitch)[source]¶ Return the component notes of chord formatted like [“C4”, “E4”, “G4”]
Parameters: root_pitch (int) – the pitch of the root note Return type: list[str] Returns: component notes of chord
-
classmethod
from_note_index
(note, quality, scale, diatonic=False)[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 (int) – Note index in a Scale I, II, …, VIII
- quality (str) – Quality of a chord (m7, sus4, …)
- scale (str) – Base scale (Cmaj, Amin, F#maj, Ebmin, …)
Return type:
-
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=None)[source]¶ Bases:
object
Class to handle chord progressions.
Parameters: _chords (list[pychord.Chord]) – component chords of chord progression. -
append
(chord)[source]¶ Append a chord to chord progressions
Parameters: chord (str|pychord.Chord) – A chord to append Returns:
-
chords
¶ Get component chords of chord progression
Return type: list[pychord.Chord]
-
insert
(index, chord)[source]¶ Insert a chord to chord progressions
Parameters: - index (int) – Index to insert a chord
- chord (str|pychord.Chord) – A chord to insert
Returns:
-
pychord.quality module¶
-
class
pychord.quality.
Quality
(name, components)[source]¶ Bases:
object
Chord quality
Parameters: _quality (str) – str expression of chord quality -
append_note
(note, root, scale=0)[source]¶ Append a note to quality
Parameters: - note (str) – note to append on quality
- root (str) – root note of chord
- scale (int) – key scale
-
append_notes
(notes, root, scale=0)[source]¶ Append notes to quality
Parameters: - notes (list[str]) – notes to append on quality
- root (str) – root note of chord
- scale (int) – key scale
-
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)[source]¶ Convert note to int
>>> note_to_val("C") 0 >>> note_to_val("B") 11
Return type: int