«Assignment 2» by Margo Gentile

on 15 Nov'16 15:10 in

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
(
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("am1", {arg freq = 440, modfreq = 2, amp = 0.1, 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("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.02);
    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;
)


(
~fmbass = Pbind(
    \instrument, "fm2",
	\dur, Pseq([1, Rest(1), 0.5, 0.5, Rest(1/64), 1/4, Rest(1/64), 1/4, 1/4, 1/4], inf),
	\note, Pseq([0, \rest, 0, -2, \rest, 2, \rest, 3, 3, 2], inf),
	\ctranspose, -18,
	\modindex,  6,      
	\amp, Pseq([0.3, 0.35, 0.4, 0.45, 0.5, 0.45, 0.4, 0.3, 0.2], inf),
	\att, 0.01,
	\rel, 0.2,
	\pos, 0
);

~fmbass2 = Pbind(
    \instrument, "am3",
	\dur, Pseq([1, Rest(1), 0.5, 0.5, Rest(1/64), 1/4, Rest(1/64), 1/4, 1/4, 1/4], inf),
	\note, Pseq([0, \rest, 0, -2, \rest, 2, \rest, 3, 3, 2], inf),
	\ctranspose, -18,
	\modindex,  6,     
	\amp, Pseq([0.3, 0.35, 0.4, 0.45, 0.5, 0.45, 0.4, 0.3, 0.2], inf),
	\att, 0.01,
	\rel, 0.2,
	\pos, 0
);

~amz = Pbind(
    \instrument, "am1",
	\midinote, Pseq([[91.8,92], [86.8,87], [88.8,89], [91.8,92]], inf),
	 \ctranspose, -6,
    \dur, Pseq([Pn(0.5, 5), 0.3], inf),
    \amp, 0.05,
	\att,0.01,
    \rel, 0.9,
	\modfreq, 2,
	\pos, Pwhite(-0.5, 0.5)
);

~amik = Pbind(
    \instrument, "am3",
	\midinote, Pseq([67, 69, 70], [51, 53, 55], [47, 48, 49], inf),       
	\ctranspose, -12,
	\dur, Pseq([1/2, 1/2, Rest(1), 1/2, 1/2, Rest(1), 1/2, Rest(1/2), 1/2, Rest(1/2), Rest(1)], inf) *(1/4),
    \amp, 0.15,
	\att, 0.1,
	\rel, 0.5,
	\modfreq, 6,
	\pos, Prand([-0.5, 0, 0.5], inf),

);
)

s.record;
(
{
t=TempoClock(120/60);
	
~amzPlayer=~amz.play;
7.wait;
~amzPlayer.stop;
~fmbass2PLayer=~fmbass2.play;
10.wait;
	~fmbassPlayer=~fmbass.play;
6.wait;
~amik.play;
6.wait;
	~amzPlayer=~amz.play;
2.wait;
~amzPlayer.stop;
~fmbass2PLayer.stop;
~fmbassPlayer.stop;
~fmbass.play(t);
~fmbassPlayer.stop;
	~fmbass.play;
}.fork;
)
raw 3217 chars (focus & ctrl+a+c to copy)
reception
comments