Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #########################################
- # Created By Lewisk3 / Redxone #
- #########################################
- # Doesnt do numbers yet :/
- # Python Virtual Piano To Real Notes Converter!
- matrix = {
- 'q':'F 1',
- 'w':'G 2',
- 'e':'A 2',
- 'r':'B 2',
- 't':'C 2',
- 'y':'D 2',
- 'u':'E 2',
- 'i':'F 3',
- 'o':'G 3',
- 'p':'A 3',
- 'a':'B 3',
- 's':'C 3',
- 'd':'D 3',
- 'f':'E 4',
- 'g':'F 4',
- 'h':'G 4',
- 'j':'A 4',
- 'k':'B 4',
- 'l':'C 4',
- 'z':'D 5',
- 'x':'E 5',
- 'c':'F 5',
- 'v':'G 5',
- 'b':'A 5',
- 'n':'B 5',
- 'm':'C 5'
- }
- f = input("File with virtual piano notes inside it: ")
- o = input('Output as: ')
- rf = open(f, 'r')
- vpkeys = rf.read()
- rf.close()
- realkeys = vpkeys.split()
- transkeys = ""
- for key in realkeys:
- transkeys += key
- wo = open(o, 'w')
- for char in transkeys:
- maketowrite = str(matrix[str(char).lower()])
- if(str(char).istitle()):
- rch = (maketowrite.upper()).split()[0]
- if rch == 'D' or rch == 'A' or rch == 'C' or rch == 'F' or rch == 'G':
- towritev = maketowrite.split()
- towritev[0] += '#'
- maketowrite = str(towritev[0]) + ' ' + str(towritev[1])
- wo.write( maketowrite + '\n' )
- wo.close()
- print("FINISHED")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement