Using the Git Repository

Git is a distributed version control system. Changes to (text) files are grouped in chunks called commits. You can create new branches of a repository for specific features or tasks and merge those branches after you finished your changes.

Cloning a Git Repository

git clone

This creates a directory with the name SPRAWL and clones the git repository locally.

With git log you can see all recent commits.

Create Branches, Adding Changes and Committing

Let's create a new branch for our changes:

git checkout -b new_changes

Now we are on a new created branch called new_changes. If you omit the -b you checkout a branch that is on the remote repository.

The easiest way to committing changes is to commit every changes of files.

git add file.txt
git add file2.txt
git commit -m "Fixes wording of file.txt and file3.t wsgh s"

Sometimes it happens that you commited your changes too early but didn't pushed your changes to the remote server. If you only want to change the commit message you can use git commit --amend. The same command works for adding more changes to the last commit. Don't forget to use git add filename.

Pushing Changes to the Remote Server

With git you can have more than one remote repository. After you cloned the sprawl repository you will have a remote repository with the name origin.

student@h2912420:~/SPRAWL$ git remote -v
origin (fetch)
origin (push)

But you don't have any push access to this repository. To get your changes into the mainline SPRAWL repository you have to fork the project on github. At the right top corner at the sprawl's repo you must click on fork. Then you can add your own repo to your local SPRAWL clone:

$ git remote add ntonnaett
$ git remote -v
ntonnaett (fetch)
ntonnaett (push)
origin (fetch)
origin (push)
git push ntonnaett

Exchange ntonnaett with your personal remote name. After you committed all your changes you can open a pull request on the mainline sprawl repository.

Using Arrays in SuperCollider

Simple Arrays

In SC, arrays are collections of objects of any kind. They can be defined and accessed using brackets:

// define simple arrays:
a = [0,1,2,3];
b = [0,1,2,"last_value"];

// access indices:

Dynamic Creation

The array class offers numerous methods for creating arrays, including fill():

c = Array.fill(4,{arg i; 10/(i+1) });

Arrays of Buses

Especially in multichannel projects and larger mixing setups, arrays of buses can be helpful. Make sure to boot the server to actually use (scope) the buses:

// an array of 16 buses, each with 4 channels:
~busArray = Array.fill(16,{Bus.control(s, 4)})

// scope the second bus in the array:

// set the third bus of the second bus in the array:

Array of Nodes/UGens

The same array approach can be used to generate multiple nodes, for example sine waves at different frequencies and amplitudes:

// an array of 16 sine oscillators:
~sineArray = Array.fill(16,{arg i;{*i)}.play})

Array of Synths

The previous example can also be used with SynthDefs, which is a good starting point for additive synthesis:

// a simple synthdef
{|f = 100, a = 1|, a *;


~busArray = Array.fill(16,{arg i;\sine,[f:200*(i+1),a:0.2])})

Wavetable Oscillator with Phase Reset

The Faust oscillators.lib comes with many different implementations of oscillators for various waveforms. At some point one might still need a behavior not included and lower level approaches are necessary.

This example shows how to use a phasor to read a wavetable with a sine waveform. This implementation has an additional trigger input for resetting the phase of the oscillator on each positive zero crossing. This can come handy in various applications, especially for phase-sensitive transients, as for example in kick drums.

The example is derived from Barkati et. al (2013) and part of the repository:


// some basic stuff
sr = SR;
twopi = 2.0*ma.PI;

// define the waveform in table
ts =  1<<16; // size = 65536 samples (max of unsigned short)
time = (+(1) ~ _ ) , 1 : - ;
sinewave =  ((float(time) / float(ts)) * twopi) : sin;

phase = os.hs_phasor(ts,freq,trig);

// read from table
sin_osc( freq) = rdtable(ts ,sinewave , int(phase)) ;

// generate a one sample impulse from the gate
trig =  pm.impulseExcitation(reset);

reset = button ("reset");
freq = hslider("freq", 100, 0, 16000, 0.00001);

// offset = hslider("offset", 0, 0, 1, 0.00001);

process = sin_osc(freq);
  • Karim Barkati and Pierre Jouvelot. Synchronous programming in audio processing: a lookup table oscillator case study. ACM Computing Surveys (CSUR), 46(2):1–35, 2013.
  • Sending OSC from SuperCollider

    For sending OSC from SuperCollider, a NetAddr object needs to be generated. It needs an IP address and a port:

    ~out_address  = NetAddr("", 6666);

    Sending Values Once

    This first example sends an OSC message once when the following line is evaluated. The previously created NetAddr object can be used to send OSC messages with its sendMsg method:

    ~out_address.sendMsg('/test/message', 1);

    Sending Values Continuously

    Based on the previous example, a routine can be created which continuously reads values from control rate buses to send their instantaneous value via OSC. The osc_routine runs an infinite loop with a short wait interval to limit the send rate and the CPU load:

      ~cBus = Bus.control(s,1);
      ~osc_routine = Routine({
          // read value from bus
                      var value      = ~cBus.getSynchronous(~nVbap);
          // send value
                      ~out_address.sendMsg('/oscillator/frequency', value);
                      // wait

    Once created, the routine can be started and stopped with the methods play() and stop(). While running, bus values can be changed to test the functionality:;



    Run the PD patch osc-receive.pd to receive values from SuperCollider via OSC and control the pitch.

    Additive & Spectral: IFFT Synthesis

    The calculation of single sinusoidal components in the time domain can be very inefficient for a large number of partials. IFFT synthesis can be used to compose spectra in the frequency domain.


    Main lobe kernel for \(\varphi = 0\)


    Main lobe kernel for \(\varphi = \pi/2\)


    Main lobe kernel for \(\varphi = \pi/4\)


    Main lobe kernel for \(\varphi =c3 \pi/4\)

    Laplace Transform

    Contents © Henrik von Coler 2021 - Contact