///////////////////////////////////////////////////
// History, as it was on Fri Aug 18 20:27:02 2006.
///////////////////////////////////////////////////

// - 0:0:0 -  
//longer term form will be the new topic, with algorithmic composition

// - 0:1:37.31 -  
e=Env(Array.rand(10,0.0,1.0),Array.rand(10,0.0,5.0));

// - 0:3:54.67 -  
e=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,5.0),-4,9,0);

// - 0:4:47.84 -  
SynthDef(\lcsynth1, {arg out=0, amp=0.1, pan=0.0, freq=440, sustain=0.1,index=2,modf=0.7; 
var sound, env;

//env=EnvGen.ar(Env([1,0],[sustain],'lin'),doneAction:2);

sound=SinOsc.ar(SinOsc.ar(modf,0,modf*index,freq),0,amp);

Out.ar(out, Pan2.ar(sound,pan))
}).store;

// - 0:6:24.03 -  
~s1=Synth(\lcsynth1, [\freq,100,\modf,10,\index,3])	

// - 0:6:53.2 -  
~s1.free

// - 0:6:59.2 -  
~s1=Synth(\lcsynth1, [\freq,100,\modf,10,\index,3,\amp,0.3])	

// - 0:9:29.63 -  
Tdef(\lctask1,{arg task;
var now=0.0;

task.clock.postln;

inf.do {

~s1.set(e.at(now));
1.0.wait;
};

}).play;

// - 0:9:53.38 -  
Tdef(\lctask1,{arg task;
var now=0.0;

task.clock.postln;

inf.do {

~s1.set(\freq,100*(e.at(now))+50);
1.0.wait;
};

}).play;

// - 0:10:18.81 -  
Tdef(\lctask1,{arg task;
var now=0.0;

inf.do {

task.clock.postln;

~s1.set(\freq,100*(e.at(now))+50);
1.0.wait;
};

}).play;

// - 0:10:44.8 -  
Tdef(\lctask1,{arg ...args;
var now=0.0;

inf.do {

args.postln;

~s1.set(\freq,100*(e.at(now))+50);
1.0.wait;
};

}).play;

// - 0:11:4.09 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

Main.elapsedTime.postln;

~s1.set(\freq,100*(e.at(now))+50);
1.0.wait;
};

}).play;

// - 0:11:19.75 -  
thisThread.beats

// - 0:11:22.79 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;

~s1.set(\freq,100*(e.at(now))+50);
1.0.wait;
};

}).play;

// - 0:11:38.83 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;

~s1.set(\freq,100*(e.at(thisThread.beats))+50);
1.0.wait;
};

}).play;

// - 0:11:51.44 -  
e.plot;

// - 0:12:17.7 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;

~s1.set(\freq,1000*(e.at(thisThread.beats))+100);
1.0.wait;
};

}).play;

// - 0:12:34.27 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;
e.at(thisThread.beats).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats))+100);
1.0.wait;
};

}).play;

// - 0:12:49.09 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;
e.at(thisThread.beats%100).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats))+100);
1.0.wait;
};

}).play;

// - 0:13:8.6 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;
e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats))+100);
1.0.wait;
};

}).play;

// - 0:13:22.13 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

thisThread.beats.postln;
e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats%20))+100);
1.0.wait;
};

}).play;

// - 0:13:53.97 -  
e.times

// - 0:13:57.24 -  
e.times.sum

// - 0:14:16.17 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats%(e.times.sum)))+100);
1.0.wait;
};

}).play;

// - 0:15:3.18 -  
~e2=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,5.0),-4,9,0);

// - 0:15:5.72 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,100*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
1.0.wait;
};

}).play;

// - 0:15:26.73 -  
e=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,1.0),-4,9,0);

// - 0:15:33.5 -  
~e2=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,1.0),-4,9,0);

// - 0:15:57.97 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,100*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.1.wait;
};

}).play;

// - 0:17:51.06 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.1.wait;
};

}).play;

// - 0:18:9.52 -  
//competing envelopes

// - 0:19:2.72 -  
Tdef(\lctask3,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\amp,(~e2.at(thisThread.beats%(~e2.times.sum)))*exprand(0.1,1.0), \index,10*(e.at(thisThread.beats%(e.times.sum)))+0.1);
0.1.wait;
};

}).play;

// - 0:19:18.7 -  
e=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,10.0),-4,9,0);

// - 0:19:25.45 -  
~e2=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,10.0),-4,9,0);

// - 0:20:6.35 -  
//I like it!

// - 0:20:16.2 -  
//but still problem of where to go in longterm	

// - 0:20:37.24 -  
~e3=Env(Array.rand(11,0.0,1.0),Array.rand(10,0.0,3.0),-4,9,0);

// - 0:22:7.07 -  
SynthDef(\lcsynth2, {arg out=0, amp=0.1, pan=0.0, freq=4.4, sustain=0.1; 
var sound, env;

sound=SinOsc.ar(freq,[0,pi*0.5],[0.5,0.4],0.5)*In.ar(0,2);

Out.ar(out,sound)
}).store;

// - 0:23:10.83 -  
SynthDef(\lcsynth2, {arg out=0, amp=0.1, pan=0.0, freq=4.4, sustain=0.1; 
var sound, env;

sound=SinOsc.ar((freq*(EnvGen.ar(~e3)+1)),[0,pi*0.5],[0.5,0.4],0.5)*In.ar(0,2);

Out.ar(out,sound)
}).store;

// - 0:23:18.06 -  
~s2=Synth.tail(RootNode.new,\lcsynth2)	

// - 0:24:32.55 -  
SynthDef(\lcsynth3, {arg out=0, amp=0.1, pan=0.0, freq=4.4, sustain=0.1; 
var sound, in;

in=In.ar(0,2);

sound=Limiter.ar(CombL.ar(in,0.1,0.1,5,0.1,in));

ReplaceOut.ar(out,sound)
}).store;

// - 0:24:40.36 -  
~s3=Synth.tail(RootNode.new,\lcsynth3)	

// - 0:25:13.97 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,100*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.5.wait;
};

}).play;

// - 0:25:18.43 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.5.wait;
};

}).play;

// - 0:25:23.84 -  
Tdef(\lctask3,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\amp,(~e2.at(thisThread.beats%(~e2.times.sum)))*exprand(0.1,1.0), \index,10*(e.at(thisThread.beats%(e.times.sum)))+0.1);
0.5.wait;
};

}).play;

// - 0:25:30.95 -  
Tdef(\lctask3,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\amp,(~e2.at(thisThread.beats%(~e2.times.sum)))*exprand(0.1,1.0), \index,10*(e.at(thisThread.beats%(e.times.sum)))+0.1);
2.wait;
};

}).play;

// - 0:25:39.27 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.025.wait;
};

}).play;

// - 0:25:57.11 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,5000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,100*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.04.wait;
};

}).play;

// - 0:26:6.24 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,5000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.04.wait;
};

}).play;

// - 0:26:22.51 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.4.wait;
};

}).play;

// - 0:26:34.88 -  
Tdef(\lctask3,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\amp,(~e2.at(thisThread.beats%(~e2.times.sum)))*exprand(0.1,1.0), \index,100*(e.at(thisThread.beats%(e.times.sum)))+0.1);
2.wait;
};

}).play;

// - 0:26:52.07 -  
~s3.free

// - 0:27:3.68 -  
SynthDef(\lcsynth3, {arg out=0, amp=0.1, pan=0.0, freq=4.4, sustain=0.1; 
var sound, in;

in=In.ar(0,2);

sound=Limiter.ar(CombL.ar(in,0.1,0.1,5,0.1,in),0.99);

ReplaceOut.ar(out,sound)
}).store;

// - 0:27:5.2 -  
~s3=Synth.tail(RootNode.new,\lcsynth3)	

// - 0:27:14.86 -  
Tdef(\lctask3,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\amp,(~e2.at(thisThread.beats%(~e2.times.sum)))*exprand(0.1,1.0), \index,5*(e.at(thisThread.beats%(e.times.sum)))+0.1);
2.wait;
};

}).play;

// - 0:27:24.21 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.01.wait;
};

}).play;

// - 0:27:28.33 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,5000*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.01.wait;
};

}).play;

// - 0:27:40.64 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,500*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,10*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.01.wait;
};

}).play;

// - 0:27:48.1 -  
Tdef(\lctask1,{
var now=0.0;

inf.do {

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,500*(e.at(thisThread.beats%(e.times.sum)))+100, \modf,10*(~e2.at(thisThread.beats%(~e2.times.sum)))+1);
0.2.wait;
};

}).play;

// - 0:27:52.89 -  
Tdef(\lctask2,{
var now=0.0;

inf.do {

if(0.05.coin,{rrand(0.0,0.1).wait});

//thisThread.beats.postln;
//e.at(thisThread.beats%20).postln;

~s1.set(\freq,1000*(~e2.at(thisThread.beats%(~e2.times.sum)))+100, \modf,100*(e.at(thisThread.beats%(e.times.sum)))+1);
0.2.wait;
};

}).play;

// - 0:28:4.37 -  
~s1.free