Fix output to preserve internal tuple order

- Remove sorted_by_frequency from write functions
- Output now uses internal chord._pitches order instead of sorted
This commit is contained in:
Michael Winter 2026-03-12 18:18:40 +01:00
parent ccf90d19e1
commit 2b422d55fe

View file

@ -843,7 +843,7 @@ def write_chord_sequence(seq: list[Chord], path: str) -> None:
serializable = [] serializable = []
for chord in seq: for chord in seq:
chord_data = [] chord_data = []
for pitch in chord.sorted_by_frequency(): for pitch in chord._pitches:
chord_data.append( chord_data.append(
{ {
"hs_array": list(pitch.hs_array), "hs_array": list(pitch.hs_array),
@ -868,7 +868,7 @@ def write_chord_sequence_readable(seq: list[Chord], path: str) -> None:
with open(path, "w") as f: with open(path, "w") as f:
f.write("(\n") f.write("(\n")
for i, chord in enumerate(seq): for i, chord in enumerate(seq):
arrays = tuple(p.hs_array for p in chord.sorted_by_frequency()) arrays = tuple(p.hs_array for p in chord._pitches)
f.write(f" {arrays},\n") f.write(f" {arrays},\n")
f.write(")\n") f.write(")\n")