ZynAddSubFX/PADsynth/Algorithm

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In order to understand how this algorithm works, you need to be familiar with how the author of this text thinks about the musical instruments. Please read an introduction for the description of the meaning and the importance of Bandwidth of each harmonic and Randomness.

General description[edit]

This algorithm generates some large wavetables that can be played at different speeds to get the desired sound. This algorithm describes only how these wavetables are generated. The result is a perfectly looped wavetable. Unlike other synthesis methods which use the Inverse Fast Fourier Transform, this one does not use overlap/add methods and there is only one IFFT for the whole sample.

The basic steps are:

  1. Make a very large array that represents the amplitude spectrum of the sound (default of all values is zero)
  2. Generate the distribution of each harmonic in frequency and add it to the array
  3. Put random phases to each frequency of the spectrum
  4. Do a single Inverse Fourier Transform of the whole spectrum. There is no need of any overlapping window, because there is only one single IFFT for the whole sample.

The output is the sample which can be used as a wavetable. In the next image, the steps are represented graphically:

Padsynth steps.png

The bandwidth of each harmonic[edit]

The author of this considers one harmonic (overtone) as being composed of many frequencies. These sine components of one harmonic are spread over a certain band of frequencies. Higher harmonics have bigger bandwidths. In natural choirs/ensembles the bandwidth is proportional to the harmonic's frequency. Here is an example of a spectrum of an instrument generated by this algorithm:

Padsynth bw2.png Padsynth bw1.png
Spectrum Close-up of the spectrum

The harmonics become wider and wider, until at a certain frequency, where they may merge to a noise band (as in the full spectrum image from above). This is a normal thing and I recommend not to avoid this by limiting the bandwidth of the harmonics.

The frequency distribution of one harmonic/overtone (or the harmonic profile)[edit]

This describes the function of the spread of the harmonic. Here are some examples of how they can be spread:

  • A special case is where there is only a single sine component inside the hamonic. In this case, the harmonic and the "sine component" are the same thing.
Padsynth profile1.png
  • Detuned. In this case there are two sine components which are detuned.
Padsynth profile2.png
  • Evenly spread inside the harmonic (all components have the same amplitude)
Padsynth profile3.png
  • Normal (Gaussian) distribution. The sine component amplitudes are bell shaped. The largest amplitude is in the center of the band. This distribution gives the most natural sounds (it simulates a very, very large ensemble)
Padsynth profile4.png

Of course, you can use many other harmonic profile functions. ZynAddSubFX's implementation of the PADsynth algorithm offers many ways to generate the harmonic profile. Also, it's very important that the harmonic has the same amplitude, regardless of the profile functions/parameters and the bandwidth.

The phases of the sine components of the harmonics[edit]

This algorithm considers the phases of the sine components of each harmonic as random.