Registry / analytics / pyrubberband

pyrubberband

JSON →
library0.4.0pypypi✓ verified 86d ago

Python wrapper around the Rubber Band Library for audio pitch shifting and time stretching. Current version 0.4.0, works on Python >=3.7. Releases are infrequent.

pip install pyrubberband
INSTALL
IMPORT
SIG · PYRUBBERBAND
P
pyrubberband
analyticspythonv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pyrubberband
import pyrubberband as pyrb
from pyrubberband import pyrubberband
The module is imported as a whole; the package name is the same.

Basic usage: loading audio with librosa, then pitch shifting and time stretching.

import librosa import pyrubberband as pyrb y, sr = librosa.load('audio.wav', sr=None) # Pitch shift up by 2 semitones y_shifted = pyrb.pitch_shift(y, sr, n_steps=2) # Time stretch by factor 1.5 y_stretched = pyrb.time_stretch(y, sr, rate=1.5) # Optionally write output librosa.output.write_wav('output.wav', y_shifted, sr)
Debug
Known issues
gotchapyrubberband requires the Rubber Band Library (librubberband) to be pre-installed on the system. It does not bundle the C/C++ library. Without it, imports may fail or produce missing library errors.
fix
Install system-level rubberband: on Debian/Ubuntu: sudo apt install rubberband-cli; on macOS: brew install rubberband; on Windows, download precompiled DLL or use conda-forge: conda install -c conda-forge rubberband.
affects: all
breakingIn version 0.3.0, the function signature for pitch_shift and time_stretch changed: the 'samplerate' parameter was renamed to 'sr'. Older code using 'samplerate' will raise TypeError.
fix
Use named parameter 'sr' instead of 'samplerate'.
affects: 0.3.0+
gotchaInput audio must be a numpy array with floating point dtype (e.g., float32 or float64). Integer arrays will cause errors or silent corruption.
fix
Ensure audio data is converted to float: audio = audio.astype(np.float32)
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyrubberband'
pyrubberband is not installed.
fix
pip install pyrubberband
OSError: cannot load library 'librubberband.so': ...
System-level Rubber Band Library not found.
fix
Install rubberband system-wide (e.g., apt install rubberband-cli) or use conda environment with conda install -c conda-forge rubberband.
TypeError: pitch_shift() got an unexpected keyword argument 'samplerate'
Using deprecated parameter name from older versions.
fix
Use 'sr' instead of 'samplerate' in function calls.
Upgrade
Version history
0.4.0latest on PyPI · released Sep 30, 2024
Audit
Dependencies
librosaoptionalCommonly used together for audio loading/processing; pyrubberband can also use numpy arrays directly.
numpyrequiredRequired for array operations.
soundfileoptionalOptional for reading/writing audio files if not using librosa.
Agent activity
46 hits · last 30 days
node
44
OpenAI (training)
1
Resources
pyrubberband — pip install pyrubberband · libregistry