-
Notifications
You must be signed in to change notification settings - Fork 10
/
linndrum.scd
138 lines (83 loc) · 2.45 KB
/
linndrum.scd
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
//LinnDrum:
// p. 23 get the samples from http://machines.hyperreal.org/manufacturers/Linn/LinnDrum/
//The website is a nice resource; there are other sample kits there like Roland TR-909 and TR-808
//I've just demoed a patch with three samples (kick, snare, hat): I've used Patterns below, though my personal preference would be explicit Busses, Groups, Synths and {}.fork for full control of routings
//load samples (assumed mono)
(
var basepath = "/Users/EmanTnuocca/Desktop/∞/g_smpl/!aa/";
b = ["kick","sd","chh"].collect{|val| Buffer.read(s,basepath++val++".wav") };
//b[0].numChannels.postln; should be 1 for mono
)
(
SynthDef(\sampleplay,{|out= 0 bufnum = 0 amp = 0.1 gate=1 pan = 0.0|
var playbuf, env;
playbuf = PlayBuf.ar(1,bufnum);
env = EnvGen.ar(Env.adsr(0.0,0.0,1.0,0.1),gate,doneAction:2);
Out.ar(out,Pan2.ar(playbuf*env*amp,pan));
}).add;
SynthDef(\samplecompress,{|out =0 gain=2 reduction=8 ratio=3 gate= 1 attackTime=0.016 relaxTime=0.05|
var source = In.ar(out,2);
var compression;
var env = Linen.kr(gate, 0.0, 1, 0.1, 2);
compression= Compander.ar(2*source,source,(-8).dbamp,1.0,ratio.reciprocal,attackTime,relaxTime);
XOut.ar(out,env, compression);
}).add;
SynthDef(\sampleeq1,{|out =0 gate= 1|
var source = In.ar(out,2);
var env = Linen.kr(gate, 0.0, 1, 0.1, 2);
var eq;
eq= BLowShelf.ar(source,100,1.0,3);
eq= BPeakEQ.ar(eq,600,1.0,-3);
XOut.ar(out,env,eq);
}).add;
SynthDef(\sampleeq2,{|out =0 gate= 1|
var source = In.ar(out,2);
var env = Linen.kr(gate, 0.0, 1, 0.1, 2);
var eq;
eq= BHiPass(150,0.3);
XOut.ar(out,env,eq);
}).add;
SynthDef(\samplereverb,{|out =0 gate= 1|
var source = In.ar(out,2);
var env = Linen.kr(gate, 0.0, 0.3, 0.1, 2);
var reverb;
reverb= FreeVerb.ar(source,1.0,0.6,0.6);
XOut.ar(out,env,reverb);
}).add;
)
(
var kick, snare,hat;
s.latency= 0.1;
kick = Pbind(
\instrument, \sampleplay,
\bufnum,b[0],
\dur,1.0,
\pan,0.0,
\amp, 0.5
);
snare = Pbind(
\instrument, \sampleplay,
\bufnum,b[1],
\dur,Pseq([1.25,0.75,2.0],inf),
\bus,16,
\amp,0.45,
\pan,0.0
);
hat = Pbind(
\instrument, \sampleplay,
\bufnum,b[2],
\dur,Pseq(0.5!8++(0.25!16),inf),
\amp, 0.15,
\pan,Pseq(0.3!8++((-0.3)!16),inf)
);
//Pfxb organises private busses for each sound
Ptpar([
0.0,
Pfxb(Pfx(kick,\samplecompress),\sampleeq1),
1.0,
Pfxb(Pfx(snare,\samplecompress,\gain,1,\reduction,10,\ratio,2,\attackTime,0.02),\samplereverb),
0.0,
Pfxb(hat,\sampleeq2)
]).play
)
TempoClock.default.tempo = 2;