File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ #-------------------------------------------------------------------------------
4+ # Minimal example of using python-supercollider.
5+ #
6+ # Before running this script, the SC server must be started, and the following
7+ # SynthDef stored:
8+ #
9+ # SynthDef(\sine, { |out = 0, freq = 440.0, gain = 0.0|
10+ # Out.ar(out, SinOsc.ar(freq) * gain.dbamp);
11+ # }).store;
12+ #-------------------------------------------------------------------------------
13+
14+ from supercollider import Server , Synth
15+ import time
16+
17+ #-------------------------------------------------------------------------------
18+ # Create connection to default server on localhost:57110
19+ #-------------------------------------------------------------------------------
20+ server = Server ()
21+
22+ #-------------------------------------------------------------------------------
23+ # Create a Synth, set its parameter, query the parameter, and free it.
24+ #-------------------------------------------------------------------------------
25+ synth = Synth (server , "sine" , { "freq" : 440.0 , "gain" : - 36.0 })
26+ print ("Created synth" )
27+ synth .get ("freq" , lambda n : print ("Frequency: %.1f" % n ))
28+ time .sleep (1.0 )
29+ synth .free ()
30+ print ("Freed synth" )
You can’t perform that action at this time.
0 commit comments