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.6-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 679b3eebaec94acb0895d2c7883dc2b4367e6228429a976922ca298dca79e245 |
|
MD5 | 4f9dfbaa55e5e5392e03dbdc6e7141b9 |
|
BLAKE2b-256 | a1d44f29c91fe504b081180b40ce867b6c15dfbe78187d2a8c1f21fe1d5adf2f |
Hashes for pylibrb-0.0.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab493e907a11b71780ff4401bcaeba8383415e42eca553377c4d825e4521d752 |
|
MD5 | 5da60676782dd7f5f2d854ff8fbe7468 |
|
BLAKE2b-256 | c052092a9ae88d83542b0090c47b8e842217b56e92b82812567f15387437a2db |
Hashes for pylibrb-0.0.6-pp39-pypy39_pp73-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fec960c532357faa07dd658e3317af0c542105a9e9a040389f08dcbf17d38d0 |
|
MD5 | feb5da072710d9bdf3e4164221a7841b |
|
BLAKE2b-256 | 08e5e4969d02ef09c2ef2db8e5ed64f6a13fc33a0c5d4151b2af1be67633a18c |
Hashes for pylibrb-0.0.6-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8198bc138c001ef730a5fe6d5d0777d0fed2754beac519da30e211c801980c1 |
|
MD5 | 8ec065abe99457c122100cfcae817e3f |
|
BLAKE2b-256 | 4256e15e3f95fb867298979bd211a083e627513d6af1865141b157e9b7bad366 |
Hashes for pylibrb-0.0.6-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eced18948005bcf0e5bbe33f0cb822ead117b28609ce4b244b9399efdcc07304 |
|
MD5 | 87f1e9cf3ec2c037e5bc446bc70ce326 |
|
BLAKE2b-256 | 448a177b8b23beefb20b644526b5f22b3daf2eb70f93413c51d92938e9cb836c |
Hashes for pylibrb-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51b1af31384283c6d31e758aaf01ea2f603cdf14d39d9833c2d5486be85e926b |
|
MD5 | 3c56a32782f7883f0b666686c0845fed |
|
BLAKE2b-256 | 8a938b8df2cddd560eabb90002d20c67da67684e8925e48102226568f70404dc |
Hashes for pylibrb-0.0.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 147ab43cd98735c0f8af297decd65c9fdaa3acf83fc3d164892bb6413b018c3d |
|
MD5 | f0309849486fb930ee86d6996b4dbcdf |
|
BLAKE2b-256 | 999c75d0b09f9069b0937e9b58e41cb926c5d040a4e0d59daa32dd59af37a0b3 |
Hashes for pylibrb-0.0.6-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78f867356edfd352183a6ad1693b69183599107c6b36a9040b27485c97f76c14 |
|
MD5 | 945a0280a7cc617cab05d1c56e165961 |
|
BLAKE2b-256 | aa574ee1509b505d7ea585529724aae976263daba743d07f00e893a5a3a1797e |
Hashes for pylibrb-0.0.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f588f037bba6929bdbb0f70c2f8753c803952c24560db888814137dd2ed390 |
|
MD5 | ce456598127e8426954297ccebdad925 |
|
BLAKE2b-256 | 76ea4fe7c3e16214519d266127f1dcd7d4fdafc9a73bf1f9ed846af6f252e696 |
Hashes for pylibrb-0.0.6-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 923ce827a04dac1702b4a4c5e62913643ef65725393aae32a06ce366ffb7bebe |
|
MD5 | d041db873f8151e3c10f285b89eba228 |
|
BLAKE2b-256 | 2cb0eb1c922d64d438b8d71caa3ae1cba7e76111905fe401dd2ea0bc8112222d |
Hashes for pylibrb-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b484033ed98848e7890ae4e1ba907de73ec5a9e12ce5c72a8e6cd300159949ab |
|
MD5 | 2496cda387ae23bc8cfeab6924d7e5cb |
|
BLAKE2b-256 | 563d3c579d7151652c47d129eb96fec8d09edc650a9ccea6b865ab179d94bcc2 |
Hashes for pylibrb-0.0.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaecd534e3026df50778bd09084fa3e32aa5a4493cee1750da211ff367e02858 |
|
MD5 | 5903eb8451a7467d07d3708968f25041 |
|
BLAKE2b-256 | 8d0e0e7a221dbe494c24cdf634ccaf6e9d996853063c75651bf6509bf68a7f38 |
Hashes for pylibrb-0.0.6-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e0d80a9f7df0d4b8689b955a7e2c6e9313ff2e2e0cf8e5467b06389572acca4 |
|
MD5 | 03ca05ab0354514a6bd012bd8055a812 |
|
BLAKE2b-256 | e6ad7015a5a6964c9716c37081f22c4b1823cfc5ca0cc30144cc095ae0359547 |
Hashes for pylibrb-0.0.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c58978166efda73b632f1a0def49d58953f9e902ab8cfd218bdc9835c245cb17 |
|
MD5 | 5e88078c3163f690440542d16960e8fd |
|
BLAKE2b-256 | 45c32da427b661a23ef4fbc51d5b5d74b1e8b1f36c7335d136113c35c53ff20b |
Hashes for pylibrb-0.0.6-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d7232984367fab21bd7f66f39242c1f223cc52a4940cb9eac6cdd72e2c58ecb |
|
MD5 | 70e6ef91d1705c665a1444d073ff0c57 |
|
BLAKE2b-256 | 241c38a3bd7b06b7436cf80c65e5df6074d977f5d8aa268fb0b46194e91e54d1 |
Hashes for pylibrb-0.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfa5b14ff1aff0ab0a9dda243e4b3f9e14332e9b7d6d94dc4f04822975421151 |
|
MD5 | 98b28d62686a76c0526a467165d36a36 |
|
BLAKE2b-256 | baf18dd52c112cee19b8806d5c3456319ac95c9b8dbbc0802eccfde5b476600d |
Hashes for pylibrb-0.0.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b686b965f8ee15c15607cf8ad94b0226a1c71b381bd94eaf079e4cdd3b45594c |
|
MD5 | cad2bc0c08bdd00d06941a0dfe3ef155 |
|
BLAKE2b-256 | c8d1272bafde7be27c20da3a4e7de2bcdfadd5e4dfa1e8e5d2a8cb5707ecb4fa |
Hashes for pylibrb-0.0.6-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd5de2a27a30c4381475c0014812d0250ea78267b4c5f09b98b022f4a282faa |
|
MD5 | 71aa10f279327516d6ad5c399f67f49f |
|
BLAKE2b-256 | b2b1c4569c777ebf2ba01ad98d9ebb67449c95e2c92313d3ef82983019163a5f |
Hashes for pylibrb-0.0.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 978d3faec775d5c1e49f6d4045f266a7b6bb7c85bd5cf1379071c2dbb1f4c2b9 |
|
MD5 | 315b0f64ad266ad86ff0fe8632cdc890 |
|
BLAKE2b-256 | 072668548c87367a316bed15efcbe6ac79596c8c3b3f41806d2783ff64c719b3 |
Hashes for pylibrb-0.0.6-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b05a9dcedd330a9b10bfb8df80c5aa23ab748d4f2d7c687531d700f09c8ca9b |
|
MD5 | e19a3cd87ac3b238205befe566fa072a |
|
BLAKE2b-256 | 9ee09fda50313e0ae250c1c41b9389cd3555be8a26b435a6a4002c2db37dc7a4 |
Hashes for pylibrb-0.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61639037b5b8f6f18035450688ab7e29ea24aa0737f0948e8eaf4faa7f11e0bd |
|
MD5 | f6be2cdb8eb8b6c78c35c4fbcb4c9223 |
|
BLAKE2b-256 | e6616de0f9c3c9aeb2d3aba05a04b8e5808ae77a8d013a45bce696103c75c002 |
Hashes for pylibrb-0.0.6-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2cf984dd932232e54610c7a4d7dec27a01e4aba0f6c07f531ec195309538797 |
|
MD5 | ab50da905e70a6507e5837c1b8194237 |
|
BLAKE2b-256 | 842d249e1eb724f957e18c22e363495b695265ec4cc9249a1bd30eb9ef14f9aa |
Hashes for pylibrb-0.0.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08af01d4982f404baa3819ceaa7bd5762f25a860c2f1383893afc21907f4119b |
|
MD5 | 598bc5685bedf2880873f18d13bc549d |
|
BLAKE2b-256 | fefdc32033c847f9848c2ca849b60c32831a2e3a18037b8ff52f2f1b2a400d00 |