Skip to main content

Python bindings for the RubberBand library

Project description

pylibrb

tests

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
  • not using (magic) numbers to represent the state

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylibrb-0.0.2.tar.gz (21.9 kB view hashes)

Uploaded Source

Built Distributions

pylibrb-0.0.2-pp39-pypy39_pp73-win_amd64.whl (411.1 kB view hashes)

Uploaded PyPy Windows x86-64

pylibrb-0.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (526.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pylibrb-0.0.2-pp39-pypy39_pp73-macosx_10_14_x86_64.whl (437.1 kB view hashes)

Uploaded PyPy macOS 10.14+ x86-64

pylibrb-0.0.2-cp311-cp311-win_amd64.whl (211.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pylibrb-0.0.2-cp311-cp311-musllinux_1_1_x86_64.whl (790.1 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pylibrb-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (270.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pylibrb-0.0.2-cp311-cp311-macosx_11_0_arm64.whl (204.7 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pylibrb-0.0.2-cp311-cp311-macosx_10_14_x86_64.whl (225.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.14+ x86-64

pylibrb-0.0.2-cp310-cp310-win_amd64.whl (211.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pylibrb-0.0.2-cp310-cp310-musllinux_1_1_x86_64.whl (790.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pylibrb-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (270.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pylibrb-0.0.2-cp310-cp310-macosx_11_0_arm64.whl (204.9 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pylibrb-0.0.2-cp310-cp310-macosx_10_14_x86_64.whl (225.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.14+ x86-64

pylibrb-0.0.2-cp39-cp39-win_amd64.whl (211.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pylibrb-0.0.2-cp39-cp39-musllinux_1_1_x86_64.whl (790.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pylibrb-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (270.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pylibrb-0.0.2-cp39-cp39-macosx_11_0_arm64.whl (204.9 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pylibrb-0.0.2-cp39-cp39-macosx_10_14_x86_64.whl (225.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pylibrb-0.0.2-cp38-cp38-win_amd64.whl (212.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pylibrb-0.0.2-cp38-cp38-musllinux_1_1_x86_64.whl (790.3 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pylibrb-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (270.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pylibrb-0.0.2-cp38-cp38-macosx_11_0_arm64.whl (204.4 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pylibrb-0.0.2-cp38-cp38-macosx_10_14_x86_64.whl (225.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page