Designing Sound in SuperCollider/Additive synthesis

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Fig 17.4: Additive synthesis[edit | edit source]

Additive synthesis using eqn 17.2, taken from Moorer.

First start the server, if you haven't already - this time making sure it's the server which lets use the oscilloscopes:

Server.default = s = GUI.stethoscope.defaultServer;

In the following we use ".sin" and ".cos" as mathematical operations, so we can stick closely to the original design - these are much less efficient than using SC's SinOsc oscillator, which is what most people would use for additive synthesis in SuperCollider.

In the original diagram, freq starts as 122, index as 0.42. Here we connect these parameters to the mouse - left/right for freq, up/down for harmonic decay.

The amplitude will vary with the decay coefficient, so practically, you'd want some kind of normalisation.

x = {	
	var freq =, 1000, 1) /;
	var distance = 3.00;
	var index =, 0.99);
	var theta, beta, num, denom, son;
	// Two phasors which will ramp from zero to 2pi
	theta =, freq, 0, 2pi);
	beta  =, freq * distance, 0, 2pi);
	num = sin(theta) - (index * sin(theta - beta));
	denom = 1 + index.squared - (2 * index * cos(beta));
	son = num / denom;, * 0.3));
}.freqscope;  // Use ".freqscope" or ".scope", both are illustrative.