Skip to content

mbdeaton/semitone

Repository files navigation

Semitone

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

Published at pypi.org/project/semitone.

Quick Start

For full demos, see the notebooks in demos/.

Install with pip:

pip install semitone

Analyze 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()

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

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

Contributing

For contributing guidelines, see CONTRIBUTING.md.

About

Python package to represent tones, scales, and chords geometrically

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors