Skip to main content

Python bindings for the Bungee time/pitch stretching library

Project description

Bungee Python Bindings

当前版本 Version: 0.2.0

🆕 0.2.0 更新日志 / Changelog:

  • 修复了上一版本的初始延迟导致的结果偏移的问题。
  • Fixed the initial latency/offset issue in previous versions.
  • 建议所有用户升级到 0.2.0 版本。

PyPI version License: MPL 2.0

该项目提供了 Bungee C++ 库的 Python 绑定,允许您在 Python 中轻松实现高质量的实时音频时间拉伸和变调。

This project provides Python bindings for the Bungee C++ library, enabling high-quality real-time audio time-stretching and pitch-shifting in Python.


特性 Features

  • 高质量的音频时间拉伸和变调
    High-quality audio time-stretching and pitch-shifting
  • 支持实时处理,低延迟
    Real-time processing with low latency
  • 允许连续改变播放速度和音高,支持平滑搓碟和变速播放
    Continuous speed/pitch change, smooth scratching, and variable playback
  • 基于频域相位声码器算法
    Frequency-domain phase vocoder algorithm
  • 使用现代 C++ 编写,代码清晰健壮
    Modern C++ implementation, robust and clean code
  • 采用 MPL-2.0 宽松许可证
    Licensed under MPL-2.0

安装 Installation

您可以通过 pip 从 PyPI 安装 bungee-python:

You can install bungee-python from PyPI via pip:

pip install bungee-python

使用示例 Example

下面是一个简单的示例,演示如何使用 bungee-python 将音频速度减慢一半:

Here is a simple example showing how to slow down audio by half using bungee-python:

import numpy as np
from bungee_python import bungee

sample_rate = 44100
channels = 1
duration_seconds = 5
frequency = 440

t = np.linspace(0., duration_seconds, int(sample_rate * duration_seconds))
input_audio = 0.5 * np.sin(2. * np.pi * frequency * t)
input_audio = input_audio.astype(np.float32)
input_audio = input_audio[:, np.newaxis]  # (frames, channels)

stretcher = bungee.Bungee(sample_rate=sample_rate, channels=channels)
stretcher.set_speed(0.5)  # 慢放 slow down
stretcher.set_pitch(1.0)  # 音高不变 keep pitch

output_audio = stretcher.process(input_audio)
print(f"Output shape: {output_audio.shape}")

从源码构建 Build from Source

  1. 克隆仓库 (包括子模块) / Clone repository (with submodules):

    git clone --recurse-submodules https://github.com/longredzhong/bungee-python.git
    cd bungee-python
    
  2. 安装构建依赖 / Install build dependencies:

    • C++ 编译器 (支持 C++17) / C++17 compiler
    • CMake (>= 3.15)
    • Ninja (推荐 recommended)
    • Python (>= 3.8) 和开发头文件 / Python dev headers
  3. 运行构建脚本 / Run build script:

    ./scripts/build.sh
    

    编译后的 Python 扩展模块会位于 build 目录中。
    The built Python extension module will be in the build directory.

  4. 安装或测试 / Install or test:

    可以用 pip install . 在本地安装。
    You can install locally with pip install ..


依赖 Dependencies

  • 运行时 Runtime:
    • Python (>= 3.8)
    • NumPy
  • 构建时 Build:
    • bungee-core (as submodule)
      • Eigen
      • KissFFT
    • pybind11 (as submodule)
    • CMake (>= 3.15)
    • C++17 compiler
    • Ninja (optional)

许可证 License

本项目采用 MPL-2.0 许可证,与 bungee-core 保持一致。
This project is licensed under MPL-2.0, same as bungee-core.


致谢 Acknowledgements


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

bungee_python-0.2.1.tar.gz (4.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bungee_python-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (368.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bungee_python-0.2.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (394.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

bungee_python-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bungee_python-0.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (393.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

bungee_python-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (368.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bungee_python-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (393.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

bungee_python-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bungee_python-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (392.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686

bungee_python-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bungee_python-0.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (393.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686

File details

Details for the file bungee_python-0.2.1.tar.gz.

File metadata

  • Download URL: bungee_python-0.2.1.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bungee_python-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b3521438e08c2b7e979d95f3e76cee27a4691fb4bf2a2bb2d7855d7cd2f212d1
MD5 1231f9ce8874efaa4751f227cd2b45e6
BLAKE2b-256 1b9b371ca111873f624596d5f6a6672bd84cb43603558ce775d353aaecb73e71

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1.tar.gz:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce90d767886d0a3d0ccd571f16e356363666f51ffe8082c18f03eec7a2f0d289
MD5 7815d8ad36c67ecfe504f2d2264ab09f
BLAKE2b-256 5243735a6647bd1bca3b4c40c1b080e692fae80d04274adea01c342d73462786

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a02e18e33d028045a84b0559bd42f434432a2887eca1dab51dd6318afbe7f9dc
MD5 ea60e6e1b0416945a33c8cc9d0f74eb5
BLAKE2b-256 323d73d5f571406324c517bda8181ab1f0579302b082b5b6fcc872228d5e325a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45a14db4537e1f4e5f03a6078f0aa4a2eb911138e6ea265b37b24b7f8cc4a4a7
MD5 5f52091e686065870d71a71a5485d93f
BLAKE2b-256 aa60027b03cb4782308481d74605e3af239f3daf03323467d9b169cb4dd55be6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5d50ec7c54aa56a5ed5c93d591e01a21c727c25f4e32971f50c1132b74df0e97
MD5 e9eb1eba3d23d622889e40d9e2c8fa14
BLAKE2b-256 f9d162fca2a742efa382e161bb8d34aa7d06299cd2c624c647123b48fdea9ec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92e0d75210a9af16a95d6ae5b3aa33a1c1fdc21008e2ddb960967663ca5ec24c
MD5 73955d46537f7bab8de6131e4c91adf8
BLAKE2b-256 bf18d30ea627fdcfdcd57328967ccff50e41a7290607663d15c203626d3162f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6a7b0781505ae7b445cd395c74cca5ff016a62a5a05f762d74b3ac07e8d7291d
MD5 9f74212133ba29be35801f7d83c7490a
BLAKE2b-256 c8666fa3dcb6b2e19e36c237b11d4c88567f9c229ef1c2655ece9ff71b60689f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 205ac5e6b5d25eec71aa940fb801021f209e8613e4bcb884840eedb1e6a01b5e
MD5 df95a1be0bae898debb4bad43f20b254
BLAKE2b-256 3d75d102d1a1777c4971022a9a96f32412aeb7f5ec132912470b3fae58bc25d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e63a6c1cf98820d58c6fb5a61ef5335488d5f9a9232bd1533317c209b5662104
MD5 c21e16f8e2a1277fc8f990f534bbdff6
BLAKE2b-256 713de3cdb4bb3bd64941280264cab5cb83d06cf527895ac884485b591120fc38

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 757adb504bd08e7f2a68f71833156b772e0dff91f9e5371d0aa1c4f15d57644b
MD5 b137c6c81fd3abfa69fd17c19a60f276
BLAKE2b-256 4b24bf946736fe2c4e040afa1f67d2f757d37b683715b412fc0e2597dcb23684

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bungee_python-0.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bungee_python-0.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c9673af819c6940707278cdbff0cc1aa5ab59794d65b1991c7cc2477747765dd
MD5 d2ddd1d7b2dde2de476edf2243bc916a
BLAKE2b-256 7c0920d6763dbe2b0b57476634469b15f08bb1261914e3ae3bfe9220e6fcfe95

See more details on using hashes here.

Provenance

The following attestation bundles were made for bungee_python-0.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python-publish.yml on longredzhong/bungee-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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