diff --git a/setclass/setclass.py b/setclass/setclass.py index 1c2bfcb..30ff090 100644 --- a/setclass/setclass.py +++ b/setclass/setclass.py @@ -235,8 +235,9 @@ class SetClass(list): """ Returns a string representation of this set class using subscripts to denote the adjacency intervals between the pitch classes instead of commas, and the overall brightness (sum of - pitch class values) denoted as a superscript. For example, Forte 5-20, {0,1,5,6,8} is - notated [0₁1₄5₁6₂8₄]²⁰ + pitch class values) denoted as a superscript. In standard tonality (T=12) the letters T and + E are used for pitch classes 10 and 11. For example, Forte 7-34, {0,1,3,4,6,8,10} is + notated [0₁1₂3₁4₂6₂8₂T₂]⁽³²⁾. """ # Return numbers as subscript and superscript strings: def subscript(n: int) -> str: @@ -251,7 +252,8 @@ class SetClass(list): sub = subscript(self.adjacency_intervals[i]) pitches += f"{pitch}{sub}" sup = superscript(self.brightness) - return f"[{pitches}]⁽{sup}⁾" + s = f"[{pitches}]⁽{sup}⁾" + return s.replace('10', 'T').replace('11', 'E') if self.tonality == 12 else s # Class methods ----------------------------------------------------------- diff --git a/setclass/tests/test_aggregate.py b/setclass/tests/test_aggregate.py index 0541071..bb29c58 100644 --- a/setclass/tests/test_aggregate.py +++ b/setclass/tests/test_aggregate.py @@ -57,4 +57,4 @@ def test_empty_complement_dozenal_notation(): def test_empty_complement_leonard_notation(): - assert f121.leonard_notation == '[0₁1₁2₁3₁4₁5₁6₁7₁8₁9₁10₁11₁]⁽⁶⁶⁾' + assert f121.leonard_notation == '[0₁1₁2₁3₁4₁5₁6₁7₁8₁9₁T₁E₁]⁽⁶⁶⁾' diff --git a/setclass/tests/test_setclass.py b/setclass/tests/test_setclass.py index f16c957..9841aae 100644 --- a/setclass/tests/test_setclass.py +++ b/setclass/tests/test_setclass.py @@ -106,7 +106,7 @@ def test_brightest_form(): b = f520.brightest_form assert b in f520.versions assert b == SetClass(0, 4, 5, 9, 10) - assert b.leonard_notation == '[0₄4₁5₄9₁10₂]⁽²⁸⁾' + assert b.leonard_notation == '[0₄4₁5₄9₁T₂]⁽²⁸⁾' def test_darkest_form(): @@ -184,14 +184,14 @@ def test_complement_brightest_form(): b = f520.complement.brightest_form assert b in f520.complement.versions assert b == SetClass(0, 3, 5, 6, 7, 10, 11) - assert b.leonard_notation == '[0₃3₂5₁6₁7₃10₁11₁]⁽⁴²⁾' + assert b.leonard_notation == '[0₃3₂5₁6₁7₃T₁E₁]⁽⁴²⁾' def test_complement_darkest_form(): d = f520.complement.darkest_form assert d in f520.complement.versions assert d == SetClass(0, 1, 2, 5, 6, 7, 10) - assert d.leonard_notation == '[0₁1₁2₃5₁6₁7₃10₂]⁽³¹⁾' + assert d.leonard_notation == '[0₁1₁2₃5₁6₁7₃T₂]⁽³¹⁾' def test_complement_leonard_notation():