Spatial Additive in SuperCollider

The following example creates a spatially distributed sound through additive synthesis. A defined number (40) of partials is routed to individual virtual sound sources which are rendered to a 3rd order Ambisonics signal.

A Partial SynthDef

A SynthDef for a single partial with amplitude and frequency as arguments. In addition, the output bus can be set. The sample rate is considered to avoid aliasing for high partial frequencies.


              |outbus = 16, freq=100, amp=1|

              // anti aliasing safety
              var gain = amp*(freq<(*0.5));

              var sine = gain*;

    , sine);


The Partial Synths

Create an array with 40 partial Synths, using integer multiple frequencies of 100 Hz. Their amplitude decreases towards higher partials. An audio bus with 40 channels receives all partial signals separately. All synths are added to a dedicated group to ease control over the node order.

~partial_GROUP = Group(s);

~npart         = 40;

~partial_BUS   =,~npart);

~partials = Array.fill(40,
{ arg i;
  Synth(\spatial_additive, [\outbus,~partial_BUS.index+i, \freq, 100*(i+1),\amp, 1/(1+i*~npart*0.1)],~partial_GROUP)


The Encoder SynthDef

A simple encoder SynthDef with dynamic input bus and the control parameters azimuth and elevation.

~ambi_BUS      =,16);

              |inbus=0, azim=0, elev=0|


The Encoder Synths

An array of 16 3rd order decoders is created in a dedicated encoder group. This group is added after the partial group to ensure the correct order of the synths. Each encoder synth receives a single partial from the partial bus. All 16 encoded signals are sent to a 16-channel audio bus.

~encoder_GROUP = Group(~partial_GROUP,addAction:'addAfter');

~encoders = Array.fill(~npart,
      {arg i;
              Synth(\encoder,[\inbus,~partial_BUS.index+i,\azim, i*0.1],~encoder_GROUP)


The Decoder Synth

A decoder is added after the encoder group and fed with the encoded Ambisonics signal. The binaural output is routed to outputs 0,1 - left and right.

// load binaural IRs for the decoder

~decoder = {,,, 16)));


Exercise I

Create arrays of LFOs or other modulation signals to implement a varying spatial image. Use an individual control rate bus for each parameter to be controlled.

Exercise II

Modulate the timbre (relative partial amplitudes) with the modulation signals.

Sliders in PD

This very basic sine.pd example creates a sine wave oscillator. Its frequency can be controlled with a horizontal slider. Ann additional toggle object allows to switch the sine on and of, by means of multiplication. When used without arguments, the dac~ object has two inlets, which relate to the left and right channel of the audio interface. The additional message box with the bang can be used to activate the DSP. This is necessary for getting any sound and can also be done in the menu.




  • Miller S. Puckette. Pure Data. In Proceedings of the International Computer Music Conference (ICMC). Thessaloniki, \\ Greece, 1997.
    [details] [BibTeX▼]


  • Miller S. Puckette. The patcher. In Proceedings of the International Computer Music Conference (ICMC). Computer Music Association, 1988.
    [details] [BibTeX▼]

Osaka 1970 - German Pavilion

The German Pavilion

The German Pavilion at the 1970 Expo in Osaka was an elaborate spatial audio project. Various artists, including Bernd Alois Zimmermann, Boris Blacher and Karlheinz Stockhausen, contributed works for the spherical loudspeaker setup:


The German Pavilion at the 1970 Expo in Osaka.

A device for live spatialization in the Osaka Pavilion was developed at TU Berlin.


TU-designed 'Kugelsensor' for live spatialization in the auditorium.


The following sketch shows Stockhausen's approach for working with the system, using an 8-track tape machine:


Sketch for Stockhausen's work 'Hinab-Hinauf'.

TU Composition


Simple Waveguides in C++

Waveguides can be used to model acoustical oscillators, such as strings, pipes or drumheads. The theory of digital waveguides is covered in the sound synthesis introduction.

The WaveGuide Class

The WaveGuide class implements all necessary components for a waveguide string emulation. Inside the class, the actual waveguide-buffers are realized as pointers to double arrays.

From ``WaveGuide.h``:

/// length of the delay lines
int     l_delayLine;

/// leftward delay line
double  *dl_l;

/// rightward delay line
double  *dl_r;

The pointer arrays need to be initialized in the constructor of the WaveGuide class.

From ``WaveGuide.cpp``:

dl_l = new double[l_delayLine];
dl_r = new double[l_delayLine];

for (int i=0; i<l_delayLine-1; i++)
    dl_l[i] = 0.0;
    dl_r[i] = 0.0;

Plucking the String

The method void WaveGuide::excite(double pos, double shift) is called for plucking the string, respectively exciting it. It receives a plucking position and a shift parameter. In two loops, the method fills the two waveguides with the excitation function. In this example, a simple triangular function is chosen.

From ``WaveGuide.cpp``:

// set positive slope until plucking index
for (int i=0; i<idx; i++)
    dl_l[i] = 0.5* ((double) i / (double)(idx));
    dl_r[i] = 0.5* ((double) i / (double)(idx));
// set negative slope from plucking index to end
for (int i=idx; i<l_delayLine; i++)
    dl_l[i] = 0.5*(1.0 - ((double) i / (double) (l_delayLine-idx)));
    dl_r[i] = 0.5*(1.0 - ((double) i / (double) (l_delayLine-idx)));


Karplus-Strong in Faust

White Tone Oscillator

As explained in the Sound Synthesis Introduction, the Karplus-Strong algorithm is based on a sequence of white noise. The following example uses a feedback structure to create a looped version of a white noise array:


Main components of the above example are the excitation and the resonator. The resonator is a feedback loop with an adjustable delay:


The excitation passes a random sequence to the resonator, once the gate is activated. It will oscillate until the gate is released.

Load the example in the Faust online IDE for a quick start:

// white_tone.dsp
// Henrik von Coler
// 2021-07-04


// Control parameters:
freq = hslider("freq Hz", 50, 20, 1000, 1) : si.smoo; // Hz
gate = button("gate");

// processing elements for excitation:
diffgtz(x) = (x-x') > 0;
decay(n,x) = x - (x>0)/n;
release(n) = + ~ decay(n);
trigger(n) = diffgtz : release(n) : > (0.0);

P = SR/freq;

// Resonator:
resonator = (+ : delay(4096, P) * gate) ~ _;

 // processing function:
process = noise : *(gate : trigger(P)): resonator <: _,_;

Karplus-Strong in Faust

The Karplus-Strong algorithm for plucked string sounds is explained in detail in the Sound Synthesis Introduction. That implementation is based on a ring buffer with a moving average filter. For the Faust implementation, this example has been adjusted, slightly (Smith, 2007).



Extend the White Tone example with a filter in the feedback to turn it into a Karplus-Strong synthesis.



  • Romain Michon, Julius Smith, Chris Chafe, Ge Wang, and Matthew Wright. The faust physical modeling library: a modular playground for the digital luthier. In International Faust Conference. 2018.
    [details] [BibTeX▼]


Time-Frequency Domain

Compiling JackTrip

The SPRAWL System needs some additional features that are missing from the main branch of Jacktrip. To build the correct JackTrip version, the Jacktrip git repository must be cloned and checked out to the correct branch.

Therefor git must be installed. On MacOS git is often already installed. Linux users should install git through their package manager. Windows users download the installer from git-scm.

Getting the JackTrip Source Code

Now the JackTrip source code can be downloaded from the official JackTrip repository.

git clone
git checkout nils

Changes in the remote repository have to get pulled.

git pull

Afterwards you can follow the official build instructions.

Moving Files with SCP

SCP (Secure copy protocol) is an SSH-based tool for transferring files between machines in local and wide area networks. It is a safe and quick way to exchange data.

Copying to a Remote Machine

The following command copies the file testfile.html from the local machine to the home directory of the user student on the server with the address specified address 11.22.33. Instead of the home directory (~/), any other target can be specified:

$ scp testfile.html student@11.22.33:~/

Add the -r flag to copy a directory recursively:

$ scp -r /foo/bar student@11.22.33:~/

.. admonition:: Exercise

  Select or create a short WAV file on your local machine and copy it to your personal directory on the server using SCP.

Copying From a Remote Machine

To copy a file from a remote server, the arguments' order needs to be swapped. The dot (.) copies the data to the recent directory. Any other path can be used as target.

$ scp student@ .


Create a text file in your personal directory on the server. Copy it to your local machine using the SCP command from your local machine.

Waveshaping Example

The following interactive example offers control over the pre-gain to add overtones to the sinusoidal source signal:

Pitch (Hz):


Output Gain:

Time Domain:

Frequency Domain: