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 tool (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
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_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.1.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede726ace1753278259b3f58272407b7974e5eea7c4daa9acc66f4af4590478f |
|
MD5 | 5e33e9fe0781e7ea48994429ac0e4150 |
|
BLAKE2b-256 | adb1c48045bfa872c7ea67716b30dfbb50abeda3a080ed4fa6dc8f7d146f55b6 |
Hashes for pylibrb-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dca9db16deacb614f97d455ced40d07e747ad625e084c8fa7bb0106e79035f79 |
|
MD5 | c04b5495eaa74c9d6daef3c5b0a919db |
|
BLAKE2b-256 | cd170e3cb5211c47f77b05fd841731e67f0d2c27f638b8dabb3ebeb1e9b9f868 |
Hashes for pylibrb-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a0e428cbdefde4b4769eaeeaa6425289343b9ffa5ec4f5e28c4d62f249c13f |
|
MD5 | 66e40bb0d2f703d0320ca13d53c2b77e |
|
BLAKE2b-256 | 2e73660efb2d93a21cc9d623f32e8b068c820f7d81c388257aef0a5fc246a09f |
Hashes for pylibrb-0.1.0-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ae0f99b395c9ca5e223b78cf6c9837ed009383a5984c9751716acd5413ac0b1 |
|
MD5 | 84a4c0cf35a1315b9cbff5e8ff0d5aa6 |
|
BLAKE2b-256 | c0797a33d479000f8c7599b1b6d732094cf0a87d44e2c88cd5b3db5ce1130352 |
Hashes for pylibrb-0.1.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aaf2e372664f9ac760849ad0c8d00e039c0f12e3632cac855711ff376ef5159 |
|
MD5 | ece3c3a9dc6613a050d332bed1c97a41 |
|
BLAKE2b-256 | cbc284b590e92f005eeaf3bd51220e2ab6d187b2a1f8a1359e5fc0cb062bf498 |
Hashes for pylibrb-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a64dab453a4ea37b04d6a08b0c60ac6efa1e195c1bee0541677e3c96de46ac4b |
|
MD5 | 71439f4af611ea05459b79ac3758a35c |
|
BLAKE2b-256 | 4b2aafd5546cd225209109dd35e6b656318994f99dd94b413c77664e9d580b03 |
Hashes for pylibrb-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f37678be5efb54c2d54916691f95afb4fd2731301b9b396211f9b044c83aaa63 |
|
MD5 | e39749e943480b3855b2554766a32bdf |
|
BLAKE2b-256 | 6cac499dcbabd4f9f0f5b8a06c39cc1eabe26b732a85279b3777f7635544c72b |
Hashes for pylibrb-0.1.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | babbf44769d83fbea309dd53b5b48fb6b7b28ba181c7b73abb2afd24bdfc70ff |
|
MD5 | 0be2e7a1887a2fd1ed241a7864f0d53e |
|
BLAKE2b-256 | 81699076d47b1f2ecaeab129741872f91100955dc3df7b88532efe02f4d2a8f5 |
Hashes for pylibrb-0.1.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49444ccdf39382df1c22a552d489c9827b12e69919c7173f054cc318c430345 |
|
MD5 | d9a4f94a5614ede84d6433c43312057c |
|
BLAKE2b-256 | d223d56e0efa1a39f38385fb7a8bf897bcb7ad40a4b966a9d02f35d5f8436e3a |
Hashes for pylibrb-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800924f00b31f3b4c818a9a12eda47bb86aa598059a5a7a372fd19568238fe1b |
|
MD5 | 2fd4c4a940b57ad0b4a913934503a68b |
|
BLAKE2b-256 | 33ac77d7b00d405e272916a63795ce18989f87a9b9eb311b7d070490b96384a5 |
Hashes for pylibrb-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16063b586805f6ce79bf91e1e684ccc34850248b6a16c089000ee9800249cf5 |
|
MD5 | 27f498c010c50a5b73c89fcfab12071d |
|
BLAKE2b-256 | 5e471e2746e864395b5ef8fada6f3db28f30775d856418e3e3909181bff59de6 |
Hashes for pylibrb-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f614169737f5fe7896d90c642de72156f6b1b8c690d01a6e16e964bdea7b8f24 |
|
MD5 | 440b92248ae1438e4b20352d2e9d8d5c |
|
BLAKE2b-256 | 262b652211455b2dad17227913f53e5de80a86460d18d1c426c12566ea639fbb |
Hashes for pylibrb-0.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8182cf14d16460a6f7f6bef86be99d841f5e65f37d9d0c23e8f79b8faff5824e |
|
MD5 | 2fcf25450fad2bb1fc5cf3c612a8bb43 |
|
BLAKE2b-256 | 5f2854fc134e32bd1989c58d6ea1feaed4bac8295965ed254d4c9b39b55ce8ac |
Hashes for pylibrb-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 976a075380495d6a339937333843838f4618a037f643accdf5284b5ea386cfaf |
|
MD5 | 8653d88a25ec20dd302371a0170dc577 |
|
BLAKE2b-256 | e25fb47a1000aae30cee2728849745feca35def735fcb7e74918a1102acd87e9 |
Hashes for pylibrb-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44f8f2cac04f16b50dcc42add45c7d7932d8d7e6678be599965b944a93517d6a |
|
MD5 | 665abb43a13191f5a0fe73a4acfb0ade |
|
BLAKE2b-256 | 42878f49279e8c765fc201894f9b2ae473dde47ef408796daf0510ef287cf5bd |
Hashes for pylibrb-0.1.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2cf1b530ebb569cd0221627c826f00f64e07c52ab98c13007610a07209e06c0 |
|
MD5 | 38676c66dde731a43cb6eb4eda66a576 |
|
BLAKE2b-256 | bafc4807c51d421cca8302d00ef15dbcf46958476617e751ff1d3e625ab1b4ed |