Python library to handle musical chords.
Python
Clone or download
Latest commit b04189e Mar 11, 2018
Permalink
Failed to load latest commit information.
docs Fix author Dec 31, 2016
pychord Raise TypeError in __eq__ methods Feb 26, 2018
test Add tests for constants Feb 26, 2018
.gitignore Modify theme for sphinx Dec 31, 2016
.travis.yml 0.3.1 Mar 11, 2018
CHANGELOG.md 0.3.1 Mar 11, 2018
LICENSE Create pychord package Apr 29, 2016
README.md Fix __eq__ of Chord and support __eq__ for Quality Feb 25, 2018
README.rst 0.3.1 Mar 11, 2018
setup.cfg Create pychord package Apr 29, 2016
setup.py 0.3.1 Mar 11, 2018

README.md

pychord Build Status Documentation Status

Overview

Pychord is a python library to handle musical chords.

Installation

$ pip install pychord

Basic Usage

Create a Chord

>>> from pychord import Chord
>>> c = Chord("Am7")
>>> c
<Chord: Am7>
>>> c.info()
"""
Am7
root=A
quality=m7
appended=[]
on=None
"""

Transpose a Chord

>>> c = Chord("Am7/G")
>>> c.transpose(3)
>>> c
<Chord: Cm7/Bb>

Get component notes

>>> c = Chord("Am7")
>>> c.components()
['A', 'C', 'E', 'G']

Compare Chords

>>> Chord("C") == Chord("D")
False
>>> Chord("C#") == Chord("Db")
True
>>> c = Chord("C")
>>> c.transpose(2)
>>> c == Chord("D")
True

Find Chords

>>> from pychord import note_to_chord
>>> note_to_chord(["C", "E", "G"])
[<Chord: C>]
>>> note_to_chord(["F#", "A", "C", "D"])
[<Chord: D7/F#>]
>>> note_to_chord(["F", "G", "C"])
[<Chord: Fsus2>, <Chord: Csus4/F>]

Create and handle chord progressions

>>> from pychord import ChordProgression
>>> cp = ChordProgression(["C", "G/B", "Am"])
>>> cp
<ChordProgression: C | G/B | Am>

>>> cp.append("Em/G")
>>> cp
<ChordProgression: C | G/B | Am | Em/G>

>>> cp.transpose(+3)
>>> cp
<ChordProgression: Eb | Bb/D | Cm | Gm/Bb>

>>> cp[1]
<Chord: Bb/D>

Supported Python Versions

  • 2.7
  • 3.3 and above

Links

Author

License

  • MIT License