Raspberry Pi

The class Sound Synthesis at TU Berlin makes use of the Raspberry PI as a development and runtime system for sound synthesis in C++ (von Coler, 2017). Firtly, this is the cheapest way of setting up a computer pool with unified hard- and software. In addition, the PIs can serve as standalone synthesizers and sonification tools. All examples can be found in a dedicated software repository.

The full development system is based on free, open source software. The examples are based on the JACK API for audio input and output, RtAudio for MIDI, as well as the liblo for OSC communication and libyaml-cpp for data and configuration files.

The advantage and disadvantage of this setup is that every element needs to be implemented from scratch. In this way, synthesis algorithms can be understood in detail and customized without limitations. For quick solutions it makes sense to switch to a framework with more basic elements. The source code can also be used on any Linux system, provided the necessary libraries are installed.

The Gain Example

The gain example is the entry point for coding on the PI system: https://github.com/anwaldt/sound_synthesis_pi



  • Henrik von Coler and David Runge. Teaching sound synthesis in c/c++ on the raspberry pi. In Proceedings of the Linux Audio Conference. 2017.
    [details] [BibTeX▼]

The Karplus-Strong Algorithm

The Karplus-Strong algorithm is not exactly a physical model, but it can be considered a preliminary stage to waveguides. The algorithm is based on a ringbuffer, filled with (white) noise, which is then manipulated. With very simple means, Karplus-Strong can synthesize sounds with the characteristics of plucked strings. Although not entirely realistic, the result has a intriguing individual character.

The Ringbuffer

Ringbuffers are the central element of the Karplus-Strong algorithm. As the name suggests, they are FIFO (first in - first out) buffers, with beginning and end connected. A ringbuffer with N samples can be visualized as follows:

White Tone from White Noise

If a ringbuffer is filled with a sequence of white noise, it can be used for creating a white tone - a harmonic sound with a strong overtone structure. Without resampling, the ring buffer can be shifted by one sample each $1/f_s$ seconds. The resulting pitch of the sound is then determined by the buffer size:

$$f_0 = \frac{f_s}{N}$$

For a sampling rate of $48000$ Hz, a ringbuffer with a length of $N=200$ samples, results in the following pitch:

$$f_0 = \frac{ 48000 }{ 200 } = 240.0\ \mathrm{Hz}$$

The sound of this harmonic signal is similar to a buzzer:


The spectrum of the white tone includes all harmonics up to the Nyquist frequency with a random amplitude. The overtone structure is individual for every white noise sequence, as is the timbre. These are three versions, started with an individual noise sequence of $N=400$ samples.

Version 1

Version 2

Version 3