Replace toScaleDegree with parseSpelledPitchOrScaleDegree to support chord charts written in key signature or numbers.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user