Tuun can be used to explore different methods of synthesis. This page is far from an explanation or tutorial on these techniques, but might serve as a complement to books like The Computer Music Tutorial by Curtis Roads. The examples here are not meant to be particularly accurate representations of the instruments they are named for; they are meant just to demonstrate these synthesis techniques and how they might be realized in Tuun.
Additive synthesis is based on the idea of combining simple waveforms. These examples use sine waves.
Harmonic overtones are integer multiples of the fundamental tone. These examples make use of the overtone function, defined in the standard context.
over = fn(freq) => fn(x) => $(freq*x) * (1/x),
Additive synthesis often requires many primitive waveforms to be combined; this example uses 20 per note!
Additive synthesis can also be used to create inharmonic sounds, including tuned percussion instruments. This example is based on parameters from Jim Woodhouse’s Euphonics site.
Subtractive synthesis starts with a waveform with many component frequencies and then passes it through a filter to remove some of those frequencies. One example of such a starting waveform is a pulse wave.
In this example, the two pulse waves are combined and then passed through a low-pass filter (which removes higher frequencies). This example is based on one from Welsh’s Synthesizer Cookbook.
As discussed in the advanced uses of Sine, Tuun supports both frequency and phase modulation synthesis. In this example, we’ll use phase modulation, with fc as the frequency of the carrier and fm as the frequency of the modulator (both in hertz).
sine(2*pi * fc, I * $fm)
As in Chowning’s original article on frequency modulation, we will vary the index of modulation over time by using a waveform (rather than a constant) for I. Since we know that the sine expression is infinite, the length of the modulator will be determined by I as well. That same envelope will also be used to control the magnitude the resulting waveform.
To create a synthesizer instrument using the function below, provide:
This instrument is based on an example from Chowning’s article.