Skip to content

Instantly share code, notes, and snippets.

@deeuu
Last active March 26, 2020 21:54
Show Gist options
  • Select an option

  • Save deeuu/a911e1f5663e4c613717e5a1f7410f0d to your computer and use it in GitHub Desktop.

Select an option

Save deeuu/a911e1f5663e4c613717e5a1f7410f0d to your computer and use it in GitHub Desktop.
Basic SC Synth example in Supriya
"""
SynthDef(\pure, {|freq=1000| Out.ar(0, SinOsc.ar(freq)); }).add;
Synth(\pure, [\freq, 440]);
"""
import supriya
import time
path = '/Applications/SuperCollider.app/Contents/Resources/scsynth'
server = supriya.Server.default()
server.boot(scsynth_path=path)
def buildSynthDef():
with supriya.synthdefs.SynthDefBuilder(freq=1000) as builder:
out = supriya.ugens.Out.ar(
bus=0,
source=supriya.ugens.SinOsc.ar(frequency=builder['freq']),
)
return builder.build()
synthdef = buildSynthDef().allocate(server=server)
supriya.Synth(freq=440, synthdef=synthdef).allocate(server=server)
time.sleep(2)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment