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.11-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d75f13e35d1bdb54c182057f8eff95c02c4643a37e125d876105201500d33a7 |
|
MD5 | d8111c0b79e82b93642b64e506b7837c |
|
BLAKE2b-256 | 7e6e30e9fe46f4471c953981765cc62555336b15627d879c076a1d670c3a371c |
Hashes for rpaudio-0.0.11-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a39316d90ddb8926749d8be6df73e5ea497b6b5b355939b348e32bd0c091fd |
|
MD5 | 7019575d8edf4016c71ed50881a88202 |
|
BLAKE2b-256 | 508d0a287d6f2a42de073d2f663128fddae36f7d1860b9cc40952d8814193758 |
Hashes for rpaudio-0.0.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b894ee9ec11d6d4bc826bab4cbcb6bff149a120b642d2709d93799dd7d6198 |
|
MD5 | 482b4cd636a95527523b37337c02c763 |
|
BLAKE2b-256 | 08a9907a3f04ee88b048b6bccfc14f508d297a4cfcc72dfa24e63eb128cc4d97 |
Hashes for rpaudio-0.0.11-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebc52a32e4694f83bcf8fc8e7ea6d3240cfbfe2af2c8e725379932bff03314bf |
|
MD5 | 19b2c41a6bff2f84219092c0466ce82e |
|
BLAKE2b-256 | 5dda0109e4e2f888ce8c66f94b50fc0501ff1db309e25ec0a017391494b22d2a |
Hashes for rpaudio-0.0.11-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 449477b7046e18902f4473e661f0da605734951f3be8a5b8ca85158a5ccc3590 |
|
MD5 | 23227449adb8c13f496ff2acdf21784e |
|
BLAKE2b-256 | f1850fb419f461d7191ce207a32f2a812a08c8aa4f3f2b797b1d4342daa958e6 |
Hashes for rpaudio-0.0.11-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50faef453b486d3b5146b9929868abcd457e624d64536d54b9fc90cf5479dcc0 |
|
MD5 | 5fbca63ada19ff70fe4fa9200958e1a9 |
|
BLAKE2b-256 | b56b446d5f8205c20e2c8341933d631be5dc150c5ffe59ced5fcf4133fb69c34 |