Just intonation classes¶
This module provides pure Python classes for experimenting with Just intonation (music made from frequency ratio relationships rather than equal divisions of the octave):
Interval(numerator, denominator)- Represents musical interval ratios/rational intervals, a relative step between pitches.numerator- Numerator after reducing to simplest form.denominator- Denominator after reducing to simplest form.complement- The inversion or octave complement of the interval (P4 → P5, etc.).odd_limit- The smallest odd limit of an interval.prime_limit- Prime limit or harmonic limit of an interval.kees_height- Kees semi-height.benedetti_height- Benedetti height.tenney_height- Tenney heightMathematical operations like addition of intervals, multiplication by integers, etc.
Convenience intervals
P1- Unisonm2- Minor secondM2- Major secondm3- Minor thirdM3- Major thirdP4- Perfect fourthP5- Perfect fifthetc.
Chord(4, 5, 6),Chord(Interval('M3'), Interval('P5')), etc. - Class that represents chords/triads, a combination of multiple intervals.terms- List of terms in the frequency ratio that makes up the chord.intervals- List of musical intervals that make up the chord, relative to the root.steps- List of musical intervals which, stacked together, produce the chord.all_steps- Set of all music intervals that can be made by any tone in the chord with any other tone.odd_limit- The intervallic odd-limit.prime_limit- The highest prime limit of any interval found in the Chord.inversion(n)- The nth inversion of a chord
Pitch(frequency)- Class that represents absolute frequencies.frequency- Value of the frequency in hertz
Probably all of this is redundant with Scala, but
I don’t know how to use it.
I wanted to learn by doing:
Just Intonation
Object-oriented Python
Unit testing
Usage¶
>>> Chord(4, 5, 6).intervals
(Interval(5, 4), Interval(3, 2))
>>> M3 + m3
Interval(3, 2)
>>> Interval('P5').complement == P4
True
>>> Pitch(440) + P5
Pitch(660)
Installation¶
One possibility is to install with pip from GitHub:
pip install git+https://github.com/endolith/just_intonation.git
Examples¶
Everything is a power chord in just intonation - Dyads made from the harmonic series, first in piano, then undistorted guitar, then distorted guitar.
Enumerating the rationals - A small portion of the Calkin-Wilf sequence, played on a fractal piano with an infinite number of keys.