A Python package to represent tones, scales, and chords geometrically.
Published at pypi.org/project/semitone.
For full demos, see the notebooks in demos/.
Install with pip:
pip install semitoneAnalyze scales:
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()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:
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):
For contributing guidelines, see CONTRIBUTING.md.

