Math and signals

Fourier transform visualizer

When several notes play at once, the air vibrates with a single complicated wave. The Fourier transform is the mathematical tool that breaks it back down into the notes that make it up. Press notes to build a chord and see its frequency "fingerprint".

Key formula

signal(t) = Σ Aₙ · sin(2π · fₙ · t + φₙ)

Try it

How to use the simulator

When several notes sound at once, the air vibrates with a single complicated wave. The Fourier transform does the reverse: it takes that wave and splits it into the pure frequencies it's made of. That's what a spectrum analyzer would do to make sense of a language built from chords, like Rocky's. The visualizer shows the combined wave and the active frequencies side by side.

Controls

  • Note buttons: eight notes spanning one octave, from C4 (261.6 Hz) to C5 (523.3 Hz). Each click turns one on or off.

Things to try

  1. Turn on a single note: the wave is a clean sine and the spectrum shows one bar.
  2. Turn on C4 and C5 together. The second frequency is exactly double the first, and the wave repeats in a simple pattern.
  3. Turn on four or five notes. The wave looks chaotic, but the spectrum still picks out every component clearly. That's the power of Fourier analysis.

Loading simulator…

Any wave is a sum of simple waves

Joseph Fourier showed in the early 19th century that almost any periodic signal can be written as a sum of sines and cosines of different frequencies. The Fourier transform goes the other way: given the signal, it tells you which frequencies it contains and how strong each one is.

Your ear does this naturally. In the cochlea, different regions vibrate at different frequencies, so the brain receives sound already "split up" and can pick out the notes in a chord.

Where it is used

It is everywhere: in MP3 and JPEG compression, which drop the frequencies we notice least; in tuners; in Wi-Fi and 4G, which spread data across many frequencies; in MRI scanners, which rebuild images from frequencies; and in earthquake analysis.

Astronomers use it to find planets from the periodic wobble of their star, and to study the vibrations of the Sun and other stars, which reveal their interiors.

Worked example

Example: the C major chord

  1. Press C4 (261.6 Hz), E4 (329.6 Hz) and G4 (392 Hz).
  2. The frequencies are in an almost exact 4 : 5 : 6 ratio (261.6 / 65.4 = 4; 329.6 / 65.4 ≈ 5.04; 392 / 65.4 ≈ 6). That is why they sound good together: their waves line up often.
  3. The combined sound is a single irregular wave, but its spectrum (the visualizer bars) shows three clean peaks, one per note.
  4. Now try C4 and D4 together (a ratio close to 8 : 9): the waves rarely line up and the result sounds tenser.

In Project Hail Mary

In the novel, one character communicates with musical sounds instead of words, and translating them means splitting their "chords" into the notes that make them up. That is exactly what the Fourier transform does.

This tool appears in:Chapter 11Rocky Has Sonar

Frequently asked questions

What is the FFT?

The fast Fourier transform, a 1965 algorithm that computes the transform far faster. Thanks to it, frequency analysis can run in real time on a phone.

Why do a violin and a piano sound different on the same note?

Because besides the main frequency they produce harmonics (multiples of that frequency) in different proportions. That mix, the timbre, is exactly what the Fourier spectrum shows.

Do you need calculus to understand it?

Not to use it. The key idea is that a signal can be seen in two equivalent ways: as something changing over time, or as a list of frequencies.

More tools in math and signals

See all tools →