Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kennethreitz/pytheory
Music Theory for Humans.
https://github.com/kennethreitz/pytheory
hacktoberfest music music-theory python scales sympy
Last synced: 30 days ago
JSON representation
Music Theory for Humans.
- Host: GitHub
- URL: https://github.com/kennethreitz/pytheory
- Owner: kennethreitz
- Created: 2018-08-29T10:59:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-29T03:59:09.000Z (4 months ago)
- Last Synced: 2024-10-01T20:43:24.815Z (about 1 month ago)
- Topics: hacktoberfest, music, music-theory, python, scales, sympy
- Language: Python
- Homepage:
- Size: 491 KB
- Stars: 1,454
- Watchers: 72
- Forks: 76
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# PyTheory: Music Theory for Humans
This (work in progress) library attempts to make exploring music theory approachable to humans.
![logo](https://github.com/kennethreitz/pytheory/raw/master/ext/pytheory-small.png)
## True Scale -> Pitch Evaluation
```pycon
>>> from pytheory import TonedScale>>> c_minor = TonedScale(tonic='C4')['minor']
>>> c_minor
>>> 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!).
✨🍰✨