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.13-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0bb57490d500e7a00382614f4e94e8cd8b33daf2642271a42338122ca5be20b |
|
MD5 | 89a3bfbeee91cb013c101473631ee479 |
|
BLAKE2b-256 | df966387413b9e870ca3145f38f68cff4fdf9b157b76a0937e12b89806b76872 |
Hashes for rpaudio-0.0.13-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab037da96cd9c1610f86bad7c730fc2d3035a4eafd04fec7fcd9b9af48e88ecd |
|
MD5 | 19fff0e01571ab15204d624fbe5f15d6 |
|
BLAKE2b-256 | 98047955989cb487549fb7ae3ded3ce01dbe46f866ee34111c40a8b767688d7d |
Hashes for rpaudio-0.0.13-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3db94d58007d5ebf8b1e88952e7198a99b5c9450a96165c3c5bd84122daaef78 |
|
MD5 | 4691707bbe13622613fb737e6edafe72 |
|
BLAKE2b-256 | df502348cebfcf38261cf4c1793383321e07ed49a79b3b6ffb89b50a2baf9dbc |
Hashes for rpaudio-0.0.13-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26ba840f6802b91d19044a2ccbf8a71adf8d63f25ccb3efc178c07a8389624c1 |
|
MD5 | 840c199de929ab2611c56c0bfc9c475e |
|
BLAKE2b-256 | 77aca06ead739d7dc9196eb6bfe3ff3f49bb1631a6a458dbfab0e45e6478e26e |
Hashes for rpaudio-0.0.13-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eec1f48e8f517458985249ba13b912dbf4bd2aaf4ff303a6dc9dcf1e58ea9c2 |
|
MD5 | 2a2861435f4adb57940f7a350c6e4ed6 |
|
BLAKE2b-256 | 18dd95fb31a5e0e636a15545bd197f770b2bafe40fd154012abec781091f2ea4 |
Hashes for rpaudio-0.0.13-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9ae6e4b78477672395267783b58dfa8ef2e932989873a0ae84ff2c4214624eb |
|
MD5 | f4b718c170c8c14298f7decb76aa5561 |
|
BLAKE2b-256 | 7c4842aea499a2d5394f6cab824d25fb5e49da1d0bde4aa5b2bacf0102b5e6dc |