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.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 988f50f54d81dbcb4a6e7f392ac5fb7a89867626caf11065e9d9704c60846684 |
|
MD5 | ee72292788a48a0a9065d6f4db859d91 |
|
BLAKE2b-256 | 26ea6d287ed388767ffa0882b531f9f823775138eeeb9f6c7b9729077036468d |
Hashes for pylibrb-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bfd0abc0ed583f6008ad4ec5a9e884052fd0063e79497309b79f4a0c3399049 |
|
MD5 | 59e91d31b3b2ab22f0a83f85998b61ad |
|
BLAKE2b-256 | eda093ca4c201b45fcf84cdbe1e7dbda55faafaa8173787d4dea027a2c6b53f4 |
Hashes for pylibrb-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5afbcd59257e924c05422810ca01918fcefd4c7e2459eb198ef1f499bf2f2f24 |
|
MD5 | 64a68f1272b1f288d34f7a1c8cf76a6c |
|
BLAKE2b-256 | 425940bd3579aba9745219d1163c5de0a331089471e2854e8e9ed480da69afc1 |
Hashes for pylibrb-0.1.1-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271e4c6f2fa47d882110fdc0bb019745514b2274a125cb2eecbbd3325128cfb0 |
|
MD5 | 7b5e1a0e0ace157b60dd43910c7b5e8f |
|
BLAKE2b-256 | aed964477cb2b78745cd09f6e676e8ce267119557074bbf7104a424057144d60 |
Hashes for pylibrb-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf59892bad327522093be624505d97f69a8bc29314042316767f5b61180bb35 |
|
MD5 | c64f67b79e4d0168f627405d57ceaedc |
|
BLAKE2b-256 | 05fc52f32dbeac2f558518bdb0f5e120abc3f22a12c97e488e56be7bc450e468 |
Hashes for pylibrb-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7c556a4f31ce547d9a0bf6110d0485967d727f1e3f4e31cfaff5b31e82f767f |
|
MD5 | cbebb81671ad350d37844e8b8b118773 |
|
BLAKE2b-256 | 9edeb6e39d574e544bcae1bfbdccbf23279a13c27414c572fbf2719bd0bba29c |
Hashes for pylibrb-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8418096bd01bcf525606231a3e51412bbf98c584ee78cf83acb4252aab31937 |
|
MD5 | 752ce2895230cd5d1b34bbeea4de64f3 |
|
BLAKE2b-256 | f2207af54d3168164162a78197f14e0813655ceda3f9724965d5a38cda8e3f45 |
Hashes for pylibrb-0.1.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a014ed7842cff84ab29f52cabdcfc26cba42036aac6b85b4279409a33b4c54be |
|
MD5 | 7afbf8d6dc31bb49e50592e632e02e52 |
|
BLAKE2b-256 | a133a883869cb58393be127607fc1f7e1c4a38a0815ceeb34e22f38ff71cbfb5 |
Hashes for pylibrb-0.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eaa9bcf09d22d6af13bfd9de335746d5fdf8e8a9711680e2e3700f33e02b2ae |
|
MD5 | 0b616f47ea29f0a8c0bc55280293ad38 |
|
BLAKE2b-256 | a9b95e82fd58dde9297508cd291bffdb20b2756ec224dcdaecd8c3a6686270c6 |
Hashes for pylibrb-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63c0c7c19d2ddef14b313af4e495428984362ef87dd7c992bfce44af126fa5c3 |
|
MD5 | 4a8d2bdab754d34cc52dcae341a6ce06 |
|
BLAKE2b-256 | 6411071dfaca46627fbb32bd5f0ca75a324f5755f5f6450b64f7c9260b2875e7 |
Hashes for pylibrb-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69af4a748f758fd4a28bf4142f300f269622f0df0c64eed5c98febc0de054d08 |
|
MD5 | 658a78f56ecc77ecf326c80d9b3c9db3 |
|
BLAKE2b-256 | d7c13b1d1c58cac543f2f2c256e4fb650b2dbf2f6ef015be7146b99e1e265daf |
Hashes for pylibrb-0.1.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93668f2b394a32fd2219469977aa855bec6a7226c6ba96b00486b3792b0dc9d8 |
|
MD5 | a84ddd8de89810a5498fbaa182b9e3e0 |
|
BLAKE2b-256 | 69792d6197aeec0c452af9ef9048608fed750ed61dd175a03ed3b10b00c8984f |
Hashes for pylibrb-0.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1cfd2acd6157ed1cb1773f7077d080114498edfc6e7239c9b1cd2d3b919e0a6 |
|
MD5 | 7adea26faffb2b511b4832edee6255ff |
|
BLAKE2b-256 | 23b76248826afa2ed0dcea808ed7588bde64e7a21f5dfeb235135549285a8fe9 |
Hashes for pylibrb-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f15c673b6c2d107a12646a50a7919a37ad3ce5d4518399fb7d4562961fe51ecd |
|
MD5 | 5d4b7d4b547edb0c31e316633e095a28 |
|
BLAKE2b-256 | fcd5e5b49c686142757076118f9f76c3b32ee9033f04abc6656d44b71ed6dbff |
Hashes for pylibrb-0.1.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 550dc3a45ec6023d3797ca6d7a4868da2f55a4b4294a1587991fdc6dfc5890ce |
|
MD5 | 3866a30212aa78175b390eb83ec8decf |
|
BLAKE2b-256 | a18aa5ac450f8a7708ef851fb55e99022d1bb944e452e27a8eed54185b71803b |
Hashes for pylibrb-0.1.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98244daef3c4f944869a093ace940318b3b64cdbc2e545c3cb833f43f8333348 |
|
MD5 | 7923ab087b0c7bcb356e28ab8ec4ff91 |
|
BLAKE2b-256 | 4be20af6db80b45ae8dab1f97ae55f6f2bae4b2b63df3c14a4589660923fb2c9 |