«Generative jazz» by Devi Skanadze

on 24 Nov'14 04:51 in jazzalgorithmrythmgenerativemorseeuclideanthue

download drum loop:

https://www.dropbox.com/s/6yyrm7ivwqmxbdi/jloop2.wav?dl=0

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
// Morning jazz2 by Notgoodenough
(
~buff1 = Buffer.read(s, "jloop2.wav".resolveRelative);
~mthue = {arg i, base, mul;(i * mul).asDigits(base).sum};
~eu = {arg len, hits; var seq = Array.newClear(); for(0, len - 1, {arg i;seq = seq.add((i * hits % len) < hits)}); seq};
~bpm = 95;
)

(
SynthDef(\bell, { arg freq, amount = 100, ratio = 2, release = 0.5;
	var snd, mod, env;
	mod = SinOsc.ar(freq.midicps * 3, mul: amount);
	env = EnvGen.kr(Env.linen(0.02, 0.1, release, 0.1), doneAction: 2);
	snd = SinOsc.ar(freq.midicps + mod , mul: env);
	Out.ar(0, snd * 0.5 ! 2);
}).add;

SynthDef(\slicer, { arg buff = ~buff1, pos = 0, len = 2;
	var snd, dur, chunk;
	dur = 15 / ~bpm;
	chunk = BufFrames.kr(buff) / 16;
	snd = BufRd.ar(2, buff, Line.ar(pos * chunk, (pos * chunk) + (chunk * len), dur * len, doneAction: 2));
	Out.ar(0, snd);
}).add;
)

(
var count = 0, rd = 0, oct = 0, pitch = 0, scale = Scale.minorPentatonic.degrees, bang = ~eu.value(28,19),
count2 = 0, rd2 = 0, oct2 = 0, pitch2, scale2 = Scale.ritusen.degrees, bang2 = ~eu.value(9,4), len = 0, shift, cnt = 0, shread = 0, sh = [0,5,-3,3,7];

~t = Task({
	inf.do({

		cnt = cnt + 1 % 102;
		if(cnt == 101, {shread = shread + 1 % sh.size});

		pitch = ~mthue.value(count,16,8);
		if(pitch > scale.size, {oct = 12}, {oct = 0});

		pitch2 = ~mthue.value(count2,13,3);
		if(pitch2 > scale2.size, {oct2 = 12}, {oct = 0});

		rd = rd + 1 % 28;
		rd2 = rd2 + 1 % 9;

		if(bang[rd], {count = count + 1 % 18; Synth(\bell, [\freq,
			scale[pitch % scale.size] + 60 + oct + sh[shread],
			\amount, rrand(100,500),
			\release, rrand(0.5,1.5),
			\ratio, rrand(3,12);
		]); });
		if(bang2[rd2], {count2 = count2 + 1 % 34; Synth(\bell, [\freq,
			scale2[pitch2 % scale2.size] + 60 + oct2 + sh[shread],
			\amount, rrand(100,500),
			\release, rrand(0.5,1.5),
			\ratio, rrand(3,12);
		]); });

		(15 / ~bpm).wait; // 16th
	});
}).play;

~beat = Task({
	inf.do({
		len = rrand(4,6);
		Synth(\slicer, [\pos, rrand(0,15), \len, len]);
		(15 / ~bpm * len).wait;
	});
}).play;
)

~t.stop; ~beat.stop;
raw 2112 chars (focus & ctrl+a+c to copy)
reception
comments
coreyker user 24 Nov'14 08:28

Would you mind explaining a bit about the two functions: ~mthue, and ~eu? I can see what they are doing, but I'm curious where they come from/higher-level interpretation....

Devi Skanadze user 24 Nov'14 20:11

Just google "euclidean rythms" - (~eu), and "morse thue sequence" - (~mthue)

tedthetrumpet user 13 May'16 06:56

The link to the drum loop seems to be broken?