FLXCode Spectrogram

FLXCode apps

Appearance

Spectrogram

Press Start and make a sound. You get a scrolling picture of its frequencies, with the loudest one named.

Press Start and allow the microphone. Nothing is recorded or uploaded.

No ads. No account. Nothing you record is uploaded. Check it. We count page events with a daily code.

Problem or idea? Email us

Quick start

  1. Press Start spectrogram and allow the microphone.
  2. Whistle, hum, talk or tap something. The picture scrolls from right to left.
  3. Read the line under the picture: the loudest frequency, its nearest note and its level.
  4. Move the pointer, or touch the picture, to read the frequency at any height.
  5. Press Freeze to hold what you see. The microphone stays open until you press Stop.

Numbers this uses

  • Sample rate: the one your device gives the browser, usually 44.1 or 48 kHz. Examples here use 48 kHz.
  • FFT sizes: 1024, 2048, 4096 (default), 8192 and 16384 samples, from the Web Audio AnalyserNode.
  • Scroll speed: 50 columns a second, so a 600 pixel wide picture spans 12 seconds.
  • Level range: floor −100 dB and ceiling −30 dB by default, in dB relative to full scale. Both are sliders.
  • Averaging between frames: AnalyserNode smoothing 0.3.
  • Log axis: starts at 20 Hz. Linear axis: starts at 0 Hz. The top is 2, 5, 10 or 20 kHz, capped at half the sample rate.
  • Colour maps: Viridis, Magma and Grey, each 256 steps.

What common sounds look like

SoundPicture
WhistleOne clean line, usually between 1 and 4 kHz, with little above it.
Hummed or sung noteA line plus evenly stacked harmonics, wobbling slightly with vibrato.
SpeechStacked harmonics that move, with bright bands (formants) that shift between vowels. S and sh sounds are noise above 4 kHz.
Clap, click, door slamA short vertical stripe across all frequencies.
Mains humA thin line at 50 or 60 Hz with lines at its multiples.
Fan, air conditionerA steady fog, brightest at low frequencies.
Whine from electronicsA thin, steady line high up, often 8 to 16 kHz.

Worked examples

Resolution against time at 48 kHz. Bin width is the sample rate divided by the FFT size, and the window is the FFT size divided by the sample rate:

FFT sizeBin widthWindow
102446.88 Hz21.3 ms
204823.44 Hz42.7 ms
409611.72 Hz85.3 ms
81925.86 Hz170.7 ms
163842.93 Hz341.3 ms

Where a 1 kHz tone lands. It falls between bins unless the size divides evenly, so the readout interpolates between the loudest bin and its neighbours:

FFT sizeBin numberNearest bin centre
102421.3984.4 Hz
204842.71.01 kHz
409685.3996.1 Hz
8192170.71 kHz
16384341.3999 Hz

The lines you see above an A2 (110 Hz) on a guitar or voice, with the note each one is closest to:

HarmonicFrequencyNearest note
1110 HzA2
2220 HzA3
3330 HzE4 (+2 cents)
4440 HzA4
5550 HzC#5 (−14 cents)
6660 HzE5 (+2 cents)
8880 HzA5

Where frequencies sit on a picture 260 rows tall with the top set to 10 kHz (row 0 is the top):

FrequencyRow, log axisRow, linear axis
100 Hz192256
1 kHz96233
5 kHz29129

On the log axis every doubling takes the same height. From 20 Hz to 10 kHz that is 9.0 octaves, about 29 rows each. On the linear axis the whole range below 1 kHz is squeezed into the bottom 26 rows.

How it works

The browser's AnalyserNode applies a Blackman window to the latest block of samples and takes an FFT. The page reads the level of each frequency bin in dB, maps every pixel row to a bin (interpolating between two), picks a colour from the level and draws one column on the right. The older picture moves left. Bin k sits at k × sample rate ÷ FFT size.

The loudest frequency is the biggest bin, refined with a parabola through it and its two neighbours, so it is finer than the bin width. The note is the nearest equal-tempered note with A4 = 440 Hz. This is a quick look, not a measurement instrument: the colour scale is relative to digital full scale, not to sound pressure. For a level in dB, use the decibel meter. To tune an instrument, use the online tuner.

Raw signal

The page asks the browser to switch off echo cancellation, noise suppression and auto gain. Those steps cut quiet detail and change levels, which would draw a different picture from the real sound. If your browser ignores the request, the line under the button says so.

FAQ

How do I read a spectrogram?

Time runs left to right with the newest sound on the right edge. Pitch runs from the bottom (low) to the top (high). Colour is loudness, dark for quiet and bright for loud. A steady note is a flat line, a rising note is a slope, a clap is a vertical stripe, and noise is a fog over a band of frequencies.

Why are there several lines above a single note?

Instruments and voices make a fundamental plus harmonics at 2, 3, 4 times its frequency. Those are the stacked lines. Their strength is what gives a violin, a flute and a voice different timbres, even on the same note.

What does the FFT size change?

A bigger FFT gives finer frequency detail but blurs fast changes in time. At 48 kHz, 1024 samples resolve about 47 Hz and cover 21 ms, while 16384 samples resolve about 3 Hz and cover 341 ms. Use 1024 or 2048 for clicks and speech, 8192 or more to separate close tones.

Log or linear axis, which one?

Log spaces each octave equally, so low notes get room and it matches how pitch sounds. Use it for music and speech. Linear spaces every hertz equally, so harmonics look evenly spaced, which helps when you look for a hum and its multiples or a whine at a fixed spacing.

Nothing shows up, or the picture is all dark. What now?

Make a sound first and check the right microphone is active in your system settings. If the picture is dark while you speak, lower the Floor slider, for example to −110 dB. If everything is bright, raise the Ceiling or move away from the microphone.

Why is the top of the picture empty?

The microphone or the sample rate sets the limit. At 48 kHz nothing above 24 kHz can exist, and many laptop microphones roll off well before that. Bluetooth headsets in call mode often cut at 4 or 8 kHz. Check the sample rate with the mic test.

I see a line at 50 or 60 Hz and its multiples. Is that my mic?

It is usually mains hum from a power adapter, a lamp or a bad ground. Hum at 50 or 60 Hz comes with harmonics at 100, 150, 200 Hz (or 120, 180, 240). Switch to the linear axis to see them evenly spaced. Compare with the 60 Hz tone.

Can I open an audio file or save the picture?

No. This page only listens to the microphone, shows the picture on screen and keeps nothing. Use Freeze to hold a moment, then take a screenshot with your system tool.

Is my audio uploaded?

No. The analysis runs in your browser and the picture lives in a canvas that is gone when you stop or leave. We count events like "started the spectrogram" with a daily code, never sound.

More from FLXCode

Share Spectrogram