Last active
March 26, 2020 21:54
-
-
Save deeuu/a911e1f5663e4c613717e5a1f7410f0d to your computer and use it in GitHub Desktop.
Basic SC Synth example in Supriya
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
| """ | |
| 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