Metadata-Version: 2.1
Name: semitone
Version: 0.2.0
Summary: Geometric representations of tones and chords
Home-page: https://github.com/mbdeaton/semitone
License: GPL-3.0-or-later
Keywords: music theory,chord,scale,frequency,visualization
Author: Brett Deaton
Author-email: brett.deaton@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Provides-Extra: notebooks
Requires-Dist: jupyter (>=1.0.0,<2.0.0) ; extra == "notebooks"
Requires-Dist: kaleido (==0.2.1) ; extra == "notebooks"
Requires-Dist: pandas (>=2.2.1,<3.0.0)
Requires-Dist: plotly (>=5.19.0,<6.0.0)
Project-URL: Repository, https://github.com/mbdeaton/semitone
Description-Content-Type: text/markdown

# Semitone
A Python package to represent tones, scales, and chords geometrically.

Published at [pypi.org/project/semitone](https://pypi.org/project/semitone).


### Quick Start
For full demos, see the notebooks in `demos/`.

Install with pip:
```sh
pip install semitone
```

Analyze scales:
```python
import semitone as st

scale = st.Major("C")

# Compute frequencies
print(scale)
print(scale.extend(octaves_below=0, octaves_above=2))

# Visualize as a logarithmic spiral
fig = st.SpiralPlot.draw((scale,))
fig.show()

# Visualize equal- vs just-tempered scales together
scale_harm = st.HarmonicOctave("C", max_multiplier=19)
fig = st.SpiralPlot.draw((scale, scale_harm))
fig.show()
```


### Music and Geometry
Each tone is represented as a point on a logarithmic spiral, with its radius
scaling with wavelength (higher tones closer to the center), and its angle
scaling with its progress around the full octave (semitone raises in pitch are
30 deg clockwise rotations).

For example, three octaves of the equal-tempered chromatic scale in C:

![log spiral chromatic C](https://raw.githubusercontent.com/mbdeaton/semitone/refs/heads/main/img/chrom_c.png)

And a just-tempered scale using the first 19 harmonics compressed to a single
octave in C (redundant tones of the same pitch class are eliminated):

![log spiral harmonic-19 C](https://raw.githubusercontent.com/mbdeaton/semitone/refs/heads/main/img/harm_c.png)


### Contributing
For contributing guidelines, see `CONTRIBUTING.md`.

