DSP from Scratch · Lesson 2
Amplitude, Frequency and Phase: How to Read a Sine Wave
The three numbers that describe any sine wave, and how a computer writes one down sample by sample.

Press play: it starts at
Chapters17 parts, tap one to jump there
In one sentence
Amplitude is how tall, frequency is how often, and phase is where the wiggle starts.
Watch first, then read. The video shows every idea moving. These notes write out each step so you can check the maths at your own pace. Press any ▶ time button to jump the video to that moment.
A guitar string, the hum of a fridge, the electricity in your wall socket: they all swing back and forth in the same smooth shape. It is called a sine wave, and it is the most important shape in all of signal processing.
All you need is school maths and lesson 1.
Lesson 1 in ten seconds
A computer keeps a signal as a list of samples, taken at regular moments. We write for the value of sample , counting from zero, and the sample rate is how many samples arrive each second, in hertz (Hz). If any of that is new, read lesson 1 first.
What is a sine wave?
A sine wave rises smoothly to a peak, falls through zero to a valley, and climbs back again, over and over, exactly the same each time.
- One complete rise and fall is called a cycle.
- The time one cycle takes is called the period.
Why does this shape matter so much? Because anything that swings back and forth smoothly makes it: a pendulum, a spring, a vibrating string. And almost any signal can be built by adding sine waves together; lesson 3 starts that story.
Every sine wave is described by just three numbers.
Amplitude: how tall
The amplitude, written , is how tall the wave is, measured from the middle line up to the peak.
Double the amplitude and the wave gets twice as tall, but it keeps exactly the same rhythm. For a sound wave, a bigger amplitude means louder.
Frequency and period: how often
The frequency, written , is how many complete cycles happen each second. Like the sample rate, it is measured in hertz: a 10 Hz wave completes ten cycles every second.
Double the frequency and the cycles squeeze closer together, but the height stays the same. For a sound, a higher frequency means a higher note.
Frequency and period are two views of the same thing. If cycles happen every second, one cycle takes of a second:
A 10 Hz wave repeats every tenth of a second: , where a millisecond (ms) is a thousandth of a second.
Phase: where it starts
The phase, written with the Greek letter (phi), tells you where in its cycle the wave is at the moment you start the clock.
Change the phase and the whole wave slides left or right. Its height does not change, and neither does its speed. Only the starting point moves.
Phase is measured as an angle, because one full cycle is like one full turn of a circle:
- a quarter of a cycle is 90°;
- half a cycle is 180°;
- a whole cycle is 360°, which brings the wave back to exactly where it started.
Double the amplitude
Twice as tall, same rhythm.
Double the frequency
Twice as many cycles, same height.
Shift the phase
Slid a quarter cycle. Nothing else changes.
Sine waves around you
| Where | Frequency |
|---|---|
| The electricity from a wall socket in Europe and much of the world | 50 Hz |
| The same in North America | 60 Hz |
| The note A that an orchestra tunes to | 440 Hz |
So when an orchestra tunes up, everyone plays a wave that completes 440 cycles every second.
How noise-cancelling headphones use phase
Phase is the secret behind noise-cancelling headphones. A tiny microphone listens to a steady drone, like the hum of an aircraft engine. The headphones then play a copy with the same amplitude and the same frequency, but with the phase moved by half a cycle. Wherever the drone goes up, the copy goes down.
Added together in your ear, the two cancel out at every moment, and the drone disappears. Same height, same speed, opposite starting point. You can hear this happen in the lab below.
Radians from scratch
Before we hand sine waves to a computer, we need one more tool: a different way to measure angles, called radians.
Take a circle and walk around its edge. When you have walked a distance equal to the radius, the angle you have turned is one radian.
The whole way around the edge is times the radius, where . So a full turn is radians, and
To turn degrees into radians, multiply by . In signal processing, one full cycle of a sine wave is radians.
The computer’s view: digital frequency
People think in cycles per second. A computer only sees samples, so it asks a different question: how much of a cycle passes from one sample to the next?
If cycles pass every second and samples arrive every second, then
Turn cycles into radians by multiplying by . The result is called the digital frequency, written with the Greek letter (omega), in radians per sample:
Then every sample of the sine wave is
- sets the height;
- sets how far the wave turns from one sample to the next;
- sets where it starts.
Worked example
A 10 Hz wave is sampled at 360 Hz. One cycle takes samples, and
Take an amplitude of 1 mV and a phase of zero. What is sample 9?
Nine samples is a quarter of 36, so the wave has turned a quarter cycle, :
That is the very top of the wave.
samples per cycle. So each sample moves the wave one twelfth of a cycle:
Three common mistakes
Recap
- A sine wave is described by three numbers: amplitude (how tall), frequency (how many cycles each second) and phase (where it starts).
- The period is one over the frequency: .
- A full cycle is radians.
- A computer writes the wave as , where .
Say the main idea aloud once: amplitude is how tall, frequency is how often, and phase is where the wiggle starts.
Next: what happens when you sample a wave too slowly, and why the samples can lie to you.
Interactive lab
Turn the three knobs, then cancel a hum
Set amplitude, frequency and phase to match a target wave. Then move the phase of a copy until a hum disappears, and hear it happen.
1. Three knobs
Press “Match a target wave”, then turn the knobs until your wave sits on the dashed one.
2. Cancel the hum
Play the sound, then move the copy’s phase until the hum disappears.
Sign in to open the lab
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Check yourself
Did it stick?
Work each one out on paper first. Every question has a full worked answer.
- 1
What is the period of a 25 Hz wave, in milliseconds?
Worked answer
The period is one over the frequency:
A millisecond is a thousandth of a second, so .
- 2
A 60 Hz tone is sampled at 480 Hz. How many samples fit in one cycle?
Worked answer
One cycle lasts of a second, and samples arrive 480 times a second, so one cycle holds
- 3
For the same tone (60 Hz sampled at 480 Hz), what is the digital frequency ?
Worked answer
That matches question 2: eight samples per cycle, so each sample turns the wave one eighth of . That is , or 45°.
- 4
Two waves both have amplitude 2 mV and frequency 50 Hz. The first has phase 0; the second has phase . What do you get when you add them?
Worked answer
A phase of radians is 180°: half a cycle. So the second wave is the first one moved by half a cycle. Wherever the first goes up by some amount, the second goes down by exactly the same amount, because the two have the same height and the same speed.
Added together they cancel at every moment: the sum is zero. This is how noise-cancelling headphones remove a steady hum.
- 5
A computer stores a wave as , sampled at 600 Hz. What is its frequency in hertz?
Worked answer
Compare with : here radians per sample.
In cycles per sample, that is : one cycle every 12 samples.
Samples arrive 600 times a second, so the number of cycles each second is
Sign in to open the checks
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Was this lesson clear?
Free weekly email
Get the next lesson by email.
The week's new lessons, the daily facts in one place, one thing to try in the lab and one puzzle. Free.
No spam. One click to leave.