tonal_int

tonal_int(x: tuple[int, ...])

Returns the directed (+/-) distance in half steps from the origin (Middle C).

Examples

>>> tonal_int((4,7))
7
>>> tonal_int((4,7,2))
31
>>> tonal_int((6,11,-1))
-1
>>> tonal_int((0,-1,-1))
-13
>>> tonal_int((6,0,0))
12
>>> tonal_int((0,11,0))
-1
>>> tonal_int((0,11))
-1
>>> tonal_int((2, 0))
0

The chromatic value is read as the alteration nearest the letter’s natural, so a tuple can carry up to six half-steps of alteration either way (the difference of D-sharp and F-double-flat is a quadruply diminished third):

>>> tonal_int((2, 0, 0))
0
>>> tonal_int((0, 8, 0)), tonal_int((0, 6, 0))
(-4, 6)