I come from the background music, so I was interested in introducing the theory of music in a Python script.
Basically, musical note variables are assigned to numbers (C = 0, C sharp = 1, etc.). However, the theory of musical sets only works up to the number 11, since B = 11, and the next C will again be = 0.
I have already assigned some variables, they look like this.
Bs = C = 0
Cs = Db = 1
D = 2
Ds = Eb = 3
E = Fb = 4
F = Es = 5
Fs = Gb = 6
G = 7
Gs = Ab = 8
A = 9
As = Bb = 10
B = Cb = 11
m2 = 1
mj2 = 2
m3 = 3
mj3 = 4
P4 = 5
T = 6
P5 = 7
m6 = 8
mj6 = 9
m7 = 10
mj7 = 11
I want to be able to add notes and intervals together, for example, B plus perfect 5. Usually it will be 11 + 7 = 18, but I want it to be 6 (since 6 = F sharp, and B and F sharp are ideal 5 place).
I think I need something like that, but I have no idea how to implement it.
if answer >= 12:
answer - 12
Does anyone have any ideas? Is there a better way to do this?