Rust audio api binding for python
Project description
rpaudio
rpaudio
is a Rust-based Python library for handling audio operations, designed to provide simple and efficient audio management. It leverages Rust's performance and concurrency safety to offer a robust solution for Python audio applications.
API
- AudioSink: Simple audio access and control for individual files.
- AudioChannel: Handle and process audio files in a queue via channels.
- ChannelManager: Multi-channel grouping and management.
- AudioSink.metadata Access information about audio files if present.
- Effects : FadeIn, FadeOut, ChangeSpeed
Supports: MP3, WAV, Vorbis and Flac (mp4 + AAC will also be supported in a future release)
Python 3.8+
Getting Started (Read the Docs)
import rpaudio
import asyncio
from rpaudio import FadeIn, FadeOut, ChangeSpeed
kill_audio = False
AUDIO_FILE = r"C:\Users\16145\Desktop\code_24\frpaudio\rpaudio\examples\ex.wav"
def on_audio_stop():
global kill_audio
kill_audio = True
print("Audio has stopped")
async def play_audio():
handler = rpaudio.AudioSink(callback=on_audio_stop).load_audio(AUDIO_FILE)
print(handler.metadata)
fade_in_effect = FadeIn(start_val=0.0, end_val=1.0, duration=3.0)
fade_out_effect = FadeOut(duration=2.0)
speed_up = ChangeSpeed(apply_after=1.0, end_val=0.8, duration=3.0)
effects_list = [fade_in_effect, fade_out_effect, speed_up]
handler.apply_effects(effects_list)
handler.play()
while not kill_audio:
await asyncio.sleep(1)
async def sleep_loop():
global kill_audio
i = 0
while not kill_audio:
await asyncio.sleep(1)
i += 1
async def main():
await asyncio.gather(play_audio(), sleep_loop())
asyncio.run(main())
OS Dependency Installation Instructions
Windows
No additional OS-level dependencies are required for rpaudio
on Windows. Ensure you have the latest version of Python installed, and you can directly use pip
to install the library:
pip install rpaudio
macOS
To install rpaudio
on macOS, you need to install gettext
:
Install gettext
:
brew install gettext
brew link gettext --force
Linux
To install rpaudio
on Linux, you may need to install some dependencies based on your distribution:
For Debian/Ubuntu-based distributions:
sudo apt-get update
sudo apt-get install -y pkg-config libasound2-dev
For Red Hat/CentOS-based distributions:
sudo yum install -y pkg-config alsa-lib-devel
After installing the necessary OS-level dependencies, you can install rpaudio
using pip
:
pip install rpaudio
Contributing
Please read CONTRIBUTING.md for guidelines on how to contribute.
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 Distributions
Built Distributions
Hashes for rpaudio-0.0.7-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ace4d2cef36d7ec8396c90430b62f6e8f0609223374260b1a69894b669f8ebe |
|
MD5 | b4725416236f69b396c78cbcb4e2c4ba |
|
BLAKE2b-256 | 21640e7e92cc60cd4f1e63941488f5c97a0fbf1e4c8e297b97c8013f4fe6a959 |
Hashes for rpaudio-0.0.7-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7a1384b005b18350097610e4a468bb6e4ca87329cf7a31fabe82ea4fc272c5b |
|
MD5 | 8a26ce0f3527a863b52317856bfc30aa |
|
BLAKE2b-256 | 2c99f640ccb9e3643715ad657a3fd2c53e4f7db26559dc2abcf548971c1bbefb |
Hashes for rpaudio-0.0.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83d63c2a649b98c8dc2c7a8de961db9f669de6877bbd167f6af42c385d68a6bc |
|
MD5 | 1f1e7bc9cf2827d5ed510402711efd2e |
|
BLAKE2b-256 | d459ca6a42cc5c63628c81494ac332b9c1fe0c0c0193b123c01450e6b3223134 |
Hashes for rpaudio-0.0.7-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e379e628c6e0e3f6b38dafad4a8815294e6b41522753a4c0a794b3a8ee16004 |
|
MD5 | 7a81cb9d865b85a2b6e54c0a64ad4370 |
|
BLAKE2b-256 | 403f4d55052c971ed80b82a7f3346322a30f5d99a72e114ce98205b5d24f1238 |
Hashes for rpaudio-0.0.7-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 203b849e7cba00f157c02cceb91d07e1f57e77ec0f8782f889977e940c2a7e1e |
|
MD5 | ef9222e8193a2161da83ba0c1ed26c35 |
|
BLAKE2b-256 | 2f8f0f7d27c2a20d9377fd442ddc3d1675a963c77a02465411ec033e2a4dc5a8 |
Hashes for rpaudio-0.0.7-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 275cacde72f73f9523e48989a0f2a9bb0a010a2dda0bf458242f23e340fb27f6 |
|
MD5 | 1a246fe69513acd6a2cde979b9117ce2 |
|
BLAKE2b-256 | e741e7eca5b0fd36ab6f1d5a57bc6e10857ff460beb6cbe1cb821cd27082427f |