«Detuned Synth Pad» by coreyker

on 13 May'15 22:56 in synthpadsound design

A SuperCollider implementation of the synth sound described here: "http://www.attackmagazine.com/technique/synth-secrets/detuned-pad/"

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
182
183
184
185
186
/*
 A SuperCollider implementation of the synth sound described here:
 "http://www.attackmagazine.com/technique/synth-secrets/detuned-pad/"
*/

// Chord seq:
// 1. (E1, E2, B3, D4, G4)
// 2. (G1, G2, B3, D4, F#4, A4)
// 3. (G1, G2, B3, D4, F#4, A4, B4)
// 4. (A1, A2, C4, E4, G4)
// 5. (C1, C2, G3, E4, G4)

(
// sequence
~crdStr = [["E1", "E2", "B3", "D4", "G4"],
	["G1", "G2", "B3", "D4", "F#4", "A4"],
	["B4"],
	["A1", "A2", "C4", "E4", "G4"],
	["C1", "C2", "G3", "E4", "G4"]
];

// Map from chord names to midi notes
~noteToMidi = {
	arg noteStr;
	var notes = Dictionary[
	"C"  -> 0,
	"C#" -> 1,
	"D"  -> 2,
	"D#" -> 3,
	"E"  -> 4,
	"F"  -> 5,
	"F#" -> 6,
	"G"  -> 7,
	"G#" -> 8,
	"A"  -> 9,
	"A#" -> 10,
	"B"  -> 11];
	var octave = noteStr.last.digit;
	var degree = notes[noteStr[..noteStr.size-2].postln];
	octave*12 + degree;
};

~crdArray = ~crdStr.collect{
	arg crd;
	crd.collect{|c| ~noteToMidi.(c)};
};
)

// STEP 1: a simple synth
(
// Init synth
SynthDef(\simpSaw1, {|freq, gate=1|
	var env = EnvGen.ar(Env.adsr(0.01,0.3,0.5,0.1), gate, doneAction:2);
	var snd = Saw.ar(freq!2);
	Out.ar(0, env*snd);
}).add;
)

// Play chord seq
(
Pbind(
	\instrument, \simpSaw1,
	\freq, Pseq(~crdArray + 24, inf).midicps,
	\dur, 2.5*Pseq([1, 0.375, 0.625, 1, 1], 1),
	\sustain, 2.55*Pseq([1, 1, 0.625, 1, 1], 1)
).play;
)

// STEP2: add voices/detune/de-phase

(
SynthDef(\simpSaw2, {|freq, gate=1|
	var adsr = EnvGen.ar(Env.adsr(0.25,0.01,0.75,0.25), gate, doneAction:2);
	var nvoices1 = 5, nvoices2 = 7;
	var detune1 = 10, detune2 = 5;

	var osc1 = {
		var m = 2**(detune1/1200).rand2;
		var saw = LFSaw.ar(m * freq/2);
		DelayC.ar(saw, 0.02, freq.reciprocal.rand);
	}.dup(nvoices1);

	var osc2 = {
		var m = 2**(detune2/1200).rand2;
		var saw = LFSaw.ar(m * freq);
		DelayC.ar(saw, 0.02, freq.reciprocal.rand);
	}.dup(nvoices2);

	Out.ar(0, Splay.ar(osc1 + osc2 * adsr)/4);
}).add;
)

// Play chord seq
(
Pbind(
	\instrument, \simpSaw2,
	\freq, Pseq(~crdArray+24, inf).midicps,
	\dur, 2.5*Pseq([1, 0.375, 0.625, 1, 1], 1),
	\sustain, 2.5*Pseq([1, 1, 0.625, 1, 1], 1)
).play;
)


// STEP3: add LFO
(
SynthDef(\simpSaw3, {|freq, gate=1|
	var adsr = EnvGen.ar(Env.adsr(0.25,0.01,0.75,0.25), gate, doneAction:2);
	var nvoices1 = 5, nvoices2 = 7;
	var detune1 = 10, detune2 = 5;

	var osc1 = {
		var m = 2**(detune1/1200).rand2;
		var lfo = SinOsc.ar(3.rand).range(0,1);
		DelayC.ar(Saw.ar(m * freq/2), 0.02, freq.reciprocal.rand * lfo);
	}.dup(nvoices1);

	var osc2 = {
		var m = 2**(detune2/1200).rand2;
		var lfo = SinOsc.ar(3.rand).range(0,1);
		DelayC.ar(Saw.ar(m * freq), 0.02, freq.reciprocal.rand * lfo);
	}.dup(nvoices2);

	Out.ar(0, Splay.ar(osc1 + osc2 * adsr)/4);
}).add;
)

// Play chord seq
(
Pbind(
	\instrument, \simpSaw3,
	\freq, Pseq(~crdArray+24, inf).midicps,
	\dur, 2.5*Pseq([1, 0.375, 0.625, 1, 1], 1),
	\sustain, 2.5*Pseq([1, 1, 0.625, 1, 1], 1)
).play;
)

// STEP4: add filter
(
SynthDef(\simpSaw4, {|freq, gate=1|
	var adsr = EnvGen.ar(Env.adsr(1e-8,1e-6,0.75,0.125), gate, doneAction:2);
	var nvoices1 = 5, nvoices2 = 7;
	var detune1 = 12, detune2 = 8;

	var osc1 = {
		var m = 2**(detune1/1200).rand2;
		var lfo = SinOsc.ar(3.rand).range(0,1);
		DelayC.ar(LFSaw.ar(m * freq/2), 0.02, freq.reciprocal.rand * lfo);
	}.dup(nvoices1);

	var osc2 = {
		var m = 2**(detune2/1200).rand2;
		var lfo = SinOsc.ar(3.rand).range(0,1);
		DelayC.ar(LFSaw.ar(m * freq), 0.02, freq.reciprocal.rand * lfo);
	}.dup(nvoices2);

	var snd = BLowPass4.ar(osc1, 800, 0.5) + osc2 / 4;
	Out.ar(0, Splay.ar(snd*adsr));
}).add;
)

// Play chord seq
(
Pbind(
	\instrument, \simpSaw4,
	\freq, Pseq(~crdArray+24, inf).midicps,
	\dur, 2.5*Pseq([1, 0.375, 0.625, 1, 1], 1),
	\sustain, 2.5*Pseq([1, 1, 0.625, 1, 1], 1)
).play(quant: 1);
)

// Now Let's hear each version one at a time:
(
{
	~list = [\simpSaw1, \simpSaw2, \simpSaw3, \simpSaw4];
	4.do{
		arg i;
		Pbind(
			\instrument, ~list[i],
			\freq, Pseq(~crdArray+24, inf).midicps,
			\dur, 2.5*Pseq([1, 0.375, 0.625, 1, 1], 1),
			\sustain, 2.5*Pseq([1, 1, 0.625, 1, 1], 1)
		).play(quant: 1);
		(2.5*[1, 0.375, 0.625, 1, 1].sum + 0.125).wait;
	};
}.fork;
)
descendants
«Re: Detuned Synth Pad» by mutedial (private)
full graph
raw 4289 chars (focus & ctrl+a+c to copy)
reception
comments
pjagielski user 04 May'16 20:15

wow, just got into this, it's SUPER useful, thanks!

Björn Westergard user 29 Jun'16 00:02

This is so clutch.