The idea
Most recommenders learn from what other people listened to. VibeMatcher doesn’t need any listening history: it describes every song as a vector of audio features and recommends the songs whose vectors point in the most similar direction. That makes it work from the very first search and makes every recommendation explainable.
The data
I used the Spotify Top 2000s Mega Dataset, a curated list of about 2,000 well-known tracks. Starting from a list of hits keeps out covers, duplicates and low-quality entries that would otherwise show up as matches. I also remove any repeated title and artist pairs before building the vectors.
Each song is described by six Spotify audio features: danceability, energy, valence (how positive it sounds), tempo in BPM, acousticness and speechiness (how much of it is spoken word).
The math
1. Normalize and weight. The features use very different ranges (tempo is in the hundreds, the others are percentages), so each one is scaled to 0–1 with min-max scaling. Two features then get extra weight:
x_scaled = (x − x_min) / (x_max − x_min) × w
w_speechiness = 1.5
w_tempo = 1.2
Without these weights, a rap verse and an instrumental EDM track with similar energy and danceability can look almost identical. Weighting speechiness separates songs by how much singing or rapping they have, and weighting tempo keeps the rhythm close.
2. Compare with cosine similarity. For the chosen song A and every other song B, the app computes the cosine of the angle between their vectors:
similarity = cos θ = (A · B) / (‖A‖ ‖B‖)
A value of 1 means the two songs have the same profile. The five highest scores, excluding the song itself, become the recommendations.
The app
In the Streamlit app you type part of a title, choose the exact version from up to ten results sorted by popularity, and press “Find matches”. Each of the five results shows its artist, genre, a match percentage and a button that opens the song in a Spotify search.
What I’d do next
- Measure quality, for example how often the top five share a genre with the chosen song, so changes to the model can be compared with numbers instead of by ear.
- Learn the weights from that measurement instead of setting them by hand.
- Try the features I don’t use yet, such as loudness, liveness and duration, and a larger catalogue so matches can reach beyond the hits.