Last active
July 29, 2016 07:10
-
-
Save hcgatewood/e1f42b371ab56037eeda to your computer and use it in GitHub Desktop.
Print a random note at the passed interval, defaulting to every 4 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Prints a random note at the passed interval, defaulting to every | |
4 seconds. | |
@author Hunter Gatewood | |
''' | |
import itertools | |
import random | |
import time | |
import sys | |
notes = 'A B C D E F G'.split() | |
acc_symbs = ['', '♯', '♭'] | |
combinations = [''.join(el) for el in itertools.product(notes, acc_symbs)] | |
try: | |
interval = int(sys.argv[1]) | |
except: | |
interval = 4 | |
while True: | |
time.sleep(interval) | |
print(random.choice(combinations)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment