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.8-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e22ccf54e893f49c6eee62e62864a26ccfa3dc4a91f80438310c0904369648b |
|
MD5 | 04717b43f9c12026d6876957a35caa1f |
|
BLAKE2b-256 | 9c59a92ee4f39badcd901ebd42181ed4c8fdc4cf515ca387368e81478add5aa9 |
Hashes for rpaudio-0.0.8-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4434a31506a073a5129279a9cc93b1ca778171b96307d563f05cedba6ee8d582 |
|
MD5 | 3345747ea39b0466bc5db6bb16264336 |
|
BLAKE2b-256 | e14054a64dce9ce1c49869be9a3a92dd2dc88a7ac767cb7a99f2b819fccc21a1 |
Hashes for rpaudio-0.0.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d5e9cd739ddcc24f9331a15db824c6a73fbef322fa4685ef47896a1c880a84 |
|
MD5 | 3d7426f027ea3a65c7ecc599c2043595 |
|
BLAKE2b-256 | af585d54441559aa72fca889c25fcd21202f5629ea0540c7a95408cc35663a3d |
Hashes for rpaudio-0.0.8-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48245ae56998a017bb91202e5b8c01faa85fe1db8e2a7be50410975164a165c0 |
|
MD5 | d5cb0251032774fab7b9dc539f63d782 |
|
BLAKE2b-256 | 3b9ea0b2ffef3859ff388d4fce440e387bab2471b900bf398700b6800d868370 |
Hashes for rpaudio-0.0.8-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98466d1ba820f5c00351731f58969272fac2d59950da1d5df2c7b10c9c8540cc |
|
MD5 | 7c70351a31611d83815ae227881185d7 |
|
BLAKE2b-256 | 10278a9509ded0845bcea5e72885507630d94da3c09359c9aab7ded6b7ac7e90 |
Hashes for rpaudio-0.0.8-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6084c4c8f02e023d79de7eae19336de73c4a8185fbdd3fcb380a9b123e558e1c |
|
MD5 | 2cd562ec9305114031cde6c1879f9623 |
|
BLAKE2b-256 | b7a631adec1db910b9cb38d956a23629924944ae67ed676c447f605e04a2de53 |