Rahn's book was published 1980

This commit is contained in:
Jonathan Harker 2024-09-27 06:39:29 +12:00
parent 4fe7f67cb9
commit eea441b561

View file

@ -4,6 +4,7 @@ class cache_property:
"""
Property that only computes its value once when first accessed, and caches the result.
"""
def __init__(self, function):
self.function = function
self.name = function.__name__
@ -17,6 +18,7 @@ class SetClass(list):
"""
Musical set class, containing zero or more pitch classes.
"""
def __init__(self, *args: int, tonality: int = 12):
"""
Instantiate a Class Set with a series of integers. Each pitch class is "normalised" by
@ -105,7 +107,7 @@ class SetClass(list):
An ordered tuple containing the multiplicities of each interval class in the set class.
Denoted in angle-brackets, e.g.
The interval vector of {0,2,4,5,7,9,11} is 2,5,4,3,6,1
Rahn (1987), p. 100
Rahn (1980), p. 100
"""
from itertools import combinations
iv = [0 for i in range(1, int(self.tonality / 2) + 1)]
@ -118,7 +120,7 @@ class SetClass(list):
"""
The ordered interval or "directed interval" (Babbitt) of two pitch classes is determined by
the difference of the pitch class values, modulo 12:
ia,b = b-a mod 12 Rahn (1987), p. 25
ia,b = b-a mod 12 Rahn (1980), p. 25
"""
return (b % 12 - a % 12) % 12
@ -127,7 +129,7 @@ class SetClass(list):
The unordered interval (also "interval distance", "interval class", "ic", or "undirected
interval") of two pitch classes is the smaller of the two possible ordered intervals
(differences in pitch class value):
i(a,b) = min: ia,b, ib,a Rahn (1987), p. 28
i(a,b) = min: ia,b, ib,a Rahn (1980), p. 28
"""
return min(SetClass.ordered_interval(a, b), SetClass.ordered_interval(b, a))
@ -135,7 +137,7 @@ class SetClass(list):
def versions(self):
"""
Returns all possible zero-normalised versions (clock rotations) of this set class,
sorted by brightness. See Rahn (1987) Set types, Tₙ
sorted by brightness. See Rahn (1980) Set types, Tₙ
"""
# The empty set class has one version, itself
if not self.pitch_classes:
@ -154,7 +156,7 @@ class SetClass(list):
"""
Return the Rahn normal form of the set class; Leonard describes this as "most dispersed from
the right". Find the smallest outside interval, and proceed inwards from the right until one
result remains. See Rahn (1987), p. 33
result remains. See Rahn (1980), p. 33
"""
# Set class {0,2,4,5,8,9} has four darkest versions:
# {0,2,4,5,8,9} B = 28