Here is one handclap as a signal. Drag Add up to across it and watch Total so far climb, then stop climbing.
Adding it all up
Drag the window edge across the clap: the shaded part is what gets added.
Describe this picture
Two panels against time in seconds: a single handclap, 240 samples over one second, as , and below it each sample squared, . The part up to the window edge is shaded in both. The “Add up to” slider moves the edge from 0 to 1 s, and two readouts show “Total so far”, the sum of the shaded squares, and “Samples counted”.
Adding it all up
Kinds of signals (1.2) gave you six questions for sorting signals. None of them said how big a signal is, and that is what this page is for.
Clap your hands once and picture the clap as a signal. It has a number at every sample, mostly near zero, spiking up and down for a fraction of a second, then settling back to silence. How would you put one number on how big that clap was?
Your first idea might be to add up the values. That does not work: a signal swings above and below zero, so the positive and negative parts cancel, and you get almost nothing however loud the clap was. To avoid this, square each value first. Squaring removes the sign, so a big swing counts as big whether it went up or down.
Add up the squared values across the whole clap and you get the clap’s energy, written :
As in Kinds of signals (1.2), is the value at sample number , and is that value squared. The symbol means “add this up over every you have”.
In the picture at the top of the page, the shaded part of the lower panel is what gets added.
Notice that once you pass the clap, moving the slider further barely changes the total. The clap does not last forever, so its energy has a fixed, finite value once you have included all of it.
Average per sample
Energy works well for something that starts and finishes, like a clap. But what about a sound that never stops, like the steady hum of a fan? If you added up its squared values forever, the total would keep climbing forever. Energy would be infinite, which is not a useful number.
Instead, divide by how many samples you added. Instead of a running total, you track a running average: the total so far, divided by the number of samples so far. This is average power, written :
for a long stretch of samples.
In words: add up the squared values over samples, divide by , and make the stretch longer until the number stops changing. A signal like the clap ends, so its energy is finite while the window keeps growing. Its average power therefore keeps shrinking toward zero. A signal like the hum keeps going, so its average power settles to a positive constant.
Switch between Handclap and Steady hum, and drag How long you listen to 0.3, 1 and 3 seconds each time.
Average per sample
Drag out how long you listen: the shaded part is what gets averaged.
Describe this picture
One panel, against time in seconds: a handclap or a steady hum, 720 samples over three seconds, 240 a second, chosen with the “Sound” buttons “Handclap” and “Steady hum”. The part you listen to is shaded, from 0 to the “How long you listen” slider, which runs to 3 s. Two readouts show “Average power per sample” and “Samples averaged”.
For the clap, Average power per sample reads 2.53, then 0.80, then 0.27: it keeps shrinking the longer you listen. For the hum it reads 0.54, then 0.50, then 0.50, so it settles to a constant.
That is the difference between an “energy signal” and a “power signal”: which of the two numbers, or , is finite and nonzero.
Three waveforms
The next section compares three standard shapes. Here they are first, so that nothing there is a surprise. Each rises to 1 and falls to . We call that height the amplitude.
Three waveforms
All three rise to 1 and fall to -1; only the shape differs.
Sine
A sine wave rises and falls smoothly, like a pendulum swinging.
Square
A square wave sits at the top, jumps to the bottom, sits there, and jumps back, over and over.
Triangle
A triangle wave climbs in a straight line to the top, then falls in a straight line to the bottom.
Describe this picture
A still picture of three small plots side by side, Sine, Square and Triangle, each against time in seconds over two periods, rising to 1 and falling to , with a sentence under each saying how it moves.
A sine wave rises and falls smoothly, like a pendulum swinging. A square wave sits at the top, jumps to the bottom, sits there, and jumps back, over and over. A triangle wave climbs in a straight line to the top, then falls in a straight line to the bottom.
Compare the three shapes. They have the same amplitude, so any difference in “size” comes from the shape alone.
Four everyday sizes
Energy and power are precise, but they are not the numbers you use most often. In practice you usually want one of four simpler numbers.
The mean is the plain average, with no squaring. Engineers often call it the DC value, borrowing the name from a battery’s steady “direct current”:
It tells you whether the signal sits above or below zero on average. The peak is the single largest value the signal reaches, ignoring sign:
The RMS (root-mean-square) value is an “effective average size” that, unlike the plain mean, does not cancel positive against negative. The name reads right to left: square every value, average the squares, then take the square root of that average:
RMS is closely related to power: it is over the window you average on. Finally, the crest factor compares peak to RMS:
A high crest factor means the waveform spends most of its time well below its highest value, a spiky shape. A crest factor near 1 means it stays close to its peak almost all the time, a flat-topped shape.
Switch between Sine, Square and Triangle, all at the same peak amplitude, and watch which readouts move.
Four everyday sizes
Same peak, different shape.
Describe this picture
One plot, against time in seconds, of a sine, square or triangle wave at peak amplitude 1, chosen with the “Waveform” buttons. Four readouts show “Mean”, “Peak”, “RMS” and “Crest factor”, to two decimals. For the square wave a line on the plot is labelled “peak = RMS”.
Notice that Peak never moves, because it is fixed by how the waveform was built. RMS and Crest factor do move. For the square wave the plot labels the line “peak = RMS”, because the two are equal and the crest factor is 1. The triangle spends more time away from its peak, so its RMS is lowest and its crest factor is highest.
Where do those RMS values come from? Take amplitude 1 and average the squared values over one period.
- Sine. Use the identity . The cosine part averages to zero, so the average of is and .
- Square. The value is always , so everywhere and .
- Triangle. Every straight segment sweeps the magnitude evenly from 0 to 1. The average of for from 0 to 1, where is the height as a fraction of the peak, is (in calculus terms, ), so .
Signal and noise, in decibels
Loudness ranges are enormous: the quietest sound you can hear and the loudest sound that hurts differ by a factor of roughly a trillion in power. Numbers that large are awkward to write down, compare or read off a meter. A logarithmic scale called decibels (dB) solves this.
For a power ratio, the level in decibels is ten times the base-10 logarithm of the ratio. Multiplying the power by 10 always adds 10 dB, whatever you started from:
Amplitude is easier to measure than power, so let’s convert. Power is proportional to the amplitude squared, so . Because , the factor of 10 becomes 20:
A meter that reports level relative to the loudest value a digital system can hold gives you dBFS (“dB full scale”):
with , the full-scale peak.
Here is the level you measure, and is the full-scale value the system can hold. On this page we measure the level as an RMS value.
Once you can measure size in dB, you can measure how clean a recording is. Signal-to-noise ratio (SNR) compares the size of the part you want to the size of the part you do not, in dB:
Here is the RMS of the signal alone and is the RMS of the noise alone. A bigger SNR means the wanted part dominates the unwanted part by more.
Drag How much noise up and down, and watch Signal-to-noise.
Signal and noise, in decibels
Turn up the noise and watch the SNR fall.
Describe this picture
One plot, the level against time in seconds, of the tone alone in grey and the tone plus noise over it. The “How much noise” slider runs from to 0 dB. The “Noise level” readout is the noise’s RMS in dB relative to the tone’s RMS, and “Signal-to-noise” is the SNR; both are measured from the samples drawn, to one decimal. It starts at dB: “Noise level” reads dB and “Signal-to-noise” reads dB.
Notice that each dB you add to Noise level takes exactly one dB off Signal-to-noise. In dB a ratio becomes a difference, so each dB of noise comes straight off the SNR.
Worked example
A full-scale sine, in dBFS. Take a sine wave with peak , the largest value a system scaled to can hold. Its average squared value is , as in the working above, so
Measured by RMS, a sine at the loudest amplitude the system can hold reads about dBFS, not 0, because a sine’s RMS is always below its peak. Measured by peak, it reads 0 dBFS. AES17 also calls it 0 dBFS, because it defines 0 dBFS as the RMS of a full-scale sine.
SNR from an amplitude ratio. Say the tone has amplitude . As a simple stand-in for noise, use a second sine with amplitude . The amplitude ratio is , which is dB, since . Both are sinusoids, so the RMS factor is the same on top and bottom and cancels from the ratio:
Crest factor, three waveforms at the same peak (). The sine has ( dB), the square wave (always at ) has ( dB), and the triangle has ( dB).
Where you’ll meet this
A phone’s signal-strength bars are a rough dB scale on received power. A microphone’s spec sheet quotes how much noise it adds, and how loud a sound it can take, in dB. A recording app’s level meter reads RMS, or sometimes peak, against a 0 dBFS ceiling. It warns you when a signal is about to hit that ceiling and have its tops flattened, which engineers call clipping. Each of these is the same small set of numbers from this page, read off a different device.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Energy (discrete) | Finite for any finite excerpt | |
| Average power (discrete) | , large | Energy signal: finite , . Power signal: finite, positive |
| Mean (DC) | Plain average, no squaring | |
| RMS | “Square, average, square-root” | |
| Peak | Largest magnitude reached | |
| Crest factor | (0 dB) square, (3.01 dB) sine, (4.77 dB) triangle | |
| dBFS | (full-scale peak); full-scale sine measured by RMS reads dBFS | |
| SNR | 1 dB more noise = 1 dB less SNR |