Work
Audio machine learning

Que Baile

Confusion matrix for the first-pass model: every bachata, salsa, and merengue song classified correctly, and 10 of 15 cumbia songs

Que Baile is a PyTorch classifier that listens to a song and names its Latin dance genre: bachata, cumbia, merengue, or salsa. These four are hard to tell apart. They share instruments, overlap in tempo, and are mostly sung in Spanish, so the difference comes down to rhythm and a few signature instruments. The model turns audio into spectrograms and classifies them like images. Eventually, I want to test it live with Northeastern’s Kaliente dance team and run it on an embedded device.

Impact

A first-pass model got 76 of 81 validation songs right (93.8%), and every miss was a cumbia song.

I got the idea from a Dance Dojo video on telling salsa, bachata, merengue, and cumbia apart by ear. I’d also been listening to a lot of cumbia lately, mostly from my own playlist.

Most of the work so far has gone into the data. I started with classic YouTube playlists for each genre, downloaded as MP3s into one folder per genre so the folder name serves as the label. Choosing “classic” playlists gave clearly representative examples, at the cost of skewing toward older recordings and production styles. A second-pass review with Claude Code checked that songs were in the right folders, removed ones that were clearly out of place, and cut duplicates. That shrank the dataset a lot.

To rebuild it, I pulled Spotify playlists: my own cumbia playlist, pruned by hand, and Spotify’s curated classic-genre playlists. Before downloading any playlist, I shuffled it and listened to about 10 songs, then had Claude flag tracks that didn’t fit. A final Claude Code pass removed crossovers, like pop-leaning tracks or ones drifting toward reggaeton. That left about 100 to 170 songs per genre, so I’m adjusting class weights in training to even out the imbalance.

For the first training run, I described what I wanted and had Claude Code write the training code, so I could quickly check the dataset’s quality and find its mistakes. The 60,836-parameter model trained for 20 epochs. Its best checkpoint got 76 of 81 validation songs right (93.8%) and 88.3% of individual clips. Every bachata, salsa, and merengue song was classified correctly. Cumbia was the weak spot: 10 of 15 right, with 3 of the misses called salsa.

This pass was about checking the data, not writing the final model. Next, I’m rewriting the training code by hand, with this run as the baseline to compare against.

Validation accuracy over 20 training epochs, for whole songs and for 4-second clips. The saved model, from epoch 9, scored 93.8% on whole songs.