Metadata-Version: 2.1
Name: pytheory
Version: 0.1.2
Summary: A music theory library, for humans.
Home-page: https://github.com/kennethreitz/pytheory
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Requires-Dist: pytuning
Requires-Dist: numeral
Requires-Dist: pygame
Requires-Dist: scipy


# PyTheory: Music Theory for Humans

This (work in progress) library attempt to make [exploring music theory](https://colab.research.google.com/drive/1kgyemTsOIE5uVXfGTjS5PS2lPvzqKk6D) approachable to humans.

![logo](https://github.com/kennethreitz/pytheory/raw/master/ext/pytheory-small.png)

PyTheory is a music theory library, which procedurally generates all known Western tones, scales, and chord fingering charts (for custom fretboards).

It is capable of outputting either a rounded decimal for pitch representation, or the proper symbolic representation of the pitch (as a SymPy object).

## True Scale -> Pitch Evaluation

```pycon
>>> from pytheory import TonedScale

>>> c_minor = TonedScale(tonic='C4')['minor']

>>> c_minor
<Scale I=C4 II=D4 III=Eb4 IV=F4 V=G4 VI=Ab4 VII=Bb5 VIII=C5>

>>> c_minor[0].pitch()
523.251130601197

>>> c_minor["I"].pitch(symbolic=True)
440*2**(1/4)

>>> c_minor["tonic"].pitch(temperament='pythagorean', symbolic=True)
14080/27
```

## Audibly play a note (or chord)

    >>> from pytheory import play
    play(c_minor[0], t=1_000)


## Chord Fingerings for Custom Tunings

```pycon
>>> from pytheory import Tone, Fretboard, CHARTS

>>> tones = (
...     Tone.from_string("F2"),
...     Tone.from_string("C3"),
...     Tone.from_string("G3"),
...     Tone.from_string("D4"),
...     Tone.from_string("A5"),
...     Tone.from_string("E5")
... )

>>> fretboard = Fretboard(tones=tones)
>>>
>>> c_chord = CHARTS['western']["C"]

>>> print(c_chord.fingering(fretboard=fretboard))
(0, 0, 0, 3, 3, 3)
```

It can also [generate charts for all known chords](https://gist.github.com/kennethreitz/b363660145064fc330c206294cff92fc) for any instrument (accuracy to be determined!).

✨🍰✨


