Download pyOSC here: https://trac.v2.nl/wiki/pyOSC And do sudo ipython setup.py install inside the pyOSC folder.
On OSC more here: http://opensoundcontrol.org/introduction-osc
Source: http://www.caseyanderson.com/teaching/ipython-to-supercollider-via-osc/
Load the code below in SC3 (Supercollider): http://supercollider.sourceforge.net/
OSC message to send: s.sendMsg("s_new", \grain, -1, 0, 1, \freq, 200, \sustain, 0.1, \pan, -1.0); // even more efficient, as no Synth object is created.
In [1]:
import OSC
import time, random
client = OSC.OSCClient()
client.connect( ( '127.0.0.1', 57110 ) )
In [2]:
msg = OSC.OSCMessage()
msg.setAddress("s_new")
msg.append("grain")
msg.append(-1)
msg.append(0)
msg.append(1)
msg.append("amp")
msg.append(1)
msg.append("freq")
msg.append(4000)
msg.append("sustain")
msg.append(0.01)
msg.append("pan")
msg.append(0)
client.send(msg)
In [68]:
msg = OSC.OSCMessage()
msg.setAddress("s_new")
msg.append("grain")
msg.append(-1)
msg.append(0)
msg.append(1)
msg.append("amp")
msg.append(1)
msg.append("freq")
msg.append(400)
msg.append("sustain")
msg.append(1)
msg.append("pan")
msg.append(0)
client.send(msg)
In [69]:
import time, sys
for i in range(100):
msg = OSC.OSCMessage()
msg.setAddress("s_new")
msg.append("grain")
msg.append(-1)
msg.append(0)
msg.append(1)
msg.append("amp")
msg.append(1)
msg.append("freq")
msg.append(440)
msg.append("sustain")
msg.append(0.1)
msg.append("pan")
msg.append(0)
client.send(msg)
print(i)
time.sleep(0.04)
In [2]:
%load_ext version_information
%version_information numpy, scipy, matplotlib, sympy, pyosc,
Out[2]:
In [ ]: