The numbering module
Functions dealing with numbering of voices, parts etcetera.
- int2roman(n)[source]
Convert an integer value to a roman number string.
E.g. 1 -> “I”, 12 -> “XII”, 2015 -> “MMXV”
n
has to be an integer >= 1; raises ValueError otherwise.
- roman2int(s)[source]
Convert a string with a roman numeral to an integer.
E.g. “MCMLXVII” -> 1967, “iii” -> 3
Raises a KeyError on invalid characters.
- int2letter(n, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ')[source]
Convert an integer to one or more letters.
E.g. 1 -> “A”, 2 -> “B”, … 26 -> “Z”, 27 -> “AA”, etc. Zero returns the empty string.
chars is the string to pick characters from, defaulting to
string.ascii_uppercase
.
- letter2int(s, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ')[source]
Convert a string with letters to an integer.
E.g. “AA” -> 27
An empty string yields 0. Raises a ValueError when a character is not available in
chars
(which defaults tostring.ascii_uppercase
).