How can I connect OSCP5 in Processing python

Hi dears, I try to connect with supercollider but I have problems with import OSCP5. Can you help me :c How can I instance OSCP5, I imported with add_library(‘oscP5’).

thanks :smiley:


I hope this is enough to get you started?

from netP5 import *

def setup():
    global oscp5, addr
    oscp5 = OscP5(this, 12000)
    addr = NetAddress('', 12000)
def draw():
def mousePressed():
    msg = OscMessage('/test')
    oscp5.send(msg, addr)

It’s a partial port of this sketch.


it’s perfect! Thanks dude!

1 Like

I have once received data from a friend using supercollider. I don’t know the setup he used there to send things…

# data = dict()
# instruments = ['instrumentA',  'instrumentB', ... ]

def oscEvent(theOscMessage):
    # print theOscMessage
    for instrument in instruments:   
            if theOscMessage and theOscMessage.addrPattern() == "/"+ instrument:
                ins = theOscMessage.get(0).intValue() if theOscMessage.get(0) else 0
                tom = theOscMessage.get(1).intValue() if theOscMessage.get(1) else 0
                amp = theOscMessage.get(2).intValue() if theOscMessage.get(2) else 0
                cor = theOscMessage.get(3).intValue() if theOscMessage.get(3) else 0               
                data[instrument] = (ins, tom, amp, cor)
                # print(instrument, data[instrument])

I guess the main point is to define def oscEvent(theOscMessage): and read from theOscMEssage inside.