## .: SOUND SYNTHESIS TUTORIAL :. #### :: Understanding sound

The immense majority of people is familiarized with any possible sound along their lives, but most of them would fail to give an answer to this apparently simple question: what is sound?

Sound can be defined as a displacement of successive pressure waves through the air, or another medium, that can be perceived by the hearing organs. Sound is made of three different components that define how it is perceived. Let's see them:

- Frequency: we call frequency to the number of air waves (cycles) that a certain sound produces every second. So the frequency of a sound is measured in cycles per second, which are called Hertz (Hz). A 50 Hz sound is therefore a sound that emits 50 cycles in a single second. If we have a sound with a frequency of 1000 or more cycles per second, we should indicate its frequency by referring to kiloHertz (kHz) instead of Hertz, just a matter of convenience to avoid the zeros.

The human ears can perceive a frequency range from 20 Hz to 20kHz (20000 Hz), approximately. Musical notes played by musical instruments are based on the frequency of the sound. In the world of music, sound can be classified in three categories attending at its frequency:

Bass: 10 Hz to 200 Hz
Mid: 200 Hz to 3 kHz
Treble: 3 kHz to 20 kHz

So the higher the frequency is, the higher is the perceived pitch for the hearer. Let's see usual frequency ranges for some well known musical instruments:

Kick drum: 20 to 150 Hz
Bass: 20 to 250 Hz
Piano: 80 to 4500 Hz
Snare drum: 100 to 200 Hz
Cymbal: 300 to 600 Hz

The following graphic shows all the notes (pitches) that can be found in a conventional keyboard of a piano, organ, synthesizer or sampler. Note how each octave doubles the frequency of the previous one; per example, frequency of key C2 is double than frequency of key C1. - Amplitude: we call amplitude to the loudness level of a sound. So the louder the sound, the bigger the amplitude. An excessive amplitude in the sound is what can damage our hearing organs if we are not cautious about this aspect of sound. Amplitude is measured in deciBels (dB), which represent the tenth part of a Bel (B), which is actually the root unit, of a logarithmic nature, used to express the relationship between two magnitudes: a magnitude which is studied and a magnitude which serves as reference. Each successive Bel in the scale multiplies 10 times the power over the magnitude of reference, which has a value of 0 Bel. But since the Bel is too large to be used with ease, the deciBel is used instead. In the world of sound, an amplitude with a value of 0 dB would represent a non perceivable sound, while an amplitude with a value of 10 dB would represent a sound that is 10 times louder, being the loudness of the sound multiplied by 10 each time the amplitude increases its value in 10 dB.

The following graphic shows how frequency and amplitude relate to a waveform; frequency can be conceptualized as a horizontal dimension and amplitude as a vertical dimension. The two waves in the example have the same amplitude, so any listener would perceive a similar loudness in both, while frequency varies, making any listener to perceive a lower pitch sound in the first case and a higher pitch sound in the second case. The distance between each wave is called a cycle. - Timbre: we call timbre to a characteristic of the sound that could be defined as its personality, or even its color, if we want to use an approach related to visual arts. The timbre of a sound is defined by its source, the way it was generated, and it is not directly related with frequency; two sounds that have the same frequency could have totally different timbres. In the world of music, the source of the sound is generally a musical instrument, which is built to have its own, distinctive timbre, and therefore its own personality. That is what makes music an interesting thing.

In a technical approach, timbres are made up of an amount of waveforms that combined together form a complex waveform or sound. Musical tones are made up of many sine waves that have different frequencies and amplitudes. Since tones are made up from loads of different frequencies, the pitch of any tone is defined by its fundamental frequency, which is the lowest frequency found in any tone. The higher frequencies that accompany the fundamental frequency to form the timbre of a sound are called overtones or, less often, upperpartials. The overtones that are multiples of the fundamental frequency are called harmonics. So, for a tone that has a fundamental frequency of 1 kHz, its second harmonic will be 2 kHz, the third harmonic will be 3 kHz, and so on... Harmonics change the timbre of the sound without affecting the pitch. The number of harmonics in a tone is variable; tones that have more harmonics sound brighter, more defined that tones that have less harmonics, which sound muddier.

Harmonics are an essential concept on the field of sound generation and manipulation, and they will be forementioned further in this tutorial. Now, to get deeper inside the concept of timbre, we have to learn about waveforms and their different types.

#### :: Types of waveforms

In a technical aspect, we will refer sound as waveform. Every sound is a waveform, or rather an amount of different waveforms that combined together make a certain sound timbre. So each one of these basic waveforms have its own sonic qualities, and having a basic understanding of how they sound like is essential to know how to manipulate them to synthesize a desired timbre. The following picture shows the basic types of waveforms in their graphical look. The horizontal dimension represents time and the vertical dimension, if we were talking about an electronic oscillator which is generating these waveforms, would represent voltage. So the shape of these waveforms is determinated by the way the oscillator varies the voltage cyclically along the time. Let's see a more or less brief explanation about these basic waveforms:

- Sine wave: these waveforms are useful for creating deep warm basses or smooth lead lines. Sine waves can be used to create whistles, layered with kick drums to give a deep subby effect. The sine wave is a pure waveform and its harmonic content is fundamental. In another words, it is the most basic waveform and it has no harmonics; it only has the tone of the fundamental frequency (pitch). Almost all other waveforms are made from a number of sine waves, all with different frequencies and amplitudes. A waveform that does not change its timbre over time, is made up of sine waves which are multiples of the fundamental frequency (the natural harmonic series).

Audio example of sine waves.

- Square wave: these waveforms are great for brass and deeper wind type of instruments and are usually used in combination with other waveforms because they are quite strong and hard on their own. Square waves can be generated by adding a number of sine waves with decreasing volume (each harmonic being quieter than its previous). However, the square wave contains only the odd numbered harmonics.

Audio example of square waves.

- Triangle wave: these waveforms are great for bell or wind instruments type sounds. Like square waves, they contain only the odd harmonics of the fundamental frequency. They differ from square waves because the volume of each added harmonic drops more quickly.

Audio example of triangle waves.

- Sawtooth wave: these waveforms have a buzzy, bright and edgy sonic quality, and are adequate for creating strings, brass, trance pads and leads, electro basses, etc... A sawtooth wave can be made by adding a series of sine waves at different frequencies and amplitudes. The frequency of the first, loudest sine wave is what we hear as the frequency of the resulting sawtooth. Each of the other, progressively quieter, sine waves that make up a sawtooth wave have frequencies which are integer multiples of the fundamental frequency.

Audio example of sawtooth waves.

- Noise wave: these waveforms are randomly changing, chaotic signals, containing an endless number of sine waves of all possible frequencies with different amplitudes. However randomness will always have specific statistical properties, which will give the noise its specific character or timbre. If the sine waves' amplitude is uniform, which means that every frequency has the same volume, the noise sounds very bright and it is called white noise. If the amplitude of the sine waves decreases when their frequencies rise, the noise sounds much warmer; if it decreases with a curve of about -6 dB per octave, it is called pink noise, and if it decreases with a curve of about -12 dB per octave, it is called brown noise. White noise is used in the synthesizing of hi-hats, crashes, cymbals, etc... Pink noise is great for synthesizing ocean waves and warm ethereal pads, and brown noise is good for synthesizing thunder sounds and deep, bursting claps. And overall, they all can be used in varying ways for attaining different sound textures and effects, being specially useful when used along with other waveforms like saws and triangles. Their possibilities are endless and therefore most modern synthesizers have them as a main sound generation source.

The graphics below show the result of adding two sine waves of different frequencies to form a third, different wave that has different timbral properties (left), and the result of adding two opposite sine waves of equal frequency, which is silence (right).  To program a new sound in any given synthesizer, the first step is to choose a combination of waveforms in the oscillator (OSC) that would give a start to approximate the timbre of the final sound. Oscillators are the components that generate waveforms, which are the raw material that will be further processed to create new waveforms. The image below shows the controls found in the oscillator bank of the FreeMoog analogue synthesizer, which is available for download in this website. The controls to the right allow to choose six different waveforms for each one of the three oscillators. Each one of the oscillators present in an oscillator bank exponentially increases the number of possible combinations (sums) of fundamental waveforms and their harmonics. 