27 lines
488 B
Python
27 lines
488 B
Python
import math
|
|
import os
|
|
import sys
|
|
import sounddevice as sd
|
|
import yue
|
|
|
|
# Number of times to sample each second
|
|
bitrate = 44100
|
|
|
|
|
|
note = []
|
|
for i in range(0, 24):
|
|
note.append([yue.seething(yue.freq(4, i), j / bitrate) / 4 for j in range(0, 3 * bitrate)])
|
|
|
|
sd.default.samplerate = bitrate
|
|
print("READY")
|
|
|
|
while True:
|
|
os.system("stty raw -echo")
|
|
c = sys.stdin.read(1)
|
|
os.system("stty -raw echo")
|
|
|
|
x = "`1234567890-~!@#$%^&*()_".index(c)
|
|
print(x)
|
|
|
|
sd.play(note[x])
|