Wednesday, September 13, 2006

Week7 - SuperCollider - OSC & Network Control

This is my 41st post on my blog for the year and it contains more SuperCollider code. This time it actually works. My code sends the sound from my SynthDef to a target computer over the network. I have not yet worked out how it will control something (like a synth). Thus, the use of this patch may be a little futile. However, you could play a joke on someone else. When someone leaves their computer unattended, you could grab their IP address and boot SC, and then at your discretion remotely send sound to them.

Here's the code:
REMOTESYNTH
(
//Variables
var netConnect,
ipAddress = "129.127.196.21",
portName = 57110,
newServer = "Blah";

//Connect to Computer
netConnect = NetAddr(
hostname: ipAddress,
port: portName
);
//Create new Server
~serv = Server.new(
name: newServer,
addr: netConnect
);

//SYNTHDEF => SEND TO SERVER

//Ambient Layer
SynthDef(
\ambient,

{
//Arguments
arg resFreq = 500,
crackleMul = 0.15,
dur = 6,
legato = 4;

//Variables
var ambient,
osc,
env;


//Crackle
ambient = Ringz.ar( Crackle.ar(1.1, crackleMul),
resFreq,
1.2,
0.5
);

//Envelope
osc = ambient * EnvGen.kr(Env.perc(
0,
dur*legato),
doneAction:2
);
//Output
Out.ar(0, [osc, osc]);
}
).send(~serv);
)

( //Synth Instance
h = Synth(
defName: \ambient,
target: ~serv);
)

( //Send Parameters
h.set(\resFreq, 1000);
)


I think with most of my patches I probably only have a tiny little thing wrong with them that results in a patch that will not work. Repairing my patches will have to be added to my list of mid-semester break tasks.

REFERENCES:
Haines, Christian. 2006. Open Sound Control and Network Control. Tutorial presented at the Electronic Music Unit, University of Adelaide, 7 September.

0 Comments:

Post a Comment

<< Home