prerequisite

Sound waves

What sound physically is: pressure waves with a frequency you hear as pitch and an amplitude you hear as loudness.

Before this

Nothing beyond first-year college math. This is a starting page.

Why you need this

Every audio model, however clever, ends by producing one thing: a wave of air pressure for a speaker to push into the room. When a prompt asks for "a low, warm pad" or "a bright click", it is asking for a wave with particular properties. This page names those properties, so that the words in a prompt, the numbers in an editor, and what you hear all line up.

The idea

Sound is a moving pattern of air pressure. A guitar string, a speaker cone, or a card slapped on a table moves back and forth. Each push squeezes the air next to it a little (higher pressure), and each pull leaves it a little thinner (lower pressure). Those squeezed and thinned regions travel outward. The air itself barely moves; the pattern moves. When the pattern reaches your ear, it pushes your eardrum in and out, and you hear sound.

A waveform is a graph of that pressure over time. Time runs left to right. Up means pressure above normal, down means below, and the middle line is normal air pressure. Every audio editor shows sound this way. A pure tone, the simplest sound there is, draws a smooth repeating curve called a sine wave.

Period and frequency. A repeating wave has a shortest stretch that repeats, called one cycle. The time one cycle takes is the period, written TT and measured in seconds. The number of cycles per second is the frequency, written ff and measured in hertz (Hz), where 1 Hz is one cycle per second. They are reciprocals of each other:

f=1TT=1ff = \frac{1}{T} \qquad T = \frac{1}{f}

A tone at 100 Hz repeats 100 times a second, so each cycle lasts T=1/100=0.01T = 1/100 = 0.01 s, which is 10 ms.

Wavelength. While one cycle plays, the pattern travels some distance through the air. That distance is the wavelength, written λ\lambda (the Greek letter lambda) and measured in meters. If vv is the speed of sound, about 343 meters per second in room-temperature air, then

λ=vf\lambda = \frac{v}{f}

The 100 Hz tone has a wavelength of 343/100=3.43343 / 100 = 3.43 m. Low sounds are physically long, which is why small speakers struggle with bass: the cone is tiny next to the wave it is trying to make.

Amplitude. How far the pressure swings above and below normal is the amplitude. A bigger swing sounds louder. On a waveform it is the height of the curve. Loudness is not simply proportional to amplitude, and levels are measured on a logarithmic scale; Decibels and loudness covers that.

Pitch versus frequency. Frequency is a physical measurement. Pitch is what you perceive: how high or low a note sounds. They track each other closely, but pitch works on ratios, not differences. Doubling a frequency raises the pitch by one octave, the step that makes two notes sound like "the same note, higher". 110 Hz to 220 Hz is an octave, and so is 1000 Hz to 2000 Hz, even though the second gap is ten times larger in hertz. That is why note names repeat: A2, A3, A4, A5 are each double the one before. A4, the A above middle C, is tuned to 440 Hz by modern convention.

Timbre. A flute and a violin playing A4 both repeat 440 times a second, yet you can tell them apart. Real instruments do not make pure sine waves. Their waves contain the main frequency, called the fundamental, plus quieter overtones, usually at whole-number multiples of it: 880 Hz, 1320 Hz, 1760 Hz, and so on for A4. The mix of overtones, and how it changes as the note starts and fades, is the timbre, the "color" of a sound. A clarinet is strong in odd multiples; a bright synth lead is strong in many high ones; a sine wave has none, which is why it sounds plain. When a prompt says "warm", "bright", "hollow", or "buzzy", it is describing timbre.

The audible range. Young human ears hear roughly 20 Hz to 20,000 Hz (20 kHz, where k means a thousand). The top end drops with age, often well below 20 kHz by middle age. Below about 20 Hz you feel rumble more than hear it. Most of what makes music and speech recognizable sits between about 100 Hz and 5 kHz.

Frequency Period Wavelength at 343 m/s
20 Hz (lowest audible) 50 ms 17.15 m
100 Hz 10 ms 3.43 m
20 kHz (highest audible) 0.05 ms about 17 mm

Worked example

Take the note A4 at 440 Hz and the A one octave up, A5 at 880 Hz. Use v=343v = 343 m/s.

A4, 440 Hz.

T=1440≈0.0022727 s≈2.27 msT = \frac{1}{440} \approx 0.0022727 \text{ s} \approx 2.27 \text{ ms}

λ=343440≈0.780 m\lambda = \frac{343}{440} \approx 0.780 \text{ m}

A5, 880 Hz.

T=1880≈0.0011364 s≈1.14 msT = \frac{1}{880} \approx 0.0011364 \text{ s} \approx 1.14 \text{ ms}

λ=343880≈0.390 m\lambda = \frac{343}{880} \approx 0.390 \text{ m}

Note Frequency Period Wavelength
A4 440 Hz 2.27 ms 0.780 m (78 cm)
A5 880 Hz 1.14 ms 0.390 m (39 cm)

Doubling the frequency halved both the period and the wavelength, and you hear the result as the same note one octave higher. If A4 came from a violin, its overtones would sit at 880 Hz, 1320 Hz, and above, so the violin's A4 already contains a quiet A5 inside it. That overlap is part of why octaves sound so consonant.

In a game's audio pipeline

These words appear at every stage. In writing the brief, "deep", "bright", and "airy" are timbre and frequency words, and a prompt for a card-draw sound for Lumen Clash that asks for "a soft, high paper swish" is asking for energy mostly in the upper frequencies with a small amplitude. In shaping it for the game, a loop that clicks at its seam is a waveform that jumps instead of continuing smoothly. In shipping it, knowing that hearing tops out near 20 kHz is what justifies the standard sample rates on Digital audio and sampling. And on Spectrograms, the fundamentals and overtones from this page become the bright horizontal lines you will learn to read.

Common mistakes

  • Treating pitch steps as equal in hertz. Going from 100 Hz to 200 Hz is an octave; going from 1000 Hz to 1100 Hz is less than a whole step. A pitch-shift setting given in hertz instead of semitones or a ratio sounds wildly different on low and high sounds.
  • Mixing up amplitude and loudness. Doubling the amplitude does not sound twice as loud, and two sounds with the same peak height can sound very different in level. The symptom is a sound effect that looks quiet in the editor but jumps out in the game.
  • Expecting bass from small speakers. A 60 Hz thump has a wavelength near 5.7 m. Phone speakers barely reproduce it, so a hit that sounds powerful on headphones turns into a faint tick on a phone.
  • Ignoring timbre when a sound feels "wrong". Two takes at the same pitch and level can still clash because their overtones fight. The symptom is a mix that sounds harsh or muddy even though no single sound is too loud.
  • Assuming everyone hears to 20 kHz. Detail placed only above about 15 kHz is lost on many listeners. A UI sound that relies on a very high sparkle reads as dull to them.

Cost

This page has no computation to pay for; the cost is in your ears and your time. Hearing differences in timbre takes practice, and the listening time for a game's audio set grows with every sound you add. The physical facts set a hard limit on playback rather than on generation: low frequencies need big speakers or headphones, so checking a mix on the speakers players will use is part of the listening budget, not an extra.

Going further

  • Digital audio and sampling: how the pressure wave becomes a list of numbers.
  • Decibels and loudness: why amplitude is measured on a log scale.
  • Spectrograms: seeing fundamentals and overtones as lines over time.
  • Music basics for prompting: note names, octaves, and chords built on these frequencies.
  • Try it: in any audio editor, generate a 440 Hz sine tone and a 440 Hz sawtooth tone and listen to them one after the other. Same pitch, different timbre.

Leads to

Back to Local text-to-audio for games