Skip to content

Instantly share code, notes, and snippets.

@jepler
Created May 25, 2025 17:50
Show Gist options
  • Save jepler/8ed6f77fa587f90b03d40bf58f2b40c1 to your computer and use it in GitHub Desktop.
Save jepler/8ed6f77fa587f90b03d40bf58f2b40c1 to your computer and use it in GitHub Desktop.
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,
)
ao.play(s)
s.press(49)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment