audio - Using supercollider with python -
i want real time sound processing , heard supercollider
and looks great, want stick python far 'normal' programming issue.
is there way load python script module supercollider or oposite?
meaning importing library python code , using supercollider features?
i did not find info in web great.
i not aware of python implementation of supercollider, easy communicate between sc , python opensoundcontrol. here sample code, tutorial along these lines wrote class @ art center, shows how send control information python sc (used here audio engine). first sc part:
s.boot; ( synthdef( \sin, { | amp = 0.01, freq = 333, trig = 1 | var env, sig; env = envgen.kr( env.asr( 0.001, 0.9, 0.001 ), trig, doneaction: 0 ); sig = lftri.ar( [ freq, freq * 0.999 ], 0.0, amp ) * env; out.ar( [ 0 ], sig * 0.6 ); }).add; h = synth( \sin, [ \amp, 0.4 ] ); x = oscfunc( { | msg, time, addr, port | var pyfreq; pyfreq = msg[1].asfloat; ( "freq " + pyfreq ).postln; h.set( \freq, pyfreq ); }, '/print' ); )
now python part:
import osc import time, random client = osc.oscclient() client.connect( ( '127.0.0.1', 57120 ) ) msg = osc.oscmessage() msg.setaddress("/print") msg.append(500) client.send(msg)
so, still need write code in sc (to generate type of audio, establish connection between python , sc), else in python. see link tutorial page more in depth explanation (as basic explanation of working sc).
Comments
Post a Comment