«SELFSTEP» by Alexander Zhagun-Linnik

on 16 Mar'18 08:19 in simplepatternsgenerativealgorithmicselfstep

a simple self-playing piece with generative patterning

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
(
/**
* SELFSTEP by Alexander Zhagun-Linnik, 2018
* a simple self-playing piece with generative patterning
**/
{
	var scale = Scale.harmonicMinor;
	var time = 1.5;                   // beat length in seconds multiplied by 2

	
	// define synths
	SynthDef(\pls, {arg freq=220, out=0, amp=0.7, res=0.5;
		var sig, env;
		sig = LFPulse.ar(Line.ar(freq, freq/4, Rand(0.01, 0.1)), 0, Rand(0.01, 0.99), amp);
		sig = RLPF.ar(sig, freq*5*Line.kr(1, 0, Rand(0.1, 0.9)), res);
		env = Env.perc(0.001, Rand(0.1, 0.8)).kr(2);
		sig = (sig * env * 2).softclip;
		sig = Pan2.ar(sig, Rand(-0.5, 0.5));
		Out.ar(out, sig);
	}).add;
	SynthDef(\kck, {arg freq=220, out=0, amp=0.9;
		var sig, env;
		sig = SinOsc.ar(Line.ar(freq, freq/4, Rand(0.01, 0.1)), 0, 0.5, amp);
		sig = RLPF.ar(sig, freq*8*Line.kr(1, 0, Rand(0.01, 0.3)));
		env = Env.perc(0.001, Rand(0.01, 0.5), 0.5).kr(2);
		sig = (sig * env * 4).softclip;
		sig = Pan2.ar(sig, Rand(-0.3, 0.3));
		Out.ar(out, sig);
	}).add;
	SynthDef(\sin, {arg freq=110, out=0, amp=0.9, gate=1;
		var sig;
		sig = SinOsc.ar(freq, 0, amp)*Env.adsr.kr(2, gate);
		sig = RHPF.ar(sig, LFDNoise3.ar(Rand(0.01, 16), freq).abs, LFDNoise3.ar(Rand(0.01, 3), 1).abs)*0.1;
		sig = Pan2.ar(sig, Rand(-0.9, 0.9)).softclip;
		Out.ar(out, sig);
	}).add;
	SynthDef(\snr, {arg freq=220, out=0, amp=1.0;
		var sig, env;
		sig = WhiteNoise.ar(1);
		sig = RLPF.ar(sig, freq*6*Line.ar(1, 0, Rand(0.01, 0.3)), Rand(0.4, 0.6));
		env = Env.perc(0.001, Rand(0.01, 0.2)).kr(2);
		sig = (sig * env * amp * 8).softclip;
		sig = Pan2.ar(sig, Rand(-0.5, 0.5));
		Out.ar(out, sig);
	}).add;
	SynthDef(\hgh, {arg freq=220, out=0, amp=1.0, res=0.5;
		var sig, env;
		sig = WhiteNoise.ar(1);
		sig = RHPF.ar(sig, freq*40*Line.ar(0.5, 1, Rand(0.01, 0.1)), res);
		env = Env.perc(0.001, Rand(0.01, 0.1)).kr(2);
		sig = (sig * env * amp * 2).softclip;
		sig = Pan2.ar(sig, Rand(-0.7, 0.7));
		Out.ar(out, sig);
	}).add;
	s.sync; // wait for server to load synthdefs
	
	// define patterns...
	Ppar([
		Pbind(
			\instrument, \kck,
			\dur,  Prand([time/2, time/2, time/2, time/2, time/4, time/8], inf),
			\scale, scale,
			\degree, Pbrown(0, 8, Prand([1, 2], inf)),
			\octave, 4,
		),
		Pbind(
			\instrument, \pls,
			\dur, Prand([time/8, time/4], inf),
			\scale, scale,
			\degree, Pbrown(0, 12, Prand([1, 2, 3], inf)),
			\octave, 4,
			\res, Pfunc({(SystemClock.seconds*0.03).sin.abs})
		),
		Pbind(
			\instrument, \pls,
			\dur, Prand([time/2, time, time/4, time/8], inf),
			\scale, scale,
			\degree, Pbrown(0, 12, Prand([1, 2, 3, 4, 5], inf)),
			\octave, 5,
			\res, Pfunc({(SystemClock.seconds*0.5).sin.abs})
		),
		Pbind(
			\instrument, \sin,
			\dur, Prand([1, 2, 4, 8], inf),
			\scale, scale,
			\degree, Pbrown(0, 12, Prand([1, 2, 3, 4, 5], inf)),
			\octave, 5,
			\amp, Pfunc({0.3.rand})
		),
		Pbind(
			\instrument, \sin,
			\dur, Prand([1, 2, 4, 8], inf),
			\scale, scale,
			\degree, Pbrown(0, 12, Prand([1, 2, 3, 4, 5], inf)),
			\octave, 5,
			\amp, Pfunc({0.3.rand})
		),
		Pbind(
			\instrument, \snr,
			\dur, Prand([time, time, time, time, time/8, time/4], inf),
			\scale, scale,
			\degree, Pbrown(0, 12, Prand([1, 2, 3], inf)),
			\octave, 5,
		),
		Pbind(
			\instrument, \hgh,
			\dur, Prand([time/8], inf),
			\scale, scale,
			\degree, Prand(Array.fill(8, {arg i;i}), inf),
			\octave, Prand(Array.fill(6, {arg i;i}), inf),
			\res, Pfunc({(SystemClock.seconds*0.3).sin.abs}),
		)
	]).play; // ...and start playing
}.fork;
)
raw 3569 chars (focus & ctrl+a+c to copy)
reception
comments
blueprint user 16 Mar'18 18:30

Nice. Line 31 I changed to PMOsc. That sings a bit more :)