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.9-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c566238487f10ec867bd685008ebca012e13efa82ce5078c7d076ca65a1123d |
|
MD5 | 9a3b8d5fcf27130cab832926cf844e6e |
|
BLAKE2b-256 | 56b0489d8c0522f35865bb1bcd7241ae71830656f52996b2e9fa1b00bbc2a21d |
Hashes for rpaudio-0.0.9-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f0f384b141414fb0450d232442e69ca0d9b6284f868637d8063e1191fcb915 |
|
MD5 | 0bd37a8b1de5d1d16a8a93af607bdbbc |
|
BLAKE2b-256 | 047369420f54fb1db95ae6a9ea2a0cca509bb7bab7123d9a1a68b4ee269ea095 |
Hashes for rpaudio-0.0.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3513577f16381ed736389d63a530b33ef149a5961a76e1cc04061b48d58a5790 |
|
MD5 | a3c2335a039c6786229422ecf6b0e201 |
|
BLAKE2b-256 | 6de2140a74fbb0c3c58c80e404e56016e7ba40cd0ad14da190120eb45aa5a152 |
Hashes for rpaudio-0.0.9-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d3dc12b1d552b1bf37d1497164ccbbfcb2b5247248e16ebf4b7b8f9bb112022 |
|
MD5 | fc1bfef254b43a89f8caee236e48a8dd |
|
BLAKE2b-256 | adf5c88f7cbe2042f3367e9210b928799c5be42c754eb775c1ace1389308c702 |
Hashes for rpaudio-0.0.9-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 280d4fbae7a8612856a7a30ca907c1b37794422966c704246a2e86ed774605f5 |
|
MD5 | 1ec1f53615f483cb4c5c0840fb1b46f0 |
|
BLAKE2b-256 | a5ff7d3e6d67a00269bbf72099b4a119d12758218652e11af85bed5a08c3c38e |
Hashes for rpaudio-0.0.9-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a687b368f18cac98a18b5a4f7a443e1b18c01ed45bcd7a4c0d65909a7962c468 |
|
MD5 | 596d253c8a6d47a85c5f59687ddd7174 |
|
BLAKE2b-256 | 313c148fdfc495a23ab340d785ec2abddb034728c94b2a843ef4223ca0926e2a |