From cc25bd5bcf62302b92e794bf41354f3914567031 Mon Sep 17 00:00:00 2001 From: vladimir-baca Date: Sat, 5 Oct 2024 21:03:09 +0200 Subject: [PATCH] Jazz it up --- backend/src/models/composition.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/src/models/composition.py b/backend/src/models/composition.py index 6658a59..a22df6e 100644 --- a/backend/src/models/composition.py +++ b/backend/src/models/composition.py @@ -41,8 +41,11 @@ class ChordQuality(str, Enum): minadd4 = "minadd4" add6 = "add6" minadd6 = "minadd6" + dom7adds5 = "dom7adds5" maj9 = "maj9" dom9 = "dom9" + dom9sus4 = "dom9sus4" + dom11 = "dom11" chord_quality_scheme: dict[ChordQuality, tuple] = { @@ -63,8 +66,11 @@ class ChordQuality(str, Enum): ChordQuality.minadd4: (0, 3, 5, 7), ChordQuality.add6: (0, 4, 7, 9), ChordQuality.minadd6: (0, 3, 7, 9), + ChordQuality.dom7adds5: (0, 4, 7, 8, 10), ChordQuality.maj9: (0, 2, 4, 7, 11), ChordQuality.dom9: (0, 2, 4, 7, 10), + ChordQuality.dom9sus4: (0, 2, 5, 7, 10), + ChordQuality.dom11: (0, 2, 4, 5, 7, 10), } # The parse/display names. The first name in each list represents the canonical form we display @@ -86,8 +92,11 @@ class ChordQuality(str, Enum): ChordQuality.minadd4: ["minAdd4", "mAdd4"], ChordQuality.add6: ["add6"], ChordQuality.minadd6: ["minAdd6", "mAdd6"], + ChordQuality.dom7adds5: ["7add#5", "dom7add#5", "7/5+"], ChordQuality.maj9: ["Maj9"], - ChordQuality.dom9: ["dom9"], + ChordQuality.dom9: ["9", "dom9"], + ChordQuality.dom9sus4: ["9sus4", "dom9sus4"], + ChordQuality.dom11: ["11", "dom11"], } chord_quality_canonical_name: dict[ChordQuality, str] = { @@ -141,7 +150,7 @@ class Chord(BaseModel): def parse(cls, label: str) -> "Chord": bass = None dash_splits = label.rsplit("/", 1) - if len(dash_splits) > 1: + if len(dash_splits) > 1 and dash_splits[1] in tones: label = dash_splits[0] bass = Tone.parse(dash_splits[1]) split = 1