A library to handle musical chords in python.
Project description
pychord
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>
Advanced Usage
Create a Chord from note index in a scale
>>> Chord.from_note_index(note=1, quality="", scale="Cmaj")
<Chord: C> # I of C major
>>> Chord.from_note_index(note=3, quality="m7", scale="Fmaj")
<Chord: Am7> # IIIm7 of F major
>>> Chord.from_note_index(note=5, quality="7", scale="Amin")
<Chord: E7> # V7 of A minor
Supported Python Versions
- 2.7
- 3.4 and above
Links
- PyPI: https://pypi.python.org/pypi/pychord
- GitHub: https://github.com/yuma-m/pychord
- Documentation: http://pychord.readthedocs.io/en/latest/
Author
License
- MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pychord-0.4.1.tar.gz
(9.5 kB
view details)
File details
Details for the file pychord-0.4.1.tar.gz
.
File metadata
- Download URL: pychord-0.4.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bbfc5948c4420682224425133676424c2c95edccd3212a9546d7171af655f54 |
|
MD5 | f0ff78233cb8234fc2e25572f27092b5 |
|
BLAKE2b-256 | 60bba0ad46070686d28e59b5a55fba7761bdf846a6b2dd59a2e7fffad5ef34d2 |