«A2» by bbates

on 15 Nov'16 19:35 in
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
//BEGIN SYNTH DEFS////////
(
SynthDef("am1", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.5, 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("fm2", {arg freq = 440, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.1, 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("snare", {arg out = 0, amp = 0.1, att = 0.01, sus = 1, rel = 0.08, ffreq = 10000, pan = 0;
	var env, snd;
	env = Env.perc(att, sus, rel, amp).kr(doneAction: 2);
	snd = BPF.ar(
		in: WhiteNoise.ar,
		freq: ffreq,
		mul: env
	);
	Out.ar(out, Pan2.ar(snd, pan));
}).add;
)

/////END SYNTH DEFS//
//BEGIN PBINDS///////

(
~bass = Pbind(
    \instrument, "fm2",
	\dur, 2,
	\note, Pseq([
		Pseq([0, -5, Rest(1), 0, -3, Rest(2), 0, -5], 3),
		Pseq([0, -5, -6, -5, -4, -3, -2, -1], 1),
	], inf),
	\ctranspose, -12,
	\modindex, Pseq([ 0, 3, 2, 1, 0, 2, 1, 4, 1, 3, 2, 1, 0, 1, 1, 0, 1, 2, 0, 0, 2, 1], inf),
	\amp, Pseq([0.3, 0.35, 0.4, 0.35, 0.4, 0.4, 0.3, 0.2], inf),
	\att, 0.5,
	\rel, 3.5,
	\pos, 0
);

~mel_one = Pbind(
    \instrument, "am1",
    \midinote, Pseq([84, 79, 76, 70, 82, 79, 76, 70, 81, 79, 76, 70, 80, 77, 76, 77], 9),
    \dur, 1,
    \amp, Pwhite(0.15, 0.2),
    \att, 1.5,
    \rel, 0.5,
    \modfreq, Pseq([0, 8, 0, 4], inf),
	\pos, Pwhite(-1, 1.0)
);

~mel_two = Pbind(
	\instrument, "am1",
	\degree, Pseq([0, 2, 0, 2, 0, 2, 0, 2, Rest(1), 2, Rest(1), 2, Rest(1), 2, 0, 2, -2, 2, -2, 2, -2, 2, -2b, -2, -1b, 2, Rest(1), 2, Rest(1), 2, Rest(1), 2], 4),
	\modfreq, Pseq([1, 5, 1, 5], inf),
	\amp, 0.4,
	\dur, 0.5,
	\att, 0.01,
	\rel, Pwhite(0.3, 0.5),
	\pos, Pwhite(-1, 1.0)
);

~wn = Pbind(
	\instrument, "snare",
	\dur, Pseq([Rest(2), 2], 4),
	\att, 0.1,
	\rel, Pseq([0.1, 0.3, 0.05, 0,1], inf),
	\ffreq, Pseq([10000, 5000, 4000, 5000], inf),
	\amp, 0.01
);

~harm = Pbind(
	\instrument, "am2",
	\freq, Pseries(200, 100, 50, 25, 12.5),
	\modfreq, Pseq([1, 50, 10, 500, 1000], inf),
	\amp, 0.1,
	\att, 0.02,
	\rel, 8,
	\pos, Pwhite(-0.5, 0.5),
	\dur, 0.1
);
)

/////END PBINDS//////
//BEGIN QUICK TEST///

~bass.play;

~mel_one.play;

~mel_two.play;

~wn.play;

~harm.play;

/////END QUICK TEST//
//BEGIN COMPOSITION//

s.record;

s.stopRecording;


(

{
~bass.play;

4.wait;

~mel_one.play;

64.wait;

~mel_two.play;

~wn.play;

64.wait;

~harm.play;

4.stop;

}.fork;

)
raw 3534 chars (focus & ctrl+a+c to copy)
reception
comments