«Randomized FM7 perc sounds» by david_morgan

on 09 Dec'17 08:53 in fmfrequency modulation

Requires:

SuperCollider v3.8.0+

FM7 (sc3 plugins)

Feedback Quark

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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/**
Requires:

SuperCollider v3.8.0+

FM7 (sc3 plugins)

Feedback Quark

To run evaluate each of the numbered blocks
**/

////////////////////
// 1
TempoClock.default.tempo_(60/60);

////////////////////
// 2
(
~env = {arg min = 1, max = 1, trig, dur;

	var shape = Env.shapeNames.choose;
	var num = rrand(4,16);
	var levels = (0..rrand(3,8)).collect({1.0.rand;});
	var durs = (0..levels.size-1).collect({1.0.rand}).normalizeSum;
	var env = Env(levels,durs,shape);
	EnvGen.kr(env, gate:trig, timeScale:dur).range(min, max);
};

~ctrls = {arg freq, trig, dur;

	var ctrls = (0..5).collect({arg val;
		var min = rrand(0.25, 1.0);
		var max = rrand(1.0, 3.0);
		var fmul = ~env.(min, max, trig, dur);
		[freq * fmul, 0, 1];
	});
	ctrls;
};

~algos = [

	[0,2] -> [
		[0,1],
		[2,3],
		[3,4],
		[4,5],
		[5,5]
	],

	[0,2] -> [
		[0,1],
		[1,1],
		[2,3],
		[3,4],
		[4,5]
	],

	[0,3] -> [
		[0,1],
		[1,2],
		[3,4],
		[4,5],
		[5,5]
	],

	[0,3] -> [
		[0, 1],
		[1, 2],
		[3, 4],
		[4, 5],
		[5, 3]
	],

	[0,2] -> [
		[0,1],
		[2,3],
		[3,4],
		[3,5],
		[4,5]
	],

	[0,1,2,3,4,5] -> [
		[5,5]
	]
];

~mods = {arg trig, dur;

	var algo = ~algos.choose;
	var matrix = Array.fill2D(6, 6, 0);
	var vals = algo.value;
	vals.do {arg x;
		matrix[x[0]][x[1]] = ~env.(1.0.rand, 1.0.rand, trig, dur)
	};
	[matrix, algo.key];
};

~synth = {

	var freq, sig;

	thisThread.randSeed_(100000.rand.debug("seed"));

	freq = \freq.kr(432);

	sig = {

		var dur = \dur.kr(1);

		var trig = \trig.tr(0);

		var ctrls = ~ctrls.(freq, trig, dur);

		var mods = ~mods.(trig, dur);

		var sig = FM7.ar(ctrls, mods[0]).slice(mods[1]);

		var env = Env.linen(\atk.kr(0.01), \sus.kr(0), \rel.kr(1), curve:\curve.kr(-4)).kr(gate:trig);

		sig = Splay.ar(sig) * env;

		sig;
	};

	Splay.ar(sig.()) * \amp.kr(0.1) * AmpCompA.kr(freq);
};
)


////////////////////
// 3
(
~fm11 = NodeProxy.audio;
~fm11.quant = 1.0;
~fm11[0] = ~synth;
)

////////////////////
// 4
(~fm11[8] = \set -> Pbind(

	\trig, 1,
	\delta, Pwrand([Rest(0.5), 0.5], [0.2, 0.8], inf),
	\beatDur, Pfunc({thisThread.clock.beatDur}),
	\dur, Pkey(\beatDur) * Pkey(\delta) * 1,

	\sus, Pkey(\dur) * 0.05,
	\rel, Pkey(\dur) * Pwhite(0.01, 0.3),
	\curve, -4,

	\degree, Pwhite(0,5,inf),
	\octave, Pwrand([4,5,6], [0.3,0.6,0.01].normalizeSum, inf),
	\scale, Scale.hexSus
))

////////////////////
// 5
(
Tdef(\main, {

	~fm11.play;

	~fm11[16] = \filter -> {arg in;
		var sig = FbC({arg fb; fb * 0.4 + in;}, 1.5/4);
		var sig2 = FbC({arg fb; fb * 0.5 + in;}, 4.5/4);
		sig + sig2;
	};

	~fm11[18] = \filter -> {arg in; GVerb.ar(in, 150, revtime:5, taillevel:0.7); };

	~fm11.set(\wet16, 0.5, \wet18, 0.2);

	loop({
		"update".postln;
		~fm11[0] = ~synth;
		16.wait;
	});

}).play
)
raw 2885 chars (focus & ctrl+a+c to copy)
reception
comments
Exiik user 27 Dec'17 23:24

:O