Waveform and Spectrogram Viewer, Explained

After reading this you will be able to read an audio file as both a waveform and a spectrogram, compute peak and RMS levels yourself, and spot clipping, silence, hum and bandwidth limits by eye.

What the two views show

An audio file is a list of numbers. Each number is one sample of the sound pressure at one instant. A CD stores 44,100 samples per second, so a 3 second clip holds 132,300 numbers per channel. Two pictures make sense of that list.

The waveform plots sample value against time. The vertical axis is amplitude, usually normalized to the range -1 to +1. You see loudness envelope, silence, and hard clipping at a glance.

The spectrogram plots frequency against time and uses brightness for energy. It answers a different question: not "how loud" but "which pitches are present, and when". A steady 60 Hz hum shows up as a bright horizontal line near the bottom. A cymbal crash shows up as a vertical smear across the top.

Here is the hook. A voice recording sounds fine on cheap earbuds but muddy on studio monitors. The waveform looks normal. The spectrogram shows a solid bright bar at exactly 50 Hz running the whole file: mains hum from a badly grounded cable. You would never see it in the waveform because 50 Hz is quiet compared to speech, but it stacks up on a subwoofer.

When to use it, and when not

Use the waveform when you care about level and timing: is the take clipped, where does the silence start, are two tracks aligned. Use the spectrogram when you care about content by frequency: is there hum, is the top end rolled off, is this file a fake high-resolution copy that was actually upsampled from an MP3.

Do not use either view to judge perceived loudness precisely. Peak amplitude and RMS are physical measures, not loudness. A −14 LUFS master and a −9 LUFS master can share the same peak. For tempo work, a waveform will not give you beats per minute directly; use the BPM Tapper & Detector instead.

The numbers behind the waveform

Two statistics summarize a block of samples. Peak is the largest absolute value. RMS (root mean square) is the energy-like average that tracks perceived level far better than peak.

\text{RMS} = \sqrt{\frac{1}{N} \sum_{i=1}^{N} x_i^2}

Here x_i is one sample value in the range -1 to +1, and N is the number of samples in the block. Squaring removes the sign, the mean averages the energy, and the square root returns to amplitude units. Levels are usually reported in decibels relative to full scale:

L_{\text{dBFS}} = 20 \log_{10}(\text{amplitude})

A full-scale amplitude of 1.0 is 0 dBFS. Half that, 0.5, is 20 \log_{10}(0.5) \approx -6.02 dBFS. Each halving of amplitude subtracts about 6 dB. RMS is always at or below peak, so its dBFS value is always at or below the peak value.

The numbers behind the spectrogram

The spectrogram comes from a short-time Fourier transform (STFT). You chop the signal into short overlapping frames, taper each frame with a Hann window to reduce edge artifacts, and take the discrete Fourier transform of each frame. The magnitude at each frequency bin becomes one pixel of brightness.

The frame length sets the trade-off. With a sample rate f_s and a frame of N samples, each frequency bin is this wide:

\Delta f = \frac{f_s}{N}

At 44100 Hz with a 2048 sample frame, \Delta f = 44100 / 2048 \approx 21.5 Hz per bin. Longer frames give finer frequency resolution but blur time. Shorter frames sharpen time but smear frequency. That is the uncertainty principle for signals, and no window choice escapes it.

The highest frequency any digital signal can carry is the Nyquist frequency, half the sample rate.

f_{\text{Nyquist}} = \frac{f_s}{2}

At 44100 Hz that is 22050 Hz. The spectrogram cannot show anything above it, and a hard black ceiling below Nyquist is a strong sign of low-pass filtering or lossy compression.

Brightness is on a logarithmic (dB) scale, not linear. A region that looks half as bright is not half the energy; it is typically tens of decibels down, which is thousands of times less power. That is why quiet detail such as room tone is still visible.

Worked example with the demo clip

Load the demo. It uses the default settings on a short synthetic tone plus noise sampled at 44100 Hz. Work the level math on a small block so you can check every digit.

Peak and RMS of a sine block

Take one cycle of a sine wave with amplitude 0.5, sampled at eight points: 0, 0.354, 0.5, 0.354, 0, -0.354, -0.5, -0.354.

  1. Peak is the largest absolute value: 0.5. In dBFS that is 20 \log_{10}(0.5) \approx -6.02 dBFS.
  2. Square each sample: 0, 0.125, 0.25, 0.125, 0, 0.125, 0.25, 0.125.
  3. Sum the squares: 1.0. Divide by N = 8: 0.125.
  4. Take the square root: \sqrt{0.125} \approx 0.3536. That is the RMS.
  5. Convert: 20 \log_{10}(0.3536) \approx -9.03 dBFS.

Notice the result: a sine wave has an RMS exactly 1/\sqrt{2} of its peak, so RMS sits about 3.01 dB below peak. The measured gap here is -6.02 - (-9.03) = -3.01 dB, which matches. This 3 dB gap holds for any pure sine at any amplitude, so it is an easy sanity check on your reading.

Crest factor (the peak-minus-RMS gap) is small for a square wave, about 3 dB for a sine, and large for speech, which has brief loud peaks over long quiet gaps.

Reading and interpreting what you see

Clipping
The waveform flattens against a horizontal line at the top or bottom. Peak reads 0.0 dBFS exactly and stays there for many samples. In the spectrogram, clipping adds harmonics, so you see extra bright horizontal lines above the original tone.
Silence and dropouts
A flat line at zero. RMS over that block falls toward -\infty dBFS. A brief drop to silence mid-signal is a dropout, often a corrupt sample or a bad edit.
Hum
A steady horizontal line in the spectrogram at 50 or 60 Hz, often with fainter lines at multiples (100, 150 Hz or 120, 180 Hz). Hard to see in the waveform.
Bandwidth limit
A sharp black cutoff in the spectrogram below the Nyquist frequency. A file at 44100 Hz that goes dark above 16 kHz was almost certainly a lossy MP3 at some point.

Check the crest factor: peak dBFS minus RMS dBFS. Below about 6 dB means the audio is heavily compressed or already clipped. Above 15 dB means lots of dynamic range and headroom, typical of unmastered speech or classical recordings.

Try the frequency and time trade-off

A longer STFT frame narrows each frequency bin but averages over more time. At 44100 Hz, a 512 sample frame gives 86.1 Hz bins and 11.6 ms of time blur; a 4096 sample frame gives 10.8 Hz bins but 92.9 ms of blur. You cannot make both small at once.

Common mistakes

The first mistake is trusting peak alone. A track can peak at -0.1 dBFS and still sound crushed if its RMS sits at -5 dBFS, a crest factor of only 4.9 dB. Read both.

The second is reading the spectrogram brightness as linear. It is decibels. A faint trace can still be audible, and a bright region is not proportionally louder.

The third is confusing a low sample rate with low quality by looking only at the ceiling. A genuine 44100 Hz recording of a muffled voice may have little energy above 8 kHz because the source had none, not because of compression. Look for a sharp cutoff, not a gentle roll-off. Compression cuts hard; nature rolls off.

Do not judge stereo balance from a single summed waveform. If you view left and right mixed to mono, a signal that is out of phase between channels can cancel and read far quieter than it plays back. View channels separately when phase matters.

Frequently asked questions

Why does my waveform look solid black when I zoom out?

At full zoom the viewer draws thousands of samples per pixel and fills the min-to-max range of each pixel column. Dense loud audio fills every column top to bottom. Zoom in until one pixel covers a few samples and the individual cycles appear.

What sample rate and bit depth should I care about?

Sample rate sets the highest visible frequency: 44100 Hz shows up to 22050 Hz, 48000 Hz shows up to 24000 Hz. Bit depth sets the noise floor: 16-bit reaches about -96 dBFS, 24-bit about -144 dBFS. Neither changes the shape of the waveform, only the finest detail.

Can I detect the tempo from the waveform?

Not directly. You can eyeball evenly spaced peaks in a strong drum track, but that is unreliable. Use the BPM Tapper & Detector, which analyzes the energy envelope for you.

Why is 0 dBFS the maximum and not a positive number?

dBFS is measured relative to full scale, where 1.0 amplitude equals 0 dBFS. Anything quieter is negative. A positive dBFS value would mean the amplitude exceeds the maximum the format can store, which is clipping.

Is my file uploaded anywhere?

No. The analysis runs in your browser using the Web Audio API and an in-page FFT. The file never leaves your device.