«115granular» by Mason McCormack

on 29 Nov'16 21:14 in 115granular

115granular

https://soundcloud.com/macdaddymase/115granular

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
// =================================
// A4 - musc-115-granular
// GRANULAR SAMPLING
// =================================

/*
The code below is exactly what we built in class.
You will need a MONO sample.

*/

// make sure to boot server first

// load a sound file (or two...)
b = Buffer.read(s, "/Users/Mason/Desktop/Nena ‎- 99 Luftballons mono.wav");
c = Buffer.read(s, "/Users/Mason/Desktop/Sweet Dreams Eurythmics mono.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;

c.play;

// SynthDefs
(
// simple synthdef, no filters or effects, just env and panning control
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;



)

// Some testing Pbinds

// One
(
~one = Pbind(
    \instrument, "granny1",
	\rate, 100, // notice this one ENDS after 4 cycles
    \amp, 1,
    \startPos, 0.1,
    \attack, 0.5,
    \release, 2,
    \buffer, b, // which buffer to play from
    \dur, 2,
);
)


// Two
(
~two = Pbind(
    \instrument, "granny1",
	\rate, 10,
	\amp, Pwhite(0.1, 0.9),
	\startPos, Prand([0.24, 0.33, 0.66, 0.89], 32), // this one ENDS after 32 notes
    \attack, 0.01,
    \release, 0.1,
    \buffer, b, // which buffer to play from
    \dur, 0.15,
	\panning, Pwhite(-1, 1.0); // control L/R here
);
)


// Three (this one uses granny2, with the filter)
(
~three = Pbind(
    \instrument, "granny2", // notice I'm using granny2 synthdef here
	\rate, Prand([5, 5, 7, 0.92, 1.01, 2, 2, 12], inf),
	\amp, 5, // boosted to 5 because filtering attenuates a lot of the sound
	\startPos, Pseq([0.24, 0.33, 0.66, 0.89], inf),
    \attack, 0.02,
    \release, 0.4,
	\ffreq, Pseq([100, 200, 400, 500, 600, 900, 1000, 2000], inf),
	\rq, 0.01,
    \buffer, c, // which buffer to play from
    \dur, 0.25,
	\panning, Pwhite(-0.5, 0.5)
);
)




// Four (this one uses granny3, with a filter AND a CombC (the delay/echo))
(
~four = Pbind(
    \instrument, "granny3", // notice I'm using granny2 synthdef here
	\rate, Pseq([5, 7, 3, 13], inf),
	\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound
	\startPos, Pseq([0.14, 0.13, 0.7, 0.9], inf),
    \attack, 0.5,
    \release, 2,
	\ffreq, Pseq([100, 200, 400, 550, 9000, 50, 100, 2000], inf),
	\rq, 0.1,
	\delay, 0.2,
	\decay, 2,
    \buffer, c, // which buffer to play from
    \dur, 0.5,
	\panning, Pwhite(-0.5, 0.5)
);

(
~five = Pbind(
    \instrument, "granny2", // notice I'm using granny2 synthdef here
	\rate, Pseq([5, 20, 40, 100, 200], inf),
	\amp, 5, // boosted to 5 because filtering attenuates a lot of the sound
	\startPos, Pseq([0.24, 0.33, 0.66, 0.89], inf),
    \attack, 0.02,
    \release, 0.4,
	\ffreq, Pseq([2000], inf),
	\rq, 0.01,
    \buffer, c, // which buffer to play from
    \dur, 0.25,
	\panning, Pwhite(-0.5, 0.5)
);
)






)

~one.play;
~two.play;
~three.play;
~four.play;
~five.play;
(
{
	
~threeplay1=~three.play;
7.wait;
~fourplay=~four.play;
2.wait;
~fourplay.stop;	
~threeplay2=~three.play;
3.wait;
~threeplay2.stop;
~threeplay1.stop;
~fiveplay=~five.play;
4.wait;
~fiveplay.stop;	
~threeplay1=~three.play;
~fourplay=~four.play;	
4.wait;
~threeplay1.stop;	
~fourplay.stop;
~threeplay1=~three.play;
1.wait;
~threeplay1.stop;	
~threeplay1=~three.play;
1.wait;
~threeplay1.stop;
~threeplay1=~three.play;
1.wait;
~threeplay1.stop;	
~threeplay1=~three.play;
1.wait;
~threeplay1.stop;	
~fiveplay=~five.play;	
4.wait;
~fiveplay.stop;
~threeplay1=~three.play;	
	

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