Tutorial
Terminal
# pychuck --help
pychuck demo.py
If you want to use GUI:
pyaudicle
Time Control
from pychuck import *
later = now + 5 * second
while now < later:
print(now)
1 * second >> now
Unit Control
from pychuck import *
# graph
adc >> dac
# main loop
while True:
1 * second >> now
Example
from pychuck import *
# unit
s = SinOsc(freq=440)
# graph
s >> dac
# main loop
while True:
# parameter
s.freq = np.random.randint(100, 1000)
# time
200 * ms >> now
Custom Unit
from pychuck import *
# custom unit
class Noise(UGen):
# generator
def _tick(self, samples: int) -> np.ndarray:
return np.random.uniform(-1, 1, samples)
# unit
n = Noise(gain=0.5)
# graph
n >> dac
# main loop
while True:
# parameter
n.gain = np.random.uniform(0, 1)
# time
200 * ms >> now