A music clustering program.
  • Go 55.9%
  • JavaScript 32.9%
  • CSS 7.3%
  • HTML 3.9%
Find a file
Tej Chajed a73e868604 using encoding/json for song info
allows encoding names with quotes and other funny characters correctly
2012-11-26 23:48:52 -06:00
cluster adding js output and d3 visualization 2012-11-22 21:46:34 -06:00
spectral minor cleanup 2012-11-24 16:12:52 -06:00
viz minor cleanup 2012-11-24 16:12:52 -06:00
loadsong.go changing import paths to github 2012-11-24 16:23:00 -06:00
madcap.go using encoding/json for song info 2012-11-26 23:48:52 -06:00
README.md adding readme file 2012-11-22 17:45:32 -06:00

A whimsically named music clustering program.

Running

Calls the external program sox; could eventually use cgo to bind to libsox, but this would actually complicate compilation a bit. This clean separation makes compiling as easy as pure Go libs/exe's always are while still calling sox for reading sound files. It turns out that reading mp3's is not easy.

Spectral features

Currently uses the following features:

  • spectral cutoff frequency
  • variation in spectral energy over time
  • frequency bin with most energy and variance
  • log-spaced raw frequency energies

For now, only uses a 4s sample starting at 0:30 in the song. Ultimately should sample several 4s samples and average the results.

Clustering

The clustering is a straightforward k-means on the normalized features using a Euclidean distance metrics. K-means is susceptible to outliers and random initialization, which may be a problem for music. To help counteract these effects I run k-means several times and select the one with the best 'cost', a combination of sum of Euclidean distances and a measure of the spread of clusters, to discourage lumping everything in one big cluster.