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);
)

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