radiotool - tools for constructing and retargeting audio

Radiotool is a python library that aims to make it easy to create audio by piecing together bits of other audio files. This library was originally written to enable my research in audio editing user interfaces, but perhaps someone else might find it useful.

To perform the actual audio rendering, radiotool relies on scikits.audiolab, a python wrapper for libsndfile.

The library source is hosted on GitHub here.


Simple examples

Basic usage

from radiotool.composer import *
comp = Composition()

# create a track with a pre-existing wav file
track = Track("test.wav")

# create a segment of a track that:
# 1. starts at the 0.0 mark of the composition
# 2. begins playing at the 0.5 second mark of the track
# 3. plays for 1.0 seconds
segment = Segment(track, 0.0, 0.5, 1.0)

# add segment to the composition

# output your composition as a numpy array
arr_out =

# or export your composition as an audio file, composition.wav

Simple extension or shortening of music

from radiotool.composer import Song
from radiotool.algorithms.retarget import retarget_to_length

song = Song("music_file.wav")

# new song should be 1000 seconds long
composition = retarget_to_length(song, 1000)

# new song that's only 30 seconds long
short_composition = retarget_to_length(song, 30)

# export to audio file

See the documentation for more detailed examples (coming soon!).


radiotool.composer.Composition([tracks, ...]) Create a composition made up of bits of different audio


radiotool.composer.Track(fn[, name]) Represents a wrapped .wav file.
radiotool.composer.Speech(fn[, name]) A radiotool.composer.Track
radiotool.composer.Song(fn[, name]) A radiotool.composer.Track
radiotool.composer.RawTrack(frames[, name, ...]) A radiotool.composer.Track subclass that wraps raw PCM


radiotool.composer.Dynamic(track, ...) (Abstract) volume control for tracks
radiotool.composer.Volume(track, ...) Adjust the volume of a track in a composition
radiotool.composer.Fade(track, ...[, fade_type]) Create a fade dynamic in a composition
radiotool.composer.RawVolume(segment, ...) Dynamic with manually-specified volume multiplier array


radiotool.algorithms.retarget.retarget_to_length(...) Create a composition of a song that changes its length to a given duration.
radiotool.algorithms.retarget.retarget_with_change_points(...) Create a composition of a song of a given duration that reaches music change points at specified times.
radiotool.algorithms.retarget.retarget(song, ...) Retarget a song to a duration given input and output labels on the music.
radiotool.algorithms.novelty(song[, k, ...]) Return points of high “novelty” in a song


radiotool.utils A set of utility functions that are used elsewhere in radiotool

Indices and tables

Fork me on GitHub