2023-03-12 17:46:11 +00:00
|
|
|
import math
|
|
|
|
import os
|
|
|
|
import sys
|
2023-03-17 02:59:41 +00:00
|
|
|
import sounddevice as sd
|
|
|
|
import yue
|
2023-03-12 17:46:11 +00:00
|
|
|
|
|
|
|
# Number of times to sample each second
|
|
|
|
bitrate = 44100
|
|
|
|
|
|
|
|
|
|
|
|
note = []
|
|
|
|
for i in range(0, 24):
|
2023-03-22 02:56:34 +00:00
|
|
|
note.append([yue.seething(yue.freq(4, i), j / bitrate) / 4 for j in range(0, 3 * bitrate)])
|
2023-03-12 17:46:11 +00:00
|
|
|
|
|
|
|
sd.default.samplerate = bitrate
|
2023-03-17 02:59:41 +00:00
|
|
|
print("READY")
|
2023-03-12 17:46:11 +00:00
|
|
|
|
|
|
|
while True:
|
2023-03-17 02:59:41 +00:00
|
|
|
os.system("stty raw -echo")
|
2023-03-12 17:46:11 +00:00
|
|
|
c = sys.stdin.read(1)
|
2023-03-17 02:59:41 +00:00
|
|
|
os.system("stty -raw echo")
|
2023-03-12 17:46:11 +00:00
|
|
|
|
2023-03-17 02:59:41 +00:00
|
|
|
x = "`1234567890-~!@#$%^&*()_".index(c)
|
2023-03-12 17:46:11 +00:00
|
|
|
print(x)
|
|
|
|
|
|
|
|
sd.play(note[x])
|