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+
Example Projects
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.12-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 876d49e6ae208b643cc3c0df46b903e68bfcb4c7c985f44e3f4fe727497af4ae |
|
MD5 | c83fb1cfb4b84dba006fc6b3d74af936 |
|
BLAKE2b-256 | 9ad31dafdb453e13be0d68fa45182a1204ab12ecc3a1da70fb4c51fa48a195f5 |
Hashes for rpaudio-0.0.12-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c4c9d46c9e6557870797b44824604ad7060c1b18eab712a2d2890bd842cdb3f |
|
MD5 | 511ca635601b5866534396860b685813 |
|
BLAKE2b-256 | b2552801f1e38da905d5ff77c54bc2af15a845d5ac18f169ecc0523a8bfe6cf6 |
Hashes for rpaudio-0.0.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4676fdad5b6cfe6ae9cd4ee32cfa53feb423243e730709f237dde5e8b494a8f |
|
MD5 | 8bfaaa07cd45ac63a556ed5976a529cf |
|
BLAKE2b-256 | ddcdbc8c79da36cf6c892388fac43ebfe8e2d017365efc3f44d8d600d691b868 |
Hashes for rpaudio-0.0.12-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28370117ac3da3a7d2fbbf7871ec057d2e36e32553ad64503a864a228641aebe |
|
MD5 | e5944912fe1cb67f9cccfa678b1fb559 |
|
BLAKE2b-256 | b0821108ca14c377669d4cc9f1ccbe2fd39ee25dd0ee343d51537d53ef593382 |
Hashes for rpaudio-0.0.12-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf2b62c3ed511ec87ed7d0480bb1e62b84efe6b617292e35ea70df2a1ccf09a |
|
MD5 | e0242b8c5d3caba4f091a87159dbca44 |
|
BLAKE2b-256 | c3e1f80626f2ec2112f0c118f303e67d84e6e918cc94d82e7b056f142a021dd5 |
Hashes for rpaudio-0.0.12-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776a573e30acc1eb14393322f2beeb31ec561b048d19991131ab95698e0339cb |
|
MD5 | f28537bfaa62c6f213b70a0da5ec89a9 |
|
BLAKE2b-256 | 12b039a040e176b68174b5b9e304ae662c5df49d7857694817482a7df67db01d |