KruhftPatience

From CSWiki
Jump to: navigation, search
//
// kruhft__patience.ck
//
// Author: Burton Samograd
// Title: Patience
// Album: Songs For Beautiful Girls
// Year: 2006
// Webpage: http://www.myspace.com/kruhft
// Purchase: http://www.lulu.com/588654
//
// This was my second or third song written solely with chuck
// and it's internal synths and instruments. It ended up with a 
// bit of an Aphex Twin Ambient Works feel.
//
BandedWG inst0 => JCRev rev0 => Envelope master => Pan2 pan0 => dac;
BandedWG inst1 => master => Pan2 pan1 => dac;
TubeBell inst2 => Envelope env0 => rev0 => master => Pan2 pan2 => dac;
TubeBell inst2a => env0 => rev0 => master => Pan2 pan2a => dac;
inst2 => master => dac;
inst2a => master => dac;
Shakers inst3 => rev0 => master => Pan2 pan3 => dac;
inst3 => pan3 => dac;
BlowHole inst4 => rev0 => master => Pan2 pan4 => dac;
BlowHole inst4b => rev0 => master => Pan2 pan4a => dac;

245::ms => dur beat;

fun float m2f(int n) { return Std.mtof(n)+(-0.05+0.1*Std.randf()); }
fun float fz(float f) { return f + Std.randf()*f/16; }
fun void rest() { beat => now; }
fun float pm1() {  return (-0.25 + Std.randf()/2); }

fun void note(StkInstrument inst, float v, int n, dur d, float pressure, float pos ) {
	m2f(n) => inst.freq;
	fz(pressure) => inst0.bowPressure;
	//fz(pos) => inst0.bowPosition;
	//fz(v) => inst.startBowing;
	fz(v) => inst.noteOn;
	d => now;
//	1.0 => inst.stopBowing;
}

fun void line(StkInstrument inst, Pan2 pan, float vol, int root, int times) {
	repeat(times) {
		pan.pan(pm1());
		note(inst, vol, root, beat, 1.0, 1.0);
		pan.pan(pm1());
		note(inst, vol, root-3, beat*2, 0.7, 0.75);
		pan.pan(pm1());
		rest();
		pan.pan(pm1());
		note(inst, vol, root-4, beat, 0.8, 0.5);
		pan.pan(pm1());
		note(inst, vol, root-2, beat, 1.0, 0.7);
		pan.pan(pm1());
		rest();
		pan.pan(pm1());
		note(inst, vol, root-3, beat*2, 0.3, 0.25);
		pan.pan(pm1());
	}
}

fun void line2(StkInstrument inst, Pan2 pan, float vol, int root, int times) {
	repeat(times) {
		pan.pan(pm1());
		note(inst, vol, root, beat, 0.5, 1.0);
		pan.pan(pm1());
		note(inst, vol, root-1, beat, 0.7, 0.75);
		pan.pan(pm1());
		note(inst, vol, root, beat, 0.8, 0.5);
		pan.pan(pm1());
		note(inst, vol, root-1, beat, 1.0, 0.7);
		pan.pan(pm1());
		note(inst, vol, root, beat, 0.3, 0.25);
		pan.pan(pm1());
		note(inst, vol, root-1, beat, 0.3, 0.25);
		pan.pan(pm1());
		note(inst, vol, root, beat, 0.3, 0.25);
		pan.pan(pm1());
		note(inst, vol, root-1, beat, 0.3, 0.25);
		pan.pan(pm1());
	}
}

dac.gain(4.3);

master.duration(12*beat);
master.value(0);
master.target(0.5);
master.keyOn();

2::second => now;

repeat(2) {
spork ~ line(inst0, pan0, 0.0024, 36, 12);
beat*32 => now;
spork ~ line2(inst1, pan1, 1.0, 36, 12);
beat*64 => now;
spork ~ line(inst2, pan2, 0.025, 36+36, 16);
spork ~ line(inst2a, pan2a, 0.025, 36+31, 14);
	env0.duration(32*beat);
	env0.target(0.03);
	env0.keyOn();
beat*64 => now;
spork ~ line2(inst3, pan3, 0.03, 36+12, 16);
beat*64 => now;
spork ~ line(inst4, pan4, 0.00035, 36, 8);
	4::ms => now;
spork ~ line(inst4b, pan4a, 0.0003, 36-12, 12);
beat*64 => now;
spork ~ line(inst2, pan2, 0.03, 36+31, 16);
	beat/2 => now;
spork ~ line(inst2a, pan2a, 0.03, 36+7, 14);
	env0.duration(32*beat);
	env0.target(0.03);
	env0.keyOn();
beat*64 => now;
beat*48 => now;
spork ~ line2(inst4, pan4, 0.00015, 36+3, 6);
beat => now;
spork ~ line(inst4b, pan4a, 0.00035, 36-8, 12);
beat*64 => now;
spork ~ line(inst1, pan1, 1.0, 31, 12);
beat*64 => now;
spork ~ line(inst3, pan3, 0.02, 36+5, 16);
beat*64 => now;
spork ~ line(inst2, pan2, 0.025, 36+36, 16);
spork ~ line2(inst2a, pan2a, 0.025, 36+31, 14);
	env0.duration(32*beat);
	env0.target(0.03);
	env0.keyOn();
}

master.keyOff();
master.duration(32*beat);
master.target(0);
master.keyOn();
(256*beat)=> now;