-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVirtualPianoBot.py
57 lines (52 loc) · 2.59 KB
/
VirtualPianoBot.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
48
49
50
51
52
53
54
55
56
57
# Copyright (c) 2021 Azhaan Salam
# Licensed under the MIT License
import pyautogui, time, keyboard
from termcolor import colored
print(colored("sheet name: ", "green"), end="")
choice = input()
class Song:
def __init__(self, reg, new, dash, name, desc):
self.reg = reg # Regular gap between notes (sec)
self.new = new # Newline gap between notes (sec)
self.dash = dash # Gap for dash separated notes (sec)
self.name = name # Name of song
self.desc = desc # Real name and artist(s)
w = [
# All credits to these songs:
Song(0.12, 0.5, None, "holiday", "Holiday by Lil Nas X"),
Song(0.08, None, None, "pirate", "He's A Pirate by Klaus Badelt"),
Song(0.21, None, None, "terimeri", "Teri Meri by Shreya Ghosal and Rafat Fateh Ali Khan"),
Song(0.16, 1, 0.05, "christmas", "All I Want For Christmas Is You by Mariah Carey"),
Song(0.1, 0.27, None, "astronomia", "Astronomia by Vicetone and Tony Igy"),
Song(0.13, None, None, "goldenwind", "Golden Wind from JoJo's Bizzare Adventure"),
Song(0.18, 0.03, None, "snowman", "Do You Want To Build A Snowman by Kristen Anderson-Lopez and Robert Lopez"),
Song(0.17, 0.25, 0.04, "office", "The Office Theme Song"),
Song(0.2, None, 0.03, "avengers", "The Avengers Infinity War Theme"),
Song(0.24, None, None, "birthday", "Happy Birthday"),
Song(0.18, 0.25, 0.1, "furelise", "Fur Elise by Ludwig Van Beethoven"),
Song(0.21, None, None, "unknown", "Into the Unknown by Idina Menzel"),
Song(0.22, None, None, "seeyouagain", "See You Again by Wiz Khalifa"),
Song(0.13, None, 0.0150, "chariots", "Chariots of Fire by Vangelis"),
Song(0.22, None, None, "happier", "Happier by Marshmello")
]
for o in w:
if o.name == choice:
print(colored(f"Press the ] key to start playing {o.desc}!", "yellow"))
while True:
if keyboard.is_pressed("]"):
with open(f"sheets/{o.name}.txt", "r") as text:
f = text.readlines()
for a in f:
if o.new != None:
if a == '\n' == None:
time.sleep(o.new)
for i in a.split():
if o.dash != None:
if i == '-':
time.sleep(o.dash)
continue
pyautogui.typewrite(i)
if keyboard.is_pressed("esc"):
exit(0)
time.sleep(o.reg)
exit(0)