«Build It Up - A2 - 115modulations» by ldavidson

on 15 Nov'16 18:00 in

https://soundcloud.com/lydia-davidson-919585173/build-it-up-115modulations

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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// =======================
// MUSC 115 Assigment 2
// =======================
// SynthDefs (AM and FM)
// =======================

// Your name:  Lydia Davidson

(
SynthDef("am1", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.01, rel = 3;
    var carrier, modulator, env;
    env = Env.perc(
        attackTime: att,
        releaseTime: rel,
        level: amp
    ).kr(2);
    modulator = SinOsc.ar(modfreq).range(0, 1);
    carrier = SinOsc.ar(freq: freq, mul: env * modulator);
    Out.ar(0, carrier ! 2);
}).add;

SynthDef("am2", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.01, sus = 0.2, rel = 3, gate = 1, pos = 0;
    var carrier, modulator, env;
    env = Env.asr(
        attackTime: att,
		sustainLevel: sus,
        releaseTime: rel
	).kr(doneAction: 2, gate: gate, mul: amp);
    modulator = SinOsc.ar(modfreq).range(0, 1);
    carrier = SinOsc.ar(freq: freq, mul: env * modulator);
	Out.ar(0, Pan2.ar(carrier, pos));
}).add;

SynthDef("am3", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.01, sus = 0.2, rel = 3, gate = 1, pos = 0;
    var carrier, modulator, env;
    env = Env.asr(
        attackTime: att,
		sustainLevel: sus,
        releaseTime: rel
	).kr(doneAction: 2, gate: gate, mul: amp);
    modulator = SinOsc.ar(modfreq).range(0, 1);
	freq = freq * LFNoise2.kr([2, 1/2, 1/3, 1/4, 1]).range(0.98, 1.01);
    carrier = Pulse.ar(freq: freq, mul: env * modulator);
	carrier = Mix.ar(carrier);
	carrier = LPF.ar(carrier, Line.kr(10000, 1000, att));
	Out.ar(0, Pan2.ar(carrier, pos));
}).add;

SynthDef("fm1", {arg freq = 440, modfreq = 5, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.01, rel = 0.3;
	var carrier, modulator, freqdev, env;
	// i = d/m, so d = m*i
	freqdev = modfreq * modindex;
	modulator = SinOsc.ar(freq: modfreq, mul: freqdev);
	carrier = SinOsc.ar(freq: freq + modulator);
	env = Env.asr(
		attackTime: att,
		sustainLevel: amp,
		releaseTime: rel
	).kr(doneAction: 2, gate: gate);
	carrier = Pan2.ar(in: carrier, pos: pos, level: env);
	Out.ar(0, carrier * 0.5);
}).add;

SynthDef("fm2", {arg freq = 440, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.01, rel = 0.3;
	var carrier, modulator, freqdev, env, modfreq;
	// i = d/m, so d = m*i
	modindex = Line.kr(modindex, 1, att);
	modfreq = freq / 2;
	freqdev = modfreq * modindex;
	modulator = SinOsc.ar(freq: modfreq, mul: freqdev);
	carrier = SinOsc.ar(freq: freq + modulator);
	env = Env.asr(
		attackTime: att,
		sustainLevel: amp,
		releaseTime: rel
	).kr(doneAction: 2, gate: gate);
	carrier = Pan2.ar(in: carrier, pos: pos, level: env);
	Out.ar(0, carrier * 0.5);
}).add;

SynthDef("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, ffreq = 6000, pan = 0;
	var env, snd;
	env = Env.perc(att, rel, amp).kr(doneAction: 2);
	snd = WhiteNoise.ar;
	snd = HPF.ar(in: snd, freq: ffreq, mul: env);
	Out.ar(out, Pan2.ar(snd, pan));
}).add;

) // end of SynthDef code



// ========================
// Pbind collection
//
// tip: to work on a Pbind separately, copy and paste it
// into a new window, add .play at end for convenience
// (change/listen/change again/listen again),
// and when you are done, copy it back here, don't
// forget to REMOVE the .play from it.
// Also create your own variable names that make sense to you.
// ========================

(
~beat = Pbind(
    \instrument, "am1",
    \midinote, Pseq([35, 37, 37, 39, 39, 39, 39, 37, 37, 37], inf),
	\ctranspose, 0,
	\dur, Pseq([4/8, 2/8, 2/8, 1/8, 1/8, 1/8, 1/8, 4/8, 4/8, 4/8], inf) ,
    \amp, Pwhite(0.2, 0.5),
    \att, 0.01,
    \rel, 0.1,
	\modfreq, Prand([10, 20, 25, 30], inf),
	\pos, 0
);




~fmletsdothis = Pbind(
    \instrument, "fm2",
	\dur, Pseq([
		Pn(1/8, 6),
		3/8,
		Pn(2/8, 5),
		5/8, 3/8, 3/8, 3/8, 3/8,
		4/8,
		Pn(2/8, 3), 1.5
	], 5) * 2,
	\midinote, Pseq([
		60, 56, 55, 48, 60, 56,
		Pn([36, 43, 52, 60], 3),
		Pn([37, 44, 53, 60], 2),
		Pn([39, 46, 55, 60], 2),
		55, 56, 58, 60,
		Pn([41, 48, 57, 60], 1),
		Pn([41, 48, 56, 60], 2),
		Pn([39, 46, 55, 60], 2)
		], inf),
	\ctranspose, ([11, 16]),
	\modindex, Pseq([6, 7, 9], inf),
	\amp, 0.1,
	\att, 0.5,
	\rel, Pwhite(0.5, 0.7),
	\pos, 0
);



~tone = Pbind(
    \instrument, "fm2",
	\dur, Pseq([14.5]),
	\midinote, 60,
	\modindex, 0,
	\ctranspose, 16,
	\amp, 0.1,
	\att, 1,
	\rel, 0/1,
	\pos, 0
);




~hihat = Pbind(
	\instrument, "hihat",
	\dur, 1/16,
	\att, 0.01,
	\rel, 0.5,
	\ffreq, 18000,
	\pan, 0,
	\amp, 0.05
);





~harmonics = Pbind(
	\instrument, "am2",
	\midinote, Pseries([36, 43, 56]),
	\modfreq, Pseq([1, 10, 50], inf),
	\ctranspose, 11,
	\amp, Pseq([0.02, 0.02, 0.01, 0.01, 0.008, 0.005], 14.5),
	\att, 0.02,
	\rel, 4,
	\pos, Pwhite(-1, 1),
	\dur, 0.1
);

) // end of Pbind collection


// =============
// Double check your the Pbinds (listen)
// Remember: some of them are inf, others are finite
// you can adjust that by changing the Pbinds
// =============


~beat.play;
~harmonics.play;
~hihat.play;
~tone.play;
~fmletsdothis.play;

// =============
// COMPOSITION
// =============
// Build your sequence here
// you can use either {}.fork or Pspawner
// see Pspawner help file.


(
Pspawner({arg maestro;

	maestro.par(~fmletsdothis);
	maestro.wait(14.5);

	~player1 = maestro.par(~beat);
	maestro.wait(14.5);

	~player2 = maestro.par(~hihat);
	maestro.wait(14.5);

	maestro.par(~harmonics);
	maestro.wait(14.5);

	maestro.suspend(~player1);
	maestro.suspend(~player2);

	maestro.seq(~tone);

	maestro.suspendAll;


}).play;
)
raw 5656 chars (focus & ctrl+a+c to copy)
reception
comments