Multiple sclang clients -> one scsynth server


I am trying to open several terminals on Linux each with a single sclang instance and I would like to boot a single server which will receive message from the many clients. How is it possible to do this?

I tried the options here Multi-client Setups but I can´t manage it. Only the sclang on the terminal that I have booted the server is capable of sending messages to the server…

Can someone please post an example of how to proceed?

I’ve realized that I should not boot into the server again if all the clients are local.

For having multiple sclang controlling a server a that is local (NetAddr("", 57110)) I am using the following:

// terminal 1
// on terminal type sclang then
s.options.maxLogins= 10
s.options.bindAddress= "" //allow incoming from everywhere
s.reboot;    //and boot your local scsynth server

// test sound
a = {*}.play

// terminal 2
r = Server(\r, NetAddr("", 57110)).makeWindow  //IP and port of your own computer, localhost
Ndef(\fm-> \r, { *,1.5))*0.1 }).play

However, from a language point of view, is it possible to connect the second sclang (terminal 2) to the scsynth and still use the same traditional syntax (without having to write Ndef(\somename-> \serverName, all the time)?

Also, a really silly question, after booting sclang on a linux terminal, how is it possible to kill the sclang and go back to terminal?

This document may be a bit out of date.

AFAIK Server.remote is the recommended way, since it does the handshaking automatically. (Also, the help file suggests assigning a clientID by hand – but the logic already exists for the server to return an unused clientID, so, why introduce complication? IIRC it was Alberto who put a lot of work into streamlining the process, and it’s pretty clean now):

// in the "main" sclang:
Server.default.options.maxLogins = 4;

// in the remote sclang:
~myRemoteServer = Server.remote(\remote, NetAddr("", 57110), Server.default.options.copy);

// terminal prints:
remote : setting clientID to 0.
-> Server
sc3> Requested notification messages from server 'remote'
remote: server process has maxLogins 4 - adjusting my options accordingly.
remote: setting clientID to 1, as obtained from server process.
remote : setting clientID to 1.

The ServerOptions object is up to you – here, I’m assuming you would want to start with the options in the default server, but you can provide any ServerOptions object you want.

The element you’re missing is assigning the default server.

// in the remote sclang
Server.default = ~myRemoteServer;

Ndef(\fm, { *,1.5))*0.1 }).play;


In Linux, at least, ctrl-D will also kill it forcibly, but if you can run the ‘exit’ method, that’s the ideal way to quit.


1 Like