«Add it up!» by codepool

on 27 Apr'17 16:16 in oscillator

Migration from the old SourceForge wiki.

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
// Add it up!
// Building an array of oscillators loosely based on the harmonic series, and playing around with this idea.
// nonprivate standing on the shoulders of andy baxter

// Formlet


(
var numHarm = 40, freqJitterDensity = 500; 

SynthDef.new("additup1", 
	{
	arg freq = 440, amp = 1, out = 0,
		freqJitterAmt = 0, harmMult = 1, harmOffset = 1, harmDecayPower = 1,
		formFreqRatio = 1, formAttack = 0.005, formDecay = 0.003; 
		
		freq = MouseX.kr(30, 1600, 1); 
		
		Out.ar(out, Pan2.ar(
		
			Mix.fill(
				numHarm,
				{ 
				arg index; 

				Formlet.ar(
					Impulse.ar(freq * Lag.ar(Dust2.ar( (freqJitterDensity + (freqJitterDensity * 0.2).rand2), freqJitterAmt, 1), 0.3), 1.0.rand), 
					freq * formFreqRatio * (index * harmMult + harmOffset),
					formAttack,
					formDecay,
	                		1/((index * harmMult + harmOffset) ** harmDecayPower) 
	            	) 
				} 
			) * amp * 0.8,
		0, 1)); 
    } 
    ).send(s); 
) 


(
n = s.nextNodeID;
s.sendMsg("/s_new", "additup1", n, 0, 0);
)


(
//attack of the wasps

s.sendMsg("/n_set", n, 
	\amp, 1.6,	
	\freqJitterAmt, 40, \harmMult, 3, \harmOffset, 2, \harmDecayPower, 0.7,
	\formFreqRatio, 0.2, \formAttack, 0.003, \formDecay, 0.0002
);

)

(
// small airplane
s.sendMsg("/n_set", n,
	\amp, 0.6, 	
	\freqJitterAmt, 4, \harmMult, 0.01, \harmOffset, 1.1, \harmDecayPower, 2,
	\formFreqRatio, 4, \formAttack, 0.003, \formDecay, 0.02
);

)

(
// synthy
s.sendMsg("/n_set", n, 	
	\amp, 0.2,
	\freqJitterAmt, 0, \harmMult, 1, \harmOffset, 1.1, \harmDecayPower, 0.8,
	\formFreqRatio, 0.5, \formAttack, 0.0007, \formDecay, 0.2
);

)

(
// cubik
s.sendMsg("/n_set", n, 	
	\amp, 0.4,
	\freqJitterAmt, 0.5, \harmMult, 0.8, \harmOffset, 1.1, \harmDecayPower, 0.5,
	\formFreqRatio, 3.01, \formAttack, 0.07, \formDecay, 0.002
);


)

s.sendMsg("/n_free", n);



// Sines

(

var numHarm = 20, freqJitterDensity = 200; 

SynthDef.new("additup2", 
	{
	arg freq = 223, amp = 1, out = 0,
		freqJitterAmt = 0,
		harmMult = 1, harmOffset = 1, harmDecayPower = 1; 
		
		freq = MouseX.kr(30, 1600, 1); 
		
		Out.ar(out, Pan2.ar(
			Mix.fill(
				numHarm,
				{ 
				arg index; 

				SinOsc.ar(
					
					(freq * Lag.ar(Dust2.ar( (freqJitterDensity + (freqJitterDensity * 0.2).rand2), freqJitterAmt, 1), 0.3)) 
					* (index * harmMult + harmOffset),
					1.00.rand,
	                		1/((index * harmMult + harmOffset) ** harmDecayPower) 
	            	) 
				} 
			) * amp * 0.1,
		0, 1)); 
    } 
    ).send(s); 

) 

(
n = s.nextNodeID;
s.sendMsg("/s_new", "additup2", n, 0, 0);
)



(
// hollow joy

s.sendMsg("/n_set", n, 
	\amp, 1.2,	
	\freqJitterAmt, 1.7, \harmMult, 1.4, \harmOffset, 1, \harmDecayPower, 1.3
);

)

(
// alien brook
s.sendMsg("/n_set", n,
	\amp, 4, 	
	\freqJitterAmt, 400, \harmMult, 0.2, \harmOffset, 6, \harmDecayPower, 1
);

)

(
// hard nosed
s.sendMsg("/n_set", n, 	
	\amp, 0.5,
	\freqJitterAmt, 0, \harmMult, 5, \harmOffset, 5, \harmDecayPower, 0.1
);

)

(
// whistling breeze
s.sendMsg("/n_set", n, 	
	\amp, 3,
	\freqJitterAmt, 4, \harmMult, 0.1, \harmOffset, 7, \harmDecayPower, 1
);


)

s.sendMsg("/n_free", n);
raw 3274 chars (focus & ctrl+a+c to copy)
reception
comments