3 min read

Sonogram: Transforming Sound into Visual Fingerprints

A deep dive into Sonogram, a full-stack web app that turns a song's mathematical properties into an interactive, shareable 3D 'sonic fingerprint'.

Updated

Update — June 2026

Sonogram has been retired. The visualizers and the public gallery are gone, but the audio analysis underneath — loudness, key, tempo, waveforms — lives on inside 1-bit. Here’s the full story →

I built Sonogram to answer a daft little question: what would a song look like if you could actually see it? Drop in a track and it reads the audio’s real shape — loudness, key, tempo, texture — and turns those numbers into an interactive 3D “sonic fingerprint” you can spin around.

What it does

StudioDrop in a file (MP3, FLAC, WAV…) or record straight from the mic. It runs the DSP analysis — spectral features, MFCCs, chroma, tempo, key detection, all via librosa — and paints a live 3D visualization with Three.js.
GalleryBrowse and search everything people have saved — by title, artist, genre, or BPM. Every piece gets its own page that looks right the moment you paste the link somewhere.
Compare ModePlace two tracks side-by-side in a “Mirror Matrix” visualization.
Admin DashboardManage records, toggle visibility, and bulk-export artwork as ZIP files.
EmbeddableEach visualization has an iframe-friendly /embed/ route for external use.

Tech Stack

LayerTechnologies
BackendFastAPI, SQLAlchemy (SQLite), Uvicorn
DeploymentFly.io, Docker
Audio Analysislibrosa, scipy, numpy (Single-pass STFT)
FrontendVanilla JS (~9K lines), Three.js (WebGL), PWA
ImagingPillow (for PNG generation)

Interesting Facts

Steganography

Every artwork carries its own ID, hidden inside the image itself. I tuck it into the least-significant bits of the blue channel, where the eye can’t see it — so you can re-upload a PNG and get its metadata back with no server lookup at all.

Magic Bytes”SONO”
LocationFirst 320 pixels
BenefitRe-upload a PNG to recover metadata — no server lookup needed
Hardware-aware Rendering

Before it renders a single frame, the frontend sizes up your machine — GPU, CPU cores, RAM, screen — and sorts it into a LOW / MEDIUM / HIGH tier, then dials these to match so nothing stutters:

Resolution scalingBloom strengthParticle density
Deterministic Visuals

The seed is a SHA-256 hash of the raw audio bytes, so the same file always paints the same picture. One song, one fingerprint — that mattered to me more than it probably should have.

Three Visualization Modes

Users can switch between three distinct modes in fullscreen:

SpectrogramTime-frequency heatmap
CrystalAbstract 3D geometry
LandscapeTerrain-like surface
Key Detection

To guess a track’s key it uses the Krumhansl–Schmuckler algorithm — matching the song’s pitch content against the fingerprint of every major and minor key, then picking the best fit. It’s surprisingly good at it.

Theme System for AI Art

Includes theme definitions (Bauhaus, Neon Cyberpunk, Aerial Objects) with ControlNet scale parameters, hinting at a future generative AI triptych feature.

Hybrid Architecture

The Gallery and Studio run as a vanilla-JS single-page app for speed, but each individual sonogram page (/s/{id}) is server-rendered so a shared link arrives with a proper preview. Best of both.

Related posts

Comments