S C O T T E R I C P E T E R S E N

Composer, electronic musician, improviser

El MuCo: Server Code

Follows the testing code:

/* El MuCo "Server"

169.254.136.163 - Powerbook self-assigned IP

to reset the environment (clear everything - all responders, senders, etc.)

currentEnvironment.clear;

*/

s.boot;

SynthDef("kane", { |freq = 40|

Out.ar([0,1], SinOsc.ar(freq));

}).send(s);

// SERVER: set the broadcast flag to true

NetAddr.broadcastFlag_(true)

//169.254.255.255 = broadcast IP: 57120 is sclang default port
~server = NetAddr("169.254.255.255", 57120);

// CLOCK: this clock is from the OSCClock quark. Must install first

~clock = OSCClockSender.default.targets = [NetAddr("169.254.255.255", 57120)];
~clock = OSCClockSender.default.start;

/* Use this code to receive the messages and post...

~clockReceiver = OSCClockReceiver.new
~clockReceiver.verbose = true;
currentEnvironment.dump; // see what's in it
currentEnvironment.clear // clear what's in it... everything, caution

*/

// RESPONDERS to incoming messages: basically amounts to message-forwarding

x = Synth("kane");

~kane = OSCresponderNode(nil, '/bkane', { |time, resp, msg|
("Brian:" + msg).postln;
msg.removeAt(0);
x.set("freq", msg.at(1));
~server.sendMsg('/kane', *msg) } ).add;

// ~kane.remove;

~kitten = OSCresponderNode(nil, '/jkitten', { |time, resp, msg|
msg.postln;
msg.removeAt(0);
~server.sendMsg('/kitten', *msg) } ).add;

// ~kitten.remove;

~kling = OSCresponderNode(nil, '/mkling', { |time, resp, msg|
msg.postln;
msg.removeAt(0);
~server.sendMsg('/kling', *msg) } ).add;

// ~kling.remove;

~ky = OSCresponderNode(nil, '/kya', { |time, resp, msg|
msg.postln;
msg.removeAt(0);
~server.sendMsg('/ky', *msg) } ).add;

// ~ky.remove;

~dusty = OSCresponderNode(nil, '/sdusty', { |time, resp, msg|
msg.postln;
msg.removeAt(0);
x.set("freq", msg.at(1)); // remove later
~server.sendMsg('/dusty', *msg) } ).add;

// ~dusty.remove;

// CHAT

// TESTING

// must have a "responder" set to receive the message type '/test'
~server.sendMsg('/test', "You rock the half and half-c*cked");

currentEnvironment.clear;

Int8Array

And something to receive the messages in SC

o = OSCresponderNode(nil, '/test', { |t, r, msg| msg.at(0).postln }).add;
o.remove;

Advertisements

Filed under: Code, El MuCo, , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

My Other Awesome Sites [•_•]

Assault! 375 Aural Assaults!
About me! About me!
MySpace! MySpace!
Google+! Google+!
My (soon-to-be) Company! My (soon-to-be) Company!

Enter your email address to subscribe to this awesome blog and receive notifications of new posts by email!

Join 78 other followers

-

P O S T E R S !

Artspace

-

Artspace

-

Artspace

Featured

INI new haven

Handmade instruments by Scott Petersen and Brian Kane at Artspace New Haven

%d bloggers like this: