]> Sound and music - Sound Synthesis

## Sound Synthesis

We survey the ingredients of sound synthesis.

## Oscillators

• Sinusoids: Building blocks of periodic signals; think Fourier series. They sound bare by themselves, and rarely exist alone in nature.

• Square Waves: All odd harmonics. A good starting point for subtractive synthesis.

• Sawtooth Waves: All harmonics. Another good starting point for subtractive synthesis.

• Triangle Waves: All odd harmonics, like square waves, but they roll off much faster (hence they are closer to a sine wave.)

• Pulse Waves: These are square waves, except one can vary the time spent at the maximum value per cycle. The ratio of the time spent at the maximum to the time spent at the minimum is called the duty cycle. For example, a square wave is a pulse wave with duty cycle 0.5. If the duty cycle is $1/n$, then the spectrum of the the pulse wave is the same as that of a sawtooth wave except that every $n$th harmonic is missing. Other signals may be modified in the same fashion.

## Modulation

We can vary one parameter of a sound according to another signal.

### Amplitude Modulation

Slowly varying the amplitude of a sound is called tremolo. The spectrum of the product of two signals together is the convolution of the spectrums of the signals. In particular, if two sine waves are multiplied, we end up with sine waves whose frequencies are the sum and difference of the input frequencies.

In the analogue world, circuits that performed multiplication correctly even when one or both of the signals are negative (“four-quadrant multiplication”) are not as trivial as a voltage-controlled amplifier, and are called ring modulators (because one such implementation uses a ring of four diodes). In the digital world, the obvious way to design a amplitude modulator leads to a ring modulator.

[I’m not sure what happens when multiplication goes wrong. Perhaps one or both of the input signals leaks through.]

### Filter Modulation

We can feed a sound through a low-pass filter and vary the filter cutoff according to another signal. At very low frequencies (below 1Hz) we can get interesting sounds that change very slowly. Higher up, we start to get a wah-wah effect. Higher still leads to a "growl" sound such as those in brass instruments.

### Pulse Width Modulation

Varying the duty cycle on a pulse wave can be useful for synthesizing stringed instruments.

### Frequency Modulation

Varying the frequency of an input wave slowly is called vibrato. At faster modulation frequencies, we have

$\mathrm{sin}\left(\alpha +a\mathrm{sin}\beta \right)={J}_{0}\left(a\right)\mathrm{sin}\alpha +\sum _{k=1}^{\infty }{J}_{k}\left(a\right)\left(\mathrm{sin}\left(\alpha +k\beta \right)+\left(-1{\right)}^{k}\mathrm{sin}\left(\alpha -k\beta \right)\right)$

where ${J}_{k}$ is the Bessel function of the first kind of order $k$. The coefficient $a$ is called the modulation index. Thus frequency modulation preserves the carrier frequency and introduces an infinite number of sideband frequencies, evenly spaced by the modulating frequency.

The modulation index $a$ is not the peak frequency deviation. Just as the frequency of $\mathrm{sin}\left(\omega t\right)$ is given by $\frac{d}{dt}\omega t=\omega$, we see that the instantaneous frequency of $\mathrm{sin}\left({\omega }_{c}t+a\mathrm{sin}{\omega }_{m}t\right)$ is

${\omega }_{c}+{\omega }_{m}a\mathrm{cos}{\omega }_{m}t$

giving a peak deviation at ${\omega }_{m}a$. In software synthesizers, a natural implementation of FM is to compute

${f}_{\mathrm{now}}={f}_{c}+b\mathrm{sin}\left(2\pi {f}_{m}t\right)$

and ${f}_{\mathrm{now}}$ is used to determine the next oscillator value. When using them, to obtain a desired modulation index $a$ the peak frequency should be set to $b=a{f}_{m}$.

For $k>0$, we have ${J}_{k}\left(x\right)=0$. As $x$ increases, ${J}_{k}\left(x\right)$ stays close to zero for a while: the larger $k$ is, the longer ${J}_{k}\left(x\right)$ stays close to zero. Then ${J}_{k}$ looks like a damped sinusoid: a sine wave whose peaks get closer to zero as $x$ increases. Empirically, except for small $k$, we find ${J}_{k}\left(x\right)$ reaches its maximum roughly at $x=a+2$. Another good rule of thumb is that the contributions of the frequencies above $\alpha +1.5a\beta$ are insignificant.

This gives us a rough idea of what frequency modulation does. Increasing the modulation index introduces sidebands that are further away from the carrier frequency. At the same time, the amplitudes of closer sideband frequencies will oscillate.

Define the harmonicity ratio $H$ by $H={f}_{m}/{f}_{c}$ where ${f}_{m},{f}_{c}$ are the modulating and carrier frequencies respectively. Then for $H=1$, the sideband frequencies are simply the harmonics of the carrier frequency (which is the same as the modulating frequency) along with a DC component (from ${f}_{c}-{f}_{m}$). Note that the negative-frequency components will interfere with their corresponding positive ones. More generally, if $H=1/N$, then we have a harmonic waveform with the carrier frequency equal to the $N$th harmonic, while if $H=N$ then we have a harmonic waveform with missing harmonics. Even more generally, if $H$ is rational then the output waveform is harmonic. For irrational $H$ the spectrum is inharmonic, which is useful for synthesizing "metallic" sounds, such as unpitched musical tones (e.g. bells, gongs, drums).

## Chebyshev Polynomials

Consider the following equation, Chebyshev’s differential equation:

$\left(1-{x}^{2}\right)y″-xy\prime +{n}^{2}y=0$

where $n\in {ℤ}_{\ge 0}$. Chebyshev polynomials of the first kind are solutions to this equation, and they are given by

${T}_{n}\left(x\right)=\mathrm{cos}\left(n{\mathrm{cos}}^{-1}x\right)={x}^{n}-\left(\genfrac{}{}{0}{}{n}{2}\right){x}^{n-2}\left(1-{x}^{2}\right)+\left(\genfrac{}{}{0}{}{n}{4}\right){x}^{n-4}\left(1-{x}^{2}{\right)}^{2}-...$

They can be computed recursively using the formula

${T}_{n+1}\left(x\right)=2x{T}_{n}\left(x\right)-{T}_{n-1}\left(x\right)$

The first few Chebyshev polynomials are

${T}_{0}\left(x\right)=1,{T}_{1}\left(x\right)=x,{T}_{2}\left(x\right)=2{x}^{2}-1,{T}_{3}\left(x\right)=4{x}^{3}-3x$

They are useful in sound synthesis because

${T}_{n}\left(\mathrm{cos}\theta \right)=\mathrm{cos}\left(n\theta \right)$

(e.g. feeding a cosine wave through ${T}_{2}$ will produce an cosine wave with double the frequency.)