Welcome to Remix.

This is a tutorial for how to use the Python version of Echo Nest Remix. It assumes that you're comfortable with the command line, know a bit about Python and that you installed Remix successfully. If you're not au fait with working with a command line, you might want to read this guide. If Python scares you, this is the place to go. If Remix is not installed correctly, head on back to the main Remix page for lots of advice on how to fix it.

What is Remix, anyways?

Remix is a collection of Python libraries that let you perform algorithmic modifications of audio files. That is to say, you can write code to make a straight beat swing, edit the breakdowns out of a track, or add cowbell to every beat. Remix does this by making use of the Echo Nest's online analysis tools. These tell Remix where every beat starts, how loud it is, what note is playing, and so on. You then tell Remix what to do with those parameters.

So how do you code this?

For example, let's look at one.py. This will make you a track that's only the first beat of every bar. Here's how:

    # This takes your input track, sends it to the analyzer, and returns the results.  
    audiofile = audio.LocalAudioFile(input_filename)

    # This gets a list of every bar in the track.  
    # You can manipulate this just like any other Python list!
    bars = audiofile.analysis.bars

    # This makes a new list of "AudioQuantums".  
    # Those are just any discrete chunk of audio:  bars, beats, etc
    collect = audio.AudioQuantumList()

    # This loop puts the first item in the children of each bar into the new list. 
    # A bar's children are beats!  Simple as that. 
    for bar in bars:
        collect.append(bar.children()[0])

    # This assembles the pieces of audio defined in collect from the analyzed audio file.
    out = audio.getpieces(audiofile, collect)
    
    # This writes the newly created audio to the given file.  
    out.encode(output_filename)
    

What else can Remix do?

We're glad you asked - Each of the examples in the tutorial folder is heavily, heavily commented, in the above style, to show you how they work.

The tutorial examples cover three things that remix can do:

Moving Audio Around: One, Reverse, Limp, Swinger, Waltzify.
These examples deal with the tremendous power of having every bar, beat, and sub-beat of a track in a list in Python. One, Reverse, and Limp are really simple: Swinger and Waltzify are really complex, but do amazing things.

Picking Out Audio: Selection, AfromB.
Once you can take any beat from a track, how do you choose which beats to take? Selection and AFromB start picking out certain beats from the track and putting them back together in very specific ways. Selection is simple, AFromB is complex, but not that complex.

Mixing Audio: Drums, Cowbell.
Once you can select certain beats from a track, you can start adding other sounds to them. Drums and Cowbell add new sounds to the track. Drums simply adds the same break all the way through. Cowbell is the more complex cowbell / Walkenizer made famous at morecowbell.dj

Modifying Audio: Beatshift, Cycle
These examples show how to change the pitch or duration of chunks of audio: moving an entire song up a fifth, say, or slowing a song down to half its tempo.

Happy remixing! You can also check the examples for inspiration, or look at our repository of example code.