{"id":45908,"library":"pyrubberband","title":"pyrubberband","description":"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.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"http://github.com/bmcfee/pyrubberband","tags":["audio","pitch-shift","time-stretch","rubberband"],"install":[{"cmd":"pip install pyrubberband","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Commonly used together for audio loading/processing; pyrubberband can also use numpy arrays directly.","package":"librosa","optional":true},{"reason":"Required for array operations.","package":"numpy","optional":false},{"reason":"Optional for reading/writing audio files if not using librosa.","package":"soundfile","optional":true}],"imports":[{"note":"The module is imported as a whole; the package name is the same.","wrong":"from pyrubberband import pyrubberband","symbol":"pyrubberband","correct":"import pyrubberband as pyrb"}],"quickstart":{"code":"import librosa\nimport pyrubberband as pyrb\n\ny, sr = librosa.load('audio.wav', sr=None)\n# Pitch shift up by 2 semitones\ny_shifted = pyrb.pitch_shift(y, sr, n_steps=2)\n# Time stretch by factor 1.5\ny_stretched = pyrb.time_stretch(y, sr, rate=1.5)\n# Optionally write output\nlibrosa.output.write_wav('output.wav', y_shifted, sr)","lang":"python","description":"Basic usage: loading audio with librosa, then pitch shifting and time stretching."},"warnings":[{"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.","message":"pyrubberband 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use named parameter 'sr' instead of 'samplerate'.","message":"In 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.","severity":"breaking","affected_versions":"0.3.0+"},{"fix":"Ensure audio data is converted to float: audio = audio.astype(np.float32)","message":"Input audio must be a numpy array with floating point dtype (e.g., float32 or float64). Integer arrays will cause errors or silent corruption.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.4.0':18 '3.7':22 'around':4 'audio':10,26 'band':7 'current':16 'infrequ':25 'librari':8 'pitch':11,28 'pitch-shift':27 'pyrubberband':1 'python':2,21 'releas':23 'rubber':6 'rubberband':33 'shift':12,29 'stretch':15,32 'time':14,31 'time-stretch':30 'version':17 'work':19 'wrapper':3","created_at":"2026-06-07T12:57:19.231861+00:00","updated_at":"2026-06-07T12:57:19.231861+00:00","problems":[{"fix":"pip install pyrubberband","cause":"pyrubberband is not installed.","error":"ModuleNotFoundError: No module named 'pyrubberband'"},{"fix":"Install rubberband system-wide (e.g., apt install rubberband-cli) or use conda environment with conda install -c conda-forge rubberband.","cause":"System-level Rubber Band Library not found.","error":"OSError: cannot load library 'librubberband.so': ..."},{"fix":"Use 'sr' instead of 'samplerate' in function calls.","cause":"Using deprecated parameter name from older versions.","error":"TypeError: pitch_shift() got an unexpected keyword argument 'samplerate'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://github.com/bmcfee/pyrubberband","github":"http://github.com/bmcfee/pyrubberband","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["analytics","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}