Chroma
The Chroma class contains some static helper methods for extracting information from “chroma”, the signed distance of a Pitch from C or an interval from the unison in perfect 5ths.
Methods
Section titled “Methods”to_letter
Section titled “to_letter”Chroma.to_letter(chroma: int) -> str # static methodReturns the letter component of the pitch class name represented by a given Pitch chroma.
Chroma.to_letter(0) # "C"Chroma.to_letter(6) # "F" (the letter component of F#)to_accidental
Section titled “to_accidental”Chroma.to_accidental(chroma: int) -> int # static methodReturns the accidental component of the pitch class name represented by a given Pitch chroma.
- 0 is natural.
- +1 / -1 is sharp/flat.
- +2 / -2 is double sharp/double flat. etc. for arbitrarily remote accidentals.
Chroma.to_accidental(0) # 0Chroma.to_accidental(6) # 1 (F# is sharp)