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;

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

Simple Semi-Stochastic Music Language Examples

An article in the June 1979 issue of Computer Music Journal (Vol.3, No.2, Jun., 1979) inspired me to see how easy it would be to impliment “very simple” examples of semi-stochastic music in SuperCollider.  The algorithmic function is the focus of the following examples, which took about 10 minutes to code.  The code uses two different interval sets, a whole-tone set (a) and a simple scale (c) in order to make the algorithm audibly clear.  You can cut and paste the following code into SuperCollider and run it your self to hear the results.  Select and run the .plot code afterwards to see the envelope of pitch choice.  I will upload screen-shots of the plots and audio soon.

// Simple Semi-Stochastic Music Language (SSMLT) #1: the logorithmic curve

(
s.waitForBoot;

///////////////SYNTHDEFS//////////////////////////

SynthDef(“plunk”, {|freq|

var env = EnvGen.kr(Env.perc, 1, doneAction:2);
var sound = SinOsc.ar(freq);
Out.ar([0,1], sound * env * 0.5);

}).send(s);

//////////////////////////////////////////////////

///////////////VARIBLES///////////////////////////

a = [0,-10,-8,-6,-4,-2,0,2,4,6,8,10,0];
b = [0.5,1];
c = [0,1,3,5,7,9,11];

//////////////////////////////////////////////////

//////////Routines////////////////////////////////

(
~plot = List[];
~notes = List[];

r = Routine({

var num = 50;

num.do({|i|

var array = [num-(i+ (i/ (0.5*num))), (i/ (0.5*num))].normalizeSum.postln;
var notes = [a.choose,c.choose].wchoose(array).postln;

~plot.add(array.at(0));
~plot.add(array.at(1));
~notes.add(notes);

Synth(“plunk”, [\freq, (70 + notes).midicps]);

0.25.wait;
}); // outer ‘do’

});
)
)

//////////////////////////////////////////////////

/////////////CONTROL–GO TIME/////////////////////

r.reset.play;

//////////////////////////////////////////////////

///////////////PLOT IT////////////////////////////

(
~plot.asArray.plot(“turd plot terror attack”, numChannels:2);
~notes.asArray.plot(“turd plorp poopy attack”, discrete: true);
)

//////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
/***********************************NEXT************************************/
/////////////////////////////////////////////////////////////////////////////

// Simple Semi-Stochastic Music Language (SSMLT) #2: the linear curve

(
s.waitForBoot;

///////////////SYNTHDEFS//////////////////////////

SynthDef(“plunk”, {|freq|

var env = EnvGen.kr(Env.perc, 1, doneAction:2);
var sound = SinOsc.ar(freq);
Out.ar([0,1], sound * env * 0.5);

}).send(s);

//////////////////////////////////////////////////

///////////////VARIBLES///////////////////////////

a = [0,-10,-8,-6,-4,-2,0];
b = [0.5,1];
c = [0,1,3,5,7,9,11,12];

//////////////////////////////////////////////////

//////////Routines////////////////////////////////

(
~plot = List[];
~notes = List[];

r = Routine({

var num = 50;

num.do({|i|

var array = [num-i, i].normalizeSum.postln;
var notes = [a.choose,c.choose].wchoose(array).postln;

~plot.add(array.at(0));
~plot.add(array.at(1));
~notes.add(notes);

Synth(“plunk”, [\freq, (70 + notes).midicps]);

0.25.wait;
}); // outer ‘do’

});
)

)

//////////////////////////////////////////////////

/////////////CONTROL–GO TIME/////////////////////

r.reset.play;

//////////////////////////////////////////////////

///////////////PLOT IT////////////////////////////

(
~plot.asArray.plot(“Weighted Choice”, numChannels:2);
~notes.asArray.plot(“Resulting Pitches”, discrete: true);
)

//////////////////////////////////////////////////

Filed under: Code, , , , ,

G O I N G S O N : L O C A L (ISH)

fritz Art of Fritz Horstman
kane Music of Brian Kane
fritz Hartford Phase Shift
fritz Hartford Sound Alliance
Lique Art of Philip Lique
Lique Music of Matt Sargeant
strycharz Art of Heather Strycharz
uncertainty Uncertainty Music Series

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 81 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