This is taking
longer than expected.

Check your connection.

Still tinkering with this one
back to projects
a little tool for looking at sound

Spectro

Spectro turns an audio file into a spectrogram and looks for signs of lossy compression. It can also compare two files and show where they differ. I made it because I wanted to understand more of the math behind audio.

Version v2.0.0
Language Python
Scroll to explore

Sound, but you can see it

A spectrogram shows how the frequencies in a recording change over time. A waveform leaves most of that hidden.

20kHz 10kHz 5kHz 1kHz 100Hz 20Hz
0:00 0:30 1:00 1:30 2:00
Lossy cutoff detected at 16kHz
01
default

Just show me the spectrogram

Point it at a file and you get a clean spectrogram that pops open on its own. If you want a log frequency axis, it's there, and if a script wants the numbers instead of the picture, it'll hand back a JSON report.

$
PNGoutput
--logfreq axis
--jsonreport
Like a Rolling Stone24-bit · 96 kHz
A real Spectro output generated from a 24-bit, 96 kHz FLAC
0:006:12
02
--preview

A quick look, right in the terminal

Sometimes you don't want a whole PNG, you just want a peek. This draws the spectrogram straight into your terminal in 256 colours (with an ASCII version for terminals that don't do colour). It skips matplotlib entirely, so it's done in milliseconds.

$
256colors
0files written
msrender time
Spectro rendering a 256-colour spectrogram directly in the terminal
the real terminal preview
03
--detect

Look for lossy audio

Detect mode scores the evidence out of 100 using six signals: spectral edge, slope, jitter, band ratio, rolloff stability, and SBR likelihood. It also checks for padded bit depth and stereo files that are really mono. You can run it across a whole album and get one table back.

$
VerdictPASS
Lossy score26 / 100
Active edge (p97)28.8 kHz
A real Spectro detection report showing a pass with 26 out of 100 lossy evidence
real result · PASS · 26/100
04
--compare

Put two files head to head

Give it two versions of the same track and it lines them up, then shows the source, the conversion, and what changed between them.

$
99.3%similarity
15 kHzMP3 cutoff
-32 dBdifference
A real Spectro comparison plot showing source audio, converted audio, and their difference
your 24-bit FLAC · converted locally to 96 kbps
01 / 04
why i made it

Mostly to learn the math.

I wanted a quick way to spot files that had been resampled or upconverted, but mostly I wanted to understand what I was looking at. Python made it easy to try ideas while I learned the audio analysis behind them. Spectro is where those experiments ended up.

"

A frequency cutoff is a pretty good sign of lossy compression, but it's not absolute proof. And no cutoff doesn't mean it's lossless either. Spectro shows you what's there, and you get to draw your own conclusions.

"
one honest caveat

The stuff it's made of

NumPy
SciPy
matplotlib
soundfile
STFT / DSP
Python