Oscillators

import zrna
z = zrna.api.Client()
z.connect()
z.clear()
z.set_divisor(z.CLOCK_SYS1, 2)

# Using oscillator modules is
# similar to the gain and filter modules we
# covered previously except that in
# their basic form they have only outputs

# Let's generate a sawtooth wave at 1kHz
# and send it to the audio output
osc = z.OscillatorSaw()
osc.set_clock(z.CLOCK3)
z.add(osc)

osc.oscillation_frequency = 1.0
osc.peak_amplitude = 1.0

audio_out = z.AudioOut()
z.add(audio_out)

osc.saw.connect(audio_out.input)

z.run()
Privacy

© 2024 Zrna Research