Sonic Library Map
Map your Spotify library as an interactive 2D scatter plot of audio embeddings, with HDBSCAN clustering over UMAP-reduced coordinates.
View source →I have an issue where I like saving new music a lot more than I like organizing it into playlists. Maybe I could use audio features to make playlists for me.
This project uses audio features, projects them into 2D using UMAP, then clusters songs with HDBSCAN.
Spotify stopped providing audio features in late 2024, so we have to compute them manually:
- Spotify OAuth pulls saved tracks, playlists, and artist genres (paginated, rate-limited, cached in SQLite).
- A Python sidecar matches each track on YouTube Music with
ytmusicapiand downloads audio withyt-dlp. - Audio runs through Essentia’s Discogs-EffNet TF model to produce 1280-dim learned style embeddings.
- UMAP reduces those to two axes; HDBSCAN clusters the result and draws hulls around each cluster on the map.
- A Next.js / React front-end renders the map on a D3 canvas with playlist overlays, zoom/pan, and quadtree hit-testing (SVG falls over past a few thousand points). Hovering a track previews it inline via YouTube, and a custom-axes mode lets you swap UMAP for any two raw audio features.
Here’s a static snapshot of my personal library. I would like to provide it as a demo, but it is too compute-intensive.