«Eternal sunrise» by grirgz

on 19 Jul'17 03:15 in sleep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
(
	// INIT take time
	~t = 185/4/60; TempoClock.default.tempo = ~t; // now with tempo !

	33.do { arg x;
		( "creating babass "++x ).postln;

		SynthDef(( \babass++x ).asSymbol, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;
			var sig;
			var voices = 8; // CPU control
			sig = SinOsc.ar(freq);
			sig = voices.collect({
				[SinOsc, LFSaw, LFCub, LFPulse].choose.ar(freq * [1,2,1 + rrand(0,0.01)].choose * ( 1 + ( SinOsc.ar(exprand(4,100) * ( 1 + ( SinOsc.ar(exprand(0.1,100)) * 1 ))) * rrand(0,1) )), rrand(0.0,pi))
			});
			sig = sig.collect({ arg sig;
				sig + [SinOsc, LFSaw, LFCub, LFPulse].choose.ar(freq * [1,2,1 + rrand(0,0.01)].choose * ( 1 + ( SinOsc.ar(exprand(4,100) * ( 1 + ( SinOsc.ar(exprand(0.1,100)) * 1 ))) * rrand(0,1) )), rrand(0.0,pi));
			});
			sig = ( sig*\distamp.kr(10) * (1..voices)/4 ).tanh * \distpostamp.kr(1/2);
			sig = sig.collect({ arg sig;
				var line = [
					XLine.kr(0.1,2,exprand(0.02,4)),
					XLine.kr(2,0.1,exprand(0.02,4)),
				];
				RLPF.ar(sig, rrand(100,1000) * line.choose, rrand(0.1,0.5) * line.choose);
			});
			sig = HPF.ar(sig, 50);
			sig = LPF.ar(sig, 2500);
			sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1),gate,doneAction:2);
			pan = pan + SinOsc.kr((1..voices)/21, mul:0.01);
			sig = sig * 2;
			sig = sig * \modamp.kr(1).lag(0.1);
			sig = DelayC.ar(sig, 0.01,0.001) + sig;
			sig = Pan2.ar(sig, pan, amp).mean;
			Out.ar(out, sig);
		}).add;
	};

SynthDef(\kobass, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;
	var sig;
	freq = freq.lag(\freqlag.kr(0.4));
	sig = LFSaw.ar(freq * [1/2,1,2] *.t [1,1.00001], 0.7);
	sig = RLPF.ar(sig, \lpfratio.kr(1.7)* freq * SinOsc.kr(1/18 * (1..8)).range(0.5,2), \rq.kr(0.5));
	sig = sig * EnvGen.ar(Env.adsr(0.01,0.01,0.8,0.1,1,-4),gate,doneAction:2);
	sig = sig * SelectX.kr(\ammix.kr(1),[1,SinOsc.ar(\amf.kr(1*~t)).unipolar]); 
	sig = SelectX.ar(LFNoise1.kr(1/62.1).unipolar, [sig, sig.fold( LFNoise1.kr(1/53).range(0.5,2) )]);
	sig = sig.mean;
	sig = sig * AmpComp.kr(freq);
	sig = sig * 3;
	sig = sig * amp;
	sig = sig * \modamp.kr(1).lag(0.1);
	Out.ar(out, sig);
}).add;
);


(
	// PLAY!
	Pdef(\chord1, Pmono(\kobass,
		\degree, Pseq([
			[0,4],
			[0,5],
		],inf),
		\lpfratio, 1,
		\amf, Ptuple(Prand(2**(0..5),inf)/4!2).stutter(Prand([2,3,4,6,8],inf))*~t,
		\ammix, Ptuple(Prand(( 0..10 ),inf)/10!2).stutter(Prand([2,3,4,6,8],inf)),
		\octave, Ptuple(Prand([4,3,5,6],inf).stutter(Prand([Prand([2,3,4,6,8]),4,6,8],inf))!2),
		\dur, 4,
		\modamp, Pseq([
			Pn(1,32*3),
			Pn(0,32*1),
		],inf),
		\amp, 0.1/2 * 0.5,
	));

	Pdef(\chord2, Pmono(\kobass,
		\degree, Pseq([
			9, 9, 8, 8,
		],inf)+Pseq([0,1,0,3],inf).stutter(Prand([8,8,8,4,2],inf).stutter(4)),
		\lpfratio, 1,
		\amf, Ptuple(Prand(2**(0..5),inf)/4!2).stutter(3)*~t,
		\ammix, Ptuple(Prand(( 0..10 ),inf)/10!2).stutter(2),
		\modamp, Prand([1,0,0,0],inf).stutter(Prand([8,16,32],inf)),
		\octave, Ptuple(Prand([4,3,5,6],inf).stutter(Prand([Prand([2,3,4,6,8]),4,6,8],inf))!2),
		\dur, 4,
		\amp, 0.1/2 * 0.5,
	));

	Pdef(\far, 
		Plazy({
			Ppar([
				Plazy({
					Pfindur([64,32].choose, Ppar([
						rrand(1,8).collect({ arg idx;
							PmonoArtic(( \babass++rrand(0,32) ).asSymbol,
							\degree, Pstep(Pseq([
								9, 9, 8, 8,
							],inf),4)+Pseq([0,1,0,3],inf),
							\modamp, Pseq([
								Pseq([
									Pseq({[
										1,0,
										0,1,
										1,1,
										0,0,
									].clump(2).choose}.dup([2,4,8,16].choose).flat,[2,4,8,16].choose).dup([2,4,8,16].choose)
								].flat,1) * Pstep(Pseq([[1,0].choose],inf),[1,3].choose)
							],inf),
							\legato, Pseq([{ [rrand(0.1,0.8),1].choose }!( 2**rrand(0,3) )].flat,inf),
							\lpfratio, 1,
							\octave, [3,4,5,6].choose,
							\dur, [[1/4,1/16].choose,1/8,1/4,1/2,1,2].choose,
							\amp, 0.1 * [0.8,0.5,Pseq([0.8,0.5],inf)].choose * 0.5,
						)
					}),
				].flat))
			}).loop,
			Plazy({
				Pfindur([64,32,16,8].choose, Ppar([
					rrand(1,8).collect({ arg idx;
						PmonoArtic(( \babass++rrand(0,32) ).asSymbol,
						\degree, Pstep(Pseq([
							9, 9, 8, 8,
						],inf),4)+Pseq([0,1,0,3],inf),
						\modamp, Pseq([
							Pseq([
								Pseq({[
									1,0,
									0,1,
									1,1,
									0,0,
								].clump(2).choose}.dup([2,4,8,16].choose).flat,[2,4,8,16].choose).dup([2,4,8,16].choose)
							].flat,1) * Pstep(Pseq([1,0],inf),Pseq([1,3].scramble,inf) * [1,2,4,8,16].choose)
						],inf),
						\legato, Pseq([{ [rrand(0.1,0.8),1].choose }!( 2**rrand(0,3) )].flat,inf),
						\lpfratio, 1,
						\octave, [3,4,5,6].choose,
						\dur, [1/2,1/4,1/8,1/4,1/2,1,2].choose,
						\amp, 0.1 * [0.8,0.5,Pseq([0.8,0.5],inf)].choose * 0.5,
					)
				}),
			].flat));
		}).loop,
	],inf);
})
);

Pdef(\main, Ptpar([
	0,Pdef(\chord1),
	16,Pdef(\far),
	64,Pdef(\chord2),
])).play;
)
raw 4901 chars (focus & ctrl+a+c to copy)
reception
comments
g_montel user 21 Jul'17 14:17

I'm so impressed I have no words for it !

alln4tural user 22 Jul'17 12:50

nice retro sounds, and nice code! i love the way you generate the 33 synths, and the way you set up and control the piece with a few patterns -- very instructive.

marcoose777 user 07 Oct'17 01:06

Hypnotic, very nice

grirgz user 07 Oct'17 17:15

Thank you =) Now that I look again, I notice an error : ~t should be the tempo but I forgot to set the TempoClock. I will fix the code. So everyone was listening to something not synchronized and with the tempo of the previous code they have run. Now that I listen it with tempo 185/60 I find it too fast, I don't remember the original tempo :p

peter.eisenhauer user 20 Oct'17 05:31

This is beautiful and inspiring.