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.10-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ca3e0efe33b7471bb78f6eaa32966ff37664cf078c572462b745c93d89ef004 |
|
MD5 | 5998e38fa412fbc0e20c5f0496ea31fc |
|
BLAKE2b-256 | 808e322e13bfa2fb6f9c8aa7312191e45c71ce06a461546082047e27bf5c8128 |
Hashes for rpaudio-0.0.10-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8201066b3b381fc6747f0c385775fa9d3cb8896010171bab862a8ed9d0275b |
|
MD5 | 894d9d6dc00f5023c70fe989332e9a9d |
|
BLAKE2b-256 | 907180a3f44e4eb0a2cc88b9f14427f3b9edc3c759e38099e0bfe47a7aaf74c5 |
Hashes for rpaudio-0.0.10-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4b5874224442d513b0dd21b4846889e942ead2cf8b434b358630771559f0f9c |
|
MD5 | 6ced31273523cab6644bb763f30abf1a |
|
BLAKE2b-256 | 18dea493e8ca88d307dd95c8792fee7de1a16a1823b0b9f85d267dd62a384232 |
Hashes for rpaudio-0.0.10-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee151d26bbd02479741485b0b2ab8084563356068709ed4ed4f6773a594f8b17 |
|
MD5 | 113d91fb52b7492ef57612b42eb91f17 |
|
BLAKE2b-256 | 4fc0b4433f3f315d4609548af63897d65aa857ded4f09bc0bf0dca6a58cd1b20 |
Hashes for rpaudio-0.0.10-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25ea7fe2d3ff03ace054466b8c6955c93b6cebe3b9145117b4744edadff40412 |
|
MD5 | 97921825b2a10e89f6202e7e46c634dd |
|
BLAKE2b-256 | 7337f04dccf39e88b24e5d148ce698d9f3b8820a4cd7fa4774ec0a3da4191beb |
Hashes for rpaudio-0.0.10-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24ef3eb1f1e6ad73c49e5af7165252309a26d3fece8d91235b9c767e8a7607fe |
|
MD5 | c1d5c73a7a89d3727f62ffc6dc3bdaad |
|
BLAKE2b-256 | 8dc96a334d93129c5c071cb70a60e892ec34e285afb9d90d18a746812a061fc1 |