Replace toScaleDegree with parseSpelledPitchOrScaleDegree to support chord charts written in key signature or numbers.

This commit is contained in:
2026-01-10 10:24:12 -06:00
parent dee33ac299
commit 2f561e5047
2 changed files with 12 additions and 2 deletions

View File

@@ -314,6 +314,16 @@ func toScaleDegree*(k: Key, sp: SpelledPitch): ScaleDegree =
]#
func parseSpelledPitchOrScaleDegree*(key: Key, str: string): ScaleDegree =
try:
let pitch =parseSpelledPitch(str)
return toScaleDegree(key, pitch)
except:
try: return parseScaleDegree(str)
except:
raise newException(ValueError,
str & " is not a recognized pitch or scale degree")
func transpose*(k: Key, steps: int): Key =
Key(