-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshift.py
47 lines (42 loc) · 906 Bytes
/
shift.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
notes=[
"C-","C-#","D-","D-#","E-","F-","F-#","G-","G-#","A-","A-#","B-",
"C","C#","D","D#","E","F","F#","G","G#","A","A#","B",
"C+","C+#","D+","D+#","E+","F+","F+#","G+","G+#","A+","A+#","B+"
]
def shift(note,num):
if note=='\n':
return '\n'
for i in range(0,36):
if notes[i]==note:
return notes[i+num]
return ' '
def newsong(song,num):
new_song=''
song1=song.split(' ')
for x in song1:
new_song=new_song+shift(x,num)+' '
return new_song
song='\
B- E G F# E B A F# \n \
E G F# D F B- \n \
B- E G F# E B D+ C+# C+ \n \
A C+ B A# B G E \n \
G B G B \n \
G C+ B A# F# G B A# C+ B B \n \
G B G B \n \
G D+ C# C+ A C+ B A# B G E \n \
'
song1='\
E D# E G# G# G# \n \
G# G# G# A G# F# \n \
E D# E G# G# G# \n \
G# G# G# A G# F# \n \
E D# E F# F# G# \
'
if __name__=='__main__':
print song+'\n\n'
for num in range (-4,8):
x = newsong(song,num)
if '#' not in x:
print x
print '\n'