Add it up!

Building an array of oscillators loosely based on the harmonic series, and playing around with this idea.

(back to Code Pool) // Add it up! // 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);