PyRubberband

A python wrapper for rubberband.

For now, this just provides lightweight wrappers for pitch-shifting and time-stretching.

All processing is done via the command-line through files on disk. In the future, this could be improved by directly wrapping the C library instead.

Example usage

>>> import soundfile as sf
>>> import pyrubberband as pyrb
>>> y, sr = sf.read("myfile.wav")
>>> # Play back at double speed
>>> y_stretch = pyrb.time_stretch(y, sr, 2.0)
>>> # Play back two semi-tones higher
>>> y_shift = pyrb.pitch_shift(y, sr, 2)

API Reference

Functions

Command-line wrapper for rubberband

pitch_shift(y, sr, n_steps[, rbargs]) Apply a pitch shift to an audio time series.
time_stretch(y, sr, rate[, rbargs]) Apply a time stretch of rate to an audio time series.
timemap_stretch(y, sr, time_map[, rbargs]) Apply a timemap stretch to an audio time series.

Changelog

Changes

v0.3.0

  • Added timemap_stretch for variable-rate warping. (PR #15) Marc Sarfati

v0.2.2

  • Suppress console logging from rubberband

v0.2.1

  • Improved error handling when rubberband fails to execute.

v0.2.0

  • Removed dependency on librosa in favor of pysoundfile (PR #4).
  • Stereo/mono interface now matches pysoundfile instead of librosa: t he first axis now corresponds to time rather than channel number.