-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCaosGuitChords.sc
More file actions
120 lines (103 loc) · 3.01 KB
/
CaosGuitChords.sc
File metadata and controls
120 lines (103 loc) · 3.01 KB
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
//Written by @IllSlide
//Chord generator as common Guitar interval disposition
//Part of CaosPercLib v1.2.3
CaosGuitChords : CaosEnv {
*new {
^super.new;
}
*ar{|chord='m',att=0.05,rel=1,note=60,cutf=12000,rq=0.5,gate=1,amp=0.4,pan=0,doneAction=2|
var sig, env;
sig = this.signal(chord,note,cutf,rq,amp);
env = this.envKR(att,rel,gate,doneAction);
^Pan2.ar(sig*env,pan);
}
ar{|chord='m',att=0.05,rel=1,note=60,cutf=12000,rq=0.5,gate=1,amp=0.4,pan=0,doneAction=2|
var sig, env;
sig = this.signal(chord,note,cutf,rq,amp);
env = this.envKR(att,rel,gate,doneAction);
^Pan2.ar(sig*env,pan);
}
*robot{|chord='m',att=0.05,rel=1,note=60,cutf=12000,rq=0.5,amp=0.4,pan=0,t=1, tp=0,doneAction=0|
var sig,env;
sig = this.signal(chord,note,cutf,rq,amp);
env = this.envKR(att,rel,Impulse.kr(t,tp),doneAction);
env=EnvGen.kr(Env.perc(att,rel),Impulse.kr(t,tp),0)
^Pan2.ar(sig*env,pan);
}
*signal {|chord,note,cutf,rq,amp|
var sint,filt;
var interval,notes,chords,ton,third,fifth,seventh,oct,octfifth;
chords=['M', 'm', 'M7', 'm7', 'Mmaj7', 'mmaj7', 'M9', 'M9m', 'm9', 'm9m'];
interval = [
[0,7,12,16,19,24],
[0,7,12,15,19,24],
[0,7,10,16,19,24],
[0,7,10,15,19,24],
[0,7,10,15,19,24],
[0,7,11,16,19,24],
[0,7,11,15,19,24],
[0,7,14,16,19,24],
[0,7,13,16,19,24],
[0,7,14,15,19,24],
[0,7,13,15,19,24]
];
if(chords.includes(chord),{
notes = note+interval[chords.indexOf(chord)];
},{7.do{"ERR: Use 'M', 'm', 'M7', 'm7', 'Mmaj7', 'mmaj7', 'M9', 'M9m', 'm9' or 'm9m' only as first CaosChord.ar argument".warn}
});
ton=notes[0];
third=notes[3];
fifth=notes[1];
seventh=notes[2];
octfifth=notes[4];
oct=notes[5];
sint=(
SinOsc.ar(ton.midicps,0,amp/1.25)+
LFTri.ar(fifth.midicps,0.15,amp/2.4)+
LFTri.ar(seventh.midicps,0.25,amp/3.3)+
LFTri.ar(third.midicps,0.5,amp/3)+
LFTri.ar(octfifth.midicps,0.75,amp/3.3)+
Saw.ar(oct.midicps,amp/6);
);
filt=LPF.ar(sint,cutf,rq);
^sint+filt;
}
signal {|chord,note,cutf,rq,amp|
var sint,filt;
var interval,notes,chords,ton,third,fifth,seventh,oct,octfifth;
chords=['M', 'm', 'M7', 'm7', 'Mmaj7', 'mmaj7', 'M9', 'M9m', 'm9', 'm9m'];
interval = [
[0,7,12,16,19,24],
[0,7,12,15,19,24],
[0,7,10,16,19,24],
[0,7,10,15,19,24],
[0,7,10,15,19,24],
[0,7,11,16,19,24],
[0,7,11,15,19,24],
[0,7,14,16,19,24],
[0,7,13,16,19,24],
[0,7,14,15,19,24],
[0,7,13,15,19,24]
];
if(chords.includes(chord),{
notes = note+interval[chords.indexOf(chord)];
},{7.do{"ERR: Use 'M', 'm', 'M7', 'm7', 'Mmaj7', 'mmaj7', 'M9', 'M9m', 'm9' or 'm9m' only as first CaosChord.ar argument".warn}
});
ton=notes[0];
third=notes[3];
fifth=notes[1];
seventh=notes[2];
octfifth=notes[4];
oct=notes[5];
sint=(
SinOsc.ar(ton.midicps,0,amp/1.25)+
LFTri.ar(fifth.midicps,0.15,amp/2.4)+
LFTri.ar(seventh.midicps,0.25,amp/3.3)+
LFTri.ar(third.midicps,0.5,amp/3)+
LFTri.ar(octfifth.midicps,0.75,amp/3.3)+
Saw.ar(oct.midicps,amp/6);
);
filt=LPF.ar(sint,cutf,rq);
^sint+filt;
}
}