Fourier Series: Triangular


The triangular wave is a symmetric waveform with a stronger decrease towards higher partials than square wave or sawtooth. Its Fourier series has the following characteristics:

  • only odd harmonics
  • altering sign
  • (squared)

\(X(t) = \frac{8}{\pi^2} \sum\limits_{i=0}^{N} (-1)^{(i)} \frac{\sin(2 \pi (2i +1) f\ t)}{(2i +1)^2}\)

Interactive Example

Pitch (Hz):

Number of Harmonics:

Output Gain:

Time Domain:

Frequency Domain:

Sampling & Aliasing: Square Example

For the following example, a sawtooth with 20 partials is used without band limitation. Since the builtin Web Audio oscillator is band-limited, a simple additive synth is used in this case. At a pitch of about \(2000 Hz\), the aliases become audible. For certain fundamental frequencies, all aliases will be located at actual multiples of the fundamental, resulting in a correct synthesis despite aliasing. In most cases, the mirrored partials are inharmonic and distort the signal and for higher fundamental frequencies the pitch is fully dissolved.

Pitch (Hz):

Output Gain:

Time Domain:

Frequency Domain:

Anti-Aliasing Filters

In analog-to-digital conversion, simple anti-aliasing filters can be used to band-limit the input and discard signal components above the Nyquist frequency. In case of digital synthesis, however, this principle can not be applied. When generating a square wave signal with an infinite number of harmonics, aliasing happens instantaneously and can not be removed, afterwards.

Band Limited Generators

In order to avoid the aliasing, band-limited signal generators are provided in most audio programming languages and environments.

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.
  • Julius Smith. Making virtual electric guitars and associated effects using faust. REALSIMPLE Project, 2007. URL:
  • Spatializing Rhythmic Music

    Spatialization of rhythmic music is quite different from working with experimental content. Movements need to be synced to the rhythmic rhythmic structure. For techno and related genres it is even more restrictive, since movements and signal alteration through rendering algorithms must not degrade the bass structure and the transients. The music must not lose its energy and spatial effects have to be used carefully. Kick and bass are usually not spatialized at all, making it as tight as possible.

    Garbicz 2019



    Res9 during setup.



    A surround system with a diameter of ~22 m, featuring 6 Funktion One Resolution 2 and 4 Res9 (and many subs), was installed at Garbicz Festival 2019. Ambisonics rendering was performed with IRCAM's PanoramixApp.


    PD was used to perform beat-tracking and real-time feature extraction, as well as for generating synced source movements. An Ableton Push could be used with the PD patches for controlling the source movements with a simple, intuitive interface. The patch allows the spatialization of multiple mono sources for live acts and the treatment of stereo sources through MS processing for DJs.


    PD patch for movement generation and control (click to enlarge).

    Movement Demo

    This video shows beat-aligned source movements and free rotations for a multi track spatialization. It is created with GEM (Pure Data), which is also used for visualizing the source movements during operation of the system. This example is only a mockup - the audio is not rendered from these movements but the standard stereo mix is used.

    Demonstration of source movements with 'Combination 03' by JPLS

    Time-Frequency Domain

    2020-2021 Class


    For the first online edition of the SPRAWL class, all students were equipped with the original Access Points, used for the original approach. The concept relied on irregular weekend sessions with additional meetings during the week.

    In each session, the SPRAWL System was used for audio connections. Video and additional talkback for trouble shooting was realized with a parallel Zoom session, as shown in the figure below. For leave streams, as in the closing concert, the audio from the Jacktrip connections is merged with the video from the Zoom meeting, by means of OBS on an additional Acess Point dedicated to straming.


    Video stream during the closing concert.

    Scores and Compositions

    Several conepts were explored during the semester, including graphic scores, text-based compositions and configuration-based improvisations.

    Graphic Scores

    Graphic scores are a simple but effective means for guiding improvisations in network performances. They can be distributed to all participants via screen sharing to ensure a decent synchronization.


    Blodgett is a text-based score by Robert Stokowy, comissioned by the EOC in 2019:

    The score gives precise instructions on the spatial behavior of the sound sources. In the SPRAWL System, each participant takes control of his/her own source position, thus sharing the task of spatialization. Focusing on simple properties like proximity/distance and movement/stillness, each student programmed a Pure Data patch, allowing a GUI-based control on the default Access Points' touch screen.

    Granular Confusion

    Granular Confusion is a concept by Mario Hillenbrand, developed for the SPRAWL System. The Access Points are devided into sound generators and processors:

    • Generators can use any means for sound generation.
    • Processors are all running the same granular patch.

    The Access Points are statically connected, as shown in the figure below. An additional sound director takes care of spatialization and manages the start/stop procedure of the configuration. A minimal timeline is used to guide the iprovisation, telling the generators when to be active.


    Signal routing for Granular Confusion.

    Back to NSMI Contents

    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:

    Using Python for Control

    Python offers many useful tools for preparing data and controlling synthesis processes. Although it can also be used for actual digital signal processing, its versatility makes it a great tool for auxuliary tasks. Most notably, it can be used for flexible processing and routing of OSC messages, especially in the field of data sonification.

    Python & OSC

    A large variety of Python packages offers the possibility of using OSC. They can be installed using pip:

    $ pip install python-osc
    $ pip install pythonosc

    An example project for controlling a Faust-built synthesizer with Python is featured in this software repository:

    Python & JACK

    The JACK Audio Connection Kit Client for Python by Matthias Geier connects Python processes to the JACK server. This integration of Python in a JACK ecosystem can be helpful not only for audio processing, but also for synchronization of processes. Since the Python package also implements the JACK transport functions, it can be used to couple Python threads to the timeline of audio projects.

    Contents © Henrik von Coler 2021 - Contact