Skip to content

endolith/just_intonation

Repository files navigation

Just intonation classes

Actions Status codecov

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
  • Convenience intervals
    • P1 - Unison
    • m2 - Minor second
    • M2 - Major second
    • m3 - Minor third
    • M3 - Major third
    • P4 - Perfect fourth
    • P5 - Perfect fifth
    • etc.
  • 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

  1. I don't know how to use it.
  2. 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

About

Just intonation classes for music theory experiments in Python

Topics

Resources

Stars

Watchers

Forks

Languages