# 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)
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.