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.

Contents:

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
comp.add_segment(segment)

# output your composition as a numpy array
arr_out = comp.build()

# or export your composition as an audio file, composition.wav
comp.export(filename="composition")

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
composition.export(filename="retarget_length_test")
short_composition.export(filename="short_retarget_length_test")

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

Composition

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

Tracks

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

Dynamics

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

Algorithms

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.algorithms.librosa_analysis

Utilities

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

Indices and tables

Fork me on GitHub