i'm tired of waiting for the new avalanches album
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



(work in progress)

It doesn't seem like the new Avalanches album is coming out any time soon, but with Pablo (so named for Pablo's Cruise) you can automatically generate plunderphonic song sketches (music collages/sample mixes) to fill that void.

Pablo will analyze a directory of audio files (mp3, wav, aif) and randomly select a song to build a mix around. It will then pick out other appropriate songs from that directory - tempo-stretching and pitch-shifting them as needed - to slice into samples, which Pablo then assembles into a multi-track mix.

The quality of the output depends a lot on your own taste in curating the library Pablo samples from. If you have a directory of songs that seem like they'll fit together, Pablo will do pretty well. If you have a bunch of random tracks, you might get something nice too.

These mix sketches are meant for high-scale automated ideation and not a substitute for human editing ;)

An example track can be listened to here


You can install via pip:

$ pip install pablo

Or install the latest version:

# Clone the git repo, then from inside the repo:
$ pip install .

Pablo relies on some other libraries for the heavy lifting, so install those (pip does not install them for you):

$ brew install sox ffmpeg

And you'll also need Essentia. Installation instructions are here.

Finally, you need to specify some Spotify API information to get audio features from Spotify. Create config.py with the following:

USERNAME='your spotify username'
CLIENT_ID='your spotify client id'
CLIENT_SECRET='your spotify client secret'
REDIRECT_URI='redirect uri'

The redirect URI can basically be anything, just authorize it in the Spotify API settings. You just need to copy the URL you're redirected afterwards.


You can have Pablo analyze your library in one go, so that mix generation runs quicker. Pablo will persist song analyses based on file hashes so no redundant processing is necessary.

$ pablo analyze /path/to/my/songs

Then you can start generating mixes:

$ pablo mix /path/to/my/songs /path/to/output

Pablo will output the mix, a tracklist for the mix, the modified songs, and all of the sliced samples to the specified output directory.

There are a few options you can pass in, to learn about them, help is available:

$ pablo mix --help

You can also "crate dig" YouTube videos with the dig ability:

$ pablo dig https://www.youtube.com/watch?v=uS2nWLz-AbE /path/to/output


  • The quality of Pablo's output depends a lot on what songs are in the library ("crate") you specify
  • Longer minimum sample sizes (-c) will make for more coherent mixes
  • Pablo will try to avoid overlaying a song with itself, but sometimes it is unavoidable. Increasing the number of songs (-S) will make this less likely to happen
  • Pablo will try to make "coherent" tracks (using markov chains) but if you don't want that, you can go full-random with the --incoherent flag
  • Songs with less clear beats are much harder to calculate tempos for (natch), but they can lead to interesting results nonetheless
  • Pablo doesn't recognize vocals, so if you have a lot of vocal-heavy songs in your library, you may get kind of cacophonous results - but sometimes it works out well too
  • You can pre-cut some samples, dump them into a folder, and point Pablo to that to generate a mix from as well
  • Kendrick Lamar seems to go well with everything

To do

  • could favor more "danceable" tracks as rhythm tracks
  • make it so you can specify diff libraries/crates for different tracks. That way one could be, for instance, for vocals only, another could only be for rhythm, etc
  • add some EQing heuristics


  • use Gaia to train an audio classifier? then use this to have some notion of what kind of song to aim for?
  • reference: https://www.academia.edu/371700/Music_type_groupers_MTG_generic_music_classification_algorithms. Features used with SVM: barkbands spread, skewness, kurtosis, dissonance, hfc pitch and confidence, pitch salience, spectral complexity, spectral crest, spectral decrease, energy, spectral flux, spec spread/skewness/kurtosis, spec rolloff, strong peak ZCR, barkbands, mfcc, bpm , beats loudness, onset rate, inharmonicity, odd2even, pitch centroid, tristimulus, chords strength (frame), key strength (global), tuning freq
  • Gaia has some kind of music similarity capabilities, I think. Could use that to further filter down selections based on similarity

Installation note

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages/