Python bindings for the RubberBand library
Project description
pylibrb
pylibrb (py-lib-rubberband) is a simple Python extension exposing Rubber Band Library using nanobind bindings.
Since this is not a wrapper around a command-line app (like pyrubberband), both offline and real-time modes are available.
Currently this extenstion exposes only a single class: RubberBandStretcher
, which implements all the functionalities of the underlying C++ class. The interface is nearly identical to the original library, with a few changes to make it a bit more Pythonic by:
- using
snake_case
for functions, variables and properties, andSNAKE_CASE
for constants - not using (magic) numbers to represent the state
- use
is_done()
to see if all the data has been processed and returned from the stretcher, instead ofavailable() == -1
- use
stretcher.formant_scale = pylibrb.AUTO_FORMANT_SCALE
instead ofstretcher.formant_scale = 0
- use
- not using
final
argument inprocess()
- use
flush()
to finish processing and get the remaining samples
- use
Throughout the library, audio is accepted and returned in the form of NumPy ndarrays.
Example
from pylibrb import RubberBandStretcher, Option, create_audio_array
# create a stretcher
stretcher = RubberBandStretcher(sample_rate=16000,
channels=1,
options=Option.PROCESS_REALTIME | Option.ENGINE_FINER,
initial_time_ratio=0.5)
stretcher.set_max_process_size(1024)
# provide the audio to the stretcher, until some output is available
audio_in = create_audio_array(channels_num=1, samples_num=1024)
while not stretcher.available():
audio_in[:] = 0 # get the next batch of samples, here we just use silence
stretcher.process(audio_in)
# retrieve the available samples
audio_out = stretcher.retrieve(stretcher.available())
For more instructions, read the docstings of the RubberBandStretcher
class and the Option
enum, or see the documentation of Rubber Band Library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pylibrb-0.0.7-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99b964c6f0090addbdf5993f8d82710ec2a3460ef9ed6d038ae9bbe787d2c1bc |
|
MD5 | 428c928bddb5d856136e6eb6651fd0f9 |
|
BLAKE2b-256 | d7b084f0698d6081d25b491e8cac12e624276ffa47adef5376995e4db20443b0 |
Hashes for pylibrb-0.0.7-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5aff0e34cba4e12a73363e0e253edb9f2bf458f7c289e09b46d19d8a63c3430 |
|
MD5 | 04d45b0e7f8804de7036d6243ef07814 |
|
BLAKE2b-256 | b713fb94ad778562a3e35c8f10f7b67b05eeea9a79097ded536961f1aec8b560 |
Hashes for pylibrb-0.0.7-pp39-pypy39_pp73-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f24a3b4159944a158a159798b1d2e30a79ad4c638b60be1b566e82f448ca3cc |
|
MD5 | 203de22aded17bd56fb4704d620217ac |
|
BLAKE2b-256 | 807753f4d9c1ceefe4e7bab447b27f7382c8afc8d9d34ccec638c69e41332707 |
Hashes for pylibrb-0.0.7-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd100c92d3991f6a5dba6e6e3804e59d8a3008ae5da969bbd6bea521a3208028 |
|
MD5 | 524e7bb803ec3f34feb37b1c7b76faf8 |
|
BLAKE2b-256 | 6e74dab5033b81921bee845a286e1d71e82e20c5e0f0d6541eece74cb71fdb0a |
Hashes for pylibrb-0.0.7-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a75172a65e099b7a39a28affe9aec4898df00a6eb7c27676a06b2ec827cdba9b |
|
MD5 | eb643a60f49539092a04079c160a266c |
|
BLAKE2b-256 | 5bbe503fcc52dbdc05687e2a36e2fc628542e105910c4ce72487f931cf235389 |
Hashes for pylibrb-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7e180feb818e74540b7985e5328c582ca6035305b8d3c3ab8ee9370108cae9e |
|
MD5 | 108b7ea663739eb41f7e5dc913298ffd |
|
BLAKE2b-256 | 553d8e4240b97fcd5dbeb7114ed8ece5d56d513db429d7b275d5be79be2b645d |
Hashes for pylibrb-0.0.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0bd04f68304897d8d772648467a21982ca9a6b84d98d99968f87d6e18829c36 |
|
MD5 | dcd8d734ea470e491872d1ea8eece15a |
|
BLAKE2b-256 | b119ac181d1165727e3c7136f359f6847b91cd4312e0be46b34dbb152d28f48f |
Hashes for pylibrb-0.0.7-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53f1a50e3e341e8cdd64e049711d72f03b1c44618b7faf403f2d14d9a12002f7 |
|
MD5 | 21373ec2fad9143f239c68116fdef25c |
|
BLAKE2b-256 | 1316338021c30f5a4429d10cdd86182a1d90485a6c796fa96d15467c2dc5b04d |
Hashes for pylibrb-0.0.7-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d987f935324c07679c3d7c3cd2e740bf11d3c8d88152e4b7c8270c33a5a21c5d |
|
MD5 | 48eb9e2160f7368dcb9e0abf79c1e78a |
|
BLAKE2b-256 | 8a7b648018c805ffccfa0d15ec65a89226a2a7f2036332110432ac0fea4fbdf7 |
Hashes for pylibrb-0.0.7-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28c2c6e14336c92757b561b71b8c519ae770f779cdc421324d009f4a722afdeb |
|
MD5 | 3129cf3e69abe3f389bf92df7ee07d39 |
|
BLAKE2b-256 | ec138527a42cb54d187b557f7fdbeacb4c3eba499f4e87f5204c7638c054c14e |
Hashes for pylibrb-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50321f1d20fc28a411be48d77cdf7c828965780f1dae4aa54254121966ea6d7b |
|
MD5 | d06e1066ce4f4aa00b3669ffd7a83336 |
|
BLAKE2b-256 | 57a015ddbd0f0baf0e8d76f0c821733de770726582e9af148b710d8a2bcb23b0 |
Hashes for pylibrb-0.0.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be810e3a5a21132cff005d7fa6eea139fb832b851188ea9109aa0275ea3a83f2 |
|
MD5 | 37be816c329db1b9a4034a0c40f1f60c |
|
BLAKE2b-256 | 77e52e514173401dd3c7db96774b17ea16cae13e65efe03bc506e11202e26c6d |
Hashes for pylibrb-0.0.7-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9d3c8eec960cc7b31e242fbbc72178a4387d601a78bf0ac0328370df6984ddf |
|
MD5 | bf6640863f37705c503d4afb8c86e3c8 |
|
BLAKE2b-256 | e4be6639ba0241ad64cbb9e3dee2e24ede21bc3f74a944b0bc2c4fc103b26a36 |
Hashes for pylibrb-0.0.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 660a18fd74903ac5a605ce2c905e50ebd3dffb68cb27626e354428ac86750601 |
|
MD5 | 22a1dda7f9dbb739200f55afde976187 |
|
BLAKE2b-256 | 2b9717ee1f6489155dc0309b4beb241bd1b09fb858f861dd9c729012ea70cb58 |
Hashes for pylibrb-0.0.7-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f887570d521cdd3efc8e07fd9b57ffcb58d186a5e88612f5556b13707e7e5e8 |
|
MD5 | ec36cb4f4a69192b131ca191ea33ed69 |
|
BLAKE2b-256 | f9a244113853fb83ddca710d6ecc8690c76be463490e90cbe2b7f9b2d8dca1a6 |
Hashes for pylibrb-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba563420ad18c1c793e5b9a94b9c42454c40f53e92f641f3cd1d5a71313158e2 |
|
MD5 | a542c4ac71b1ba35909d1a7aeb36e15f |
|
BLAKE2b-256 | 3d7dcfd66fa47172a538259d60b83533f2e41554dfccd2be5a2dfb17b6919eb0 |
Hashes for pylibrb-0.0.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 097322173bceb0e9f6ec0ab608cdf559d1e5755677a6dbe970f69689c9a8920b |
|
MD5 | 643c9ab619f15741f4892732804b9502 |
|
BLAKE2b-256 | 9cd9cb52a1ce4ba93d6892bd319b4d2b55687e198f660acfe24b27bd152df2d2 |
Hashes for pylibrb-0.0.7-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c9df7de1401a6b59ede4569e7293e1547da9079f8fbd6fbb97fe17f9c20329f |
|
MD5 | 0ea60253e464f3b0fc155f98d33cd19a |
|
BLAKE2b-256 | c2d5ad9a02a268b6d3d6a51f79bc65c7a013bc81a71a79055466fa5962e11035 |
Hashes for pylibrb-0.0.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a8fbc1e445c043d227d677b936f1d137a5df3cf309a0a916f435457b1b50e80 |
|
MD5 | 959633d3cd45072500613102d4e0b224 |
|
BLAKE2b-256 | 5342936f3dde9b8fa0fe8833adb6e3efe783e0e84e08d09d32e3cabdefd4ed55 |
Hashes for pylibrb-0.0.7-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bee99871d3a6cfb5135b670f54e021c08607943f27936234e46f53758e7cb878 |
|
MD5 | a2021e492f22e51dfc479110f842cc66 |
|
BLAKE2b-256 | 8d12a841bf3285d992d3826d191deea57e4c0999755db6b4cfc66c173bc8da63 |
Hashes for pylibrb-0.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34715b37c8c205f1857a690db02eebd7b1ad9dfb3f7120fa86cf778c0c31667a |
|
MD5 | 802051f192645380251bb13733ba21c3 |
|
BLAKE2b-256 | ec0345bff5900a2343f78741bcd53ff294b1a89275e3291e93349fab5894ea27 |
Hashes for pylibrb-0.0.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0391354576605b608a36a4ee2db0716122ec856a27100014fd687e9a483c47e9 |
|
MD5 | a8232f864f3ddfa12465e356fb34ff49 |
|
BLAKE2b-256 | 1c16251eada8cb8c6684c9b0ec9f209d16d42d26219c866588735d611fe76696 |
Hashes for pylibrb-0.0.7-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 236d56671e4c7b4cbf51de62d4f9b2b2121aac710b96f0f00980d505d0d9f117 |
|
MD5 | 513633945d1ab565f73224476e89faf2 |
|
BLAKE2b-256 | ab3b812db68eb94020e059935eea3c19077b469a298a7fb08fd19c5a89a38e7d |