Discussion

You need to log in to create posts and topics.

About simultaneous connection of Super Collider and another Software

Hello, I am currently thinking of using FoxDot to simultaneously produce music and video.
As a method for doing this, I am considering sending an OSC signal sent by FoxDot to a port different from SuperCollider at the same time as sending a signal to SuperCollider.
I am considering communication by UDP communication.
For that, how do you write it in what part of the source code?

Hi Kirikumo,

Currently things aren't too flexible (although I can think of adding something  that would make it easier), but if you wanted to send messages to another OSCServer, the best thing to do would be look  in ServerManager.py and in the "send" method, which looks like this:

def send(self, address, message):
    """ Sends message (a list) to SuperCollider """
    msg = OSCMessage(address)
    msg.append(message)
    self.client.send(msg)
    return

You would need to create an OSCClient object, from the OSC module, and connect it to the address and port of your choosing in the in __init__ of the SCLangServerManager class in ServerManager.py. Then edit the "send" method to also send the message to your own client  e.g.

def __init__(self, addr, osc_port, sclang_port):
    ...
    self.forward = OSCClient()
    self.forward.connect((ip_addr, port))
    ...
def send(self, address, message):
    ...
    self.forward.send(msg)
    return

I could always add a "forward" address and port to the constructor or something so you could add this during run time. Hope this helps - let me know if there's anything else.

Thank you very much.

As a result of trying this method, the OSC signal seems to be sent to the port specified at FoxDot startup. However, the OSC signal and sync signal for playing the synthesizer were not sent.

Do you know why?

And what part is actually being executed according to the clock?

Hi Kirikumo,

Can you copy and paste the sections of code you are using/changing? Long story short; when a "player" is called it creates an OSC bundle for triggering it's SynthDef and Effects. This can take a little while if there's lots of players etc so the "Clock" has a 1/4 second latency period where it prepares all of the necessary OSC messages then waits until the end of the latency period and sends them to SuperCollider (this is in TempoClock.py - QueueBlock.send_osc_messages, line 648). Hope that makes sense.

Thank you for your reply.

 

I added a code to ServerManager.py as follows.

class SCLangServerManager(ServerManager):

fxlist = None

def __init__(self, addr, osc_port, sclang_port):

self.addr = addr
self.port = osc_port
self.SCLang_port = sclang_port

self.booted = False
self.wait_time = 5
self.count = 0

self.client = SCLangClient()
self.client.connect( (self.addr, self.port) )

self.sclang = SCLangClient()
self.sclang.connect( (self.addr, self.SCLang_port) )

    self.myOSC = OSCClient()
    self.myOSC.connect( ("127.0.0.1", 9000) )

 

def bufferRead(self, path, bufnum):
""" Sends a message to SuperCollider to read an audio file into a buffer """
message = OSCMessage("/b_allocRead")
message.append([bufnum, path])
self.client.send( message )
    self.myOSC.send( message )
return

 

def sendOSC(self, packet):
""" Compiles and sends an 's_new' OSC message for SuperCollider """
message = OSCMessage("/s_new")
node = packet[1] = self.nextnodeID()
message.append(packet)
self.client.send( message )
    self.myOSC.send( message )
return

 

def send(self, address, message):
""" Sends message (a list) to SuperCollider """
msg = OSCMessage(address)
msg.append(message)
self.client.send(msg)
    self.myOSC.send(msg)
return

 

But only bufferRead () seems to be sent successfully.

 

Hmm that's very strange. I'm in no way an expert on OSC so I'm not sure how helpful I can be.  Are you getting any error messages?

There is no error.
At the moment, I was able to branch the osc signal by sandwiching max / msp between foxdot and supercollider.
Thank you for your help.