Control Rate and Audio Rate

Like many other audio programming environments, PD makes a difference between control signals and audio signals. They run at different rates and can not be combined, unless converted. Audio operations require the DSP to be activated, whereas control rate signal work at any time. Objects define whether an outlet gets or outputs control or audio rate signals. Objects with audio inputs or outputs are usually named with a ~. Control rate connections are thinner than audio rate signals. The example rates.pd simply shows an audio and a control rate connection, with audio connections being thicker:


The example also introduces the osc~ oject, which generates a sine wave at 1234 Hz. The message on the bottom of the patch is a patch-based way of activating the DSP, which can be very helpful when working with automated and background processes.

Audio to Control

Converting audio signals to control rate signals can be achieved with the snapshot~ object, as done in the example audio-to-control.pd. A possible application is an envelope follower. This object needs to be triggered to grab a snapshot, which is done with a metro object at 100 Hz in this example. The output is a level indicator for the LFO at 0.1 Hz:


Control to Audio

Usually, control signals can be connected to audio inlets. The conversion shown in the example audio-to-control.pd is thus less frequent. However, in some cases it might be necessary to convert control signals to audio rate. This is done with the sig~ object:


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:



  • 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