Created
May 26, 2025 07:15
-
-
Save jepler/2378eb9c925707d6d52e757b4374f23e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import array | |
import time | |
import math | |
import audiosdl | |
import synthio | |
sine = array.array('h', | |
(int(math.sin(i * 2 * math.pi / 1024) * 32000) for i in range(1024))) | |
print(min(sine), max(sine)) | |
ao = audiosdl.AudioOut(48000) | |
s = synthio.Synthesizer(sample_rate=48000,channel_count=2, | |
waveform=sine, | |
envelope=synthio.Envelope(), | |
) | |
ao.play(s) | |
if __name__ == '__main__': | |
o = [0, 4, 7, 12, 7, 4] | |
while True: | |
for i in o: | |
s.release_all_then_press(69+i) | |
time.sleep(.2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment