«Assignment 3 115granular» by Margo Gentile

on 29 Nov'16 15:57 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
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
// load a sound file (or two...)
b = Buffer.read(s, "/Users/alg31/Downloads/bad-mono.wav");

c = Buffer.read(s, "/Users/alg31/Downloads/but-music.wav");

// buffer handy tools:
b.play;
// check number of channels
b.numChannels;
// check duration
b.duration;
// check how many samples are in the sample
b.numFrames;


//SynthDefs

(
SynthDef("granny1", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, panning = 0;
    var snd, env;
    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);
    snd = PlayBuf.ar(
        numChannels: 1,
        bufnum: buffer,
        rate: rate,
        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))
    );
    snd = snd * env;
	snd = Pan2.ar(snd, panning);
    Out.ar(0, snd);
}).add;

// Same as above, but adding a filter just for fun
SynthDef("granny2", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0;
    var snd, env;
    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);
    snd = PlayBuf.ar(
        numChannels: 1,
        bufnum: buffer,
        rate: rate,
        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))
    );
    snd = snd * env;
    snd = BPF.ar(snd, ffreq, rq);
    snd = Pan2.ar(snd, panning);
    Out.ar(0, snd);
}).add;

// Same as above, but adding an echo effect (CombC)
SynthDef("granny3", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0, delay = 0.3, decay = 1;
    var snd, env;
    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);
    snd = PlayBuf.ar(
        numChannels: 1,
        bufnum: buffer,
        rate: rate,
        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))
    );
    snd = snd * env;
    snd = BPF.ar(snd, ffreq, rq);
	snd = CombC.ar(snd, maxdelaytime: 2, delaytime: delay, decaytime: decay);
    snd = Pan2.ar(snd, panning);
    Out.ar(0, snd);
}).add;

)


// Pbinds

(
~one = Pbind(
    \instrument, "granny1",
	\rate, Pseq([0.4, 0.42, 0.44, 0.48, 0.5, 0.52, 0.54, 0.56], inf), // notice this one ENDS after 4 cycles
    \amp, 1,
    \startPos, 0.19,
    \attack, 0.01,
    \release, 0.23,
	\buffer, b, // which buffer to play from
	\dur, Pseq([Pn(1/2, 8), Pn(1/4, 16)], inf),
);

~two = Pbind(
    \instrument, "granny1",
	\rate, Pseq([0.19, 0.19, 0.19, 0.25], inf),
	\amp, 0.3,
	\startPos, 0.1,
    \attack, 2.3,
    \release, 0.5,
	\buffer, c, // which buffer to play from
    \dur, 2.5,
);

~three = Pbind(
    \instrument, "granny2", // notice I'm using granny2 synthdef here
	\rate, Pseq([-1, 2], inf),
	\amp, 5, // boosted to 5 because filtering attenuates a lot of the sound
	\startPos, 0.1,
    \attack, 0.02,
    \release, 0.4,
	\ffreq, Pseq([9000, 2000, 2030, 9100], inf),
	\rq, 0.01,
    \buffer, b, // which buffer to play from
    \dur, 0.25,
	\panning, Pwhite(-0.5, 0.5)
);

~three3 = Pbind(
    \instrument, "granny2", // notice I'm using granny2 synthdef here
	\rate, Pseq([-1, 2], inf),
	\amp, 5, // boosted to 5 because filtering attenuates a lot of the sound
	\startPos, 0.09,       //Pseq([0.24, 0.33, 0.66, 0.89], inf),
    \attack, 0.02,
    \release, 0.4,
	\ffreq, Pseq([9000, 2000, 2030, 9100], inf),
	\rq, 0.01,
    \buffer, b, // which buffer to play from
    \dur, 0.5,
);

~one1 = Pbind(
    \instrument, "granny1",
	\rate, 0.2, 0.2, \rest, 0.7, 0.6, 0.8, \rest, 0.8, \rest,
    \amp, 1,
    \startPos, 0.18,
    \attack, 0.03,
    \release, 0.1,
	\buffer, b, // which buffer to play from
	\dur, Pseq([1/4, 1/4, Rest(1/2), Pn(1/6, 3), Rest(1/6), 1/6, Rest(1/6)], inf),
);

~four = Pbind(
    \instrument, "granny3", 
	\rate, Pseq([-1, 2, 3, 3], inf),
	\amp, 5,
	\startPos, 0.7,
    \attack, 0.3,
    \release, 0.2,
	\ffreq, Pseq([700, 200, 400, 550], inf),
	\rq, 0.01,
	\delay, 0.2,
	\decay, 2,
    \buffer, b, // which buffer to play from
    \dur, 0.25,
);

~two2 = Pbind(
    \instrument, "granny2",
	\rate, -2,
	\amp, 0.3,
	\startPos, 0.94,
    \attack, 0.09,
    \release, 0.1,
	\buffer,  b, // which buffer to play from
	\dur, Pn(0.25, 8),
);
)





(
Pspawner({ arg maestro;

	~player2=maestro.par(~two);
	10.wait;
	maestro.suspend(~player2);
	~player22=maestro.par(~two2);
	2.wait;
	maestro.suspend(~player22);
   ~player1= maestro.par(~one);
	6.wait;
	~player22=maestro.par(~two2);
	2.wait;
	maestro.suspend(~player22);
	maestro.suspend(~player1);
  ~player3=maestro.par(~three);
  ~player33=maestro.par(~three3);
	12.wait;
	~player11=maestro.par(~one1);
	4.wait;
	~player22=maestro.par(~two2);
	4.wait;
	maestro.suspend(~player22);
	4.wait;
	~player22=maestro.par(~two2);
	4.wait;
	maestro.suspend(~player11);
	maestro.suspend(~player22);
	4.wait;
	maestro.suspend(~player3);
	maestro.suspend(~player33);
	~player22=maestro.par(~two2);
	4.wait;
	maestro.suspend(~player22);
	~player4=maestro.par(~four);
	4.wait;
	maestro.suspend(~player4);
	~player22=maestro.par(~two2);
	4.wait;
	maestro.suspend(~player22);
    ~player2=maestro.par(~two);
	6.wait;
	maestro.suspendAll;

}).play;
)
raw 5316 chars (focus & ctrl+a+c to copy)
reception
comments
Margo Gentile user 29 Nov'16 16:00

https://soundcloud.com/user-682771679/waking-up-115granular