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 safety features to offer a robust solution for Python audio applications.
Features
- Single Audio Access: Supports simple audio API access.
- Audio Queue Management: Efficient handling and processing of audio files via channels.
- Channel Management: Manage multiple audio channels with the AudioManager.
- Safe and Performant: Built with Rust for optimal performance and concurrency.
- Built in access to metadata Easily access information about audio files
Installation
You can install rpaudio
via PyPI using pip:
pip install rpaudio
Getting Started
import rpaudio
import asyncio
def on_audio_stop():
print("Audio has stopped")
async def play_audio():
handler = rpaudio.AudioSink(callback=on_audio_stop).load_audio("Acrylic.mp3")
handler.play()
count = 0
while True:
await asyncio.sleep(1)
count += 1
if count == 4:
# Pause the audio for 2 seconds
print ("Pausing audio")
handler.pause()
if count == 6:
# Resume the audio, but turn down the volume
print("Resuming audio, lowering volume")
handler.set_volume(0.5)
handler.play()
if count == 8:
# Seek to 10 seconds
print(f"Current position: {handler.get_pos()}")
handler.try_seek(10.)
await asyncio.sleep(1)
print(f"Position after seek: {handler.get_pos()}")
if count == 10:
# Change the playback speed to 1.5
handler.set_speed(1.5)
print(f"Playback speed: {handler.get_speed()}")
await asyncio.sleep(1)
handler.stop()
async def sleep_loop():
for i in range(10):
print(f"Sleeping {i}")
await asyncio.sleep(1)
async def main():
await asyncio.gather(play_audio(), sleep_loop())
asyncio.run(main())
Documentation
The full documentation is available at rpaudio's Read the Docs.
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 Distribution
rpaudio-0.0.4.tar.gz
(1.9 MB
view hashes)
Built Distributions
rpaudio-0.0.4-cp38-abi3-win_amd64.whl
(908.2 kB
view hashes)
rpaudio-0.0.4-cp38-abi3-win32.whl
(869.4 kB
view hashes)
Close
Hashes for rpaudio-0.0.4-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6995a11c30a1b4e2b384b37803cd781af25c50aa029d0af0dddd0dad358a9b9a |
|
MD5 | 3b243941dbff9eff29b1a71340293c08 |
|
BLAKE2b-256 | 7e35a57b8c0e8991193df811976d0918a1a6aaad81f688117b2a9a27a7b03693 |
Close
Hashes for rpaudio-0.0.4-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666cc509fa5985958d074a78b1202ef9bb0f6b775e64673c84454494199d6cec |
|
MD5 | 311daf4e0391de15e5bc49568be538ac |
|
BLAKE2b-256 | c359949da20d608d53b71586c426580d1458b91c814cfd3b6b0550427c0261d3 |
Close
Hashes for rpaudio-0.0.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68081abca554c6044c60d458193dccce17dfd71cb2d95d3eab2d3a14614c3bd8 |
|
MD5 | a4f12d4047c06d1e71cd52610455f0b2 |
|
BLAKE2b-256 | 14c22c0e6a78b40f009ce902ec845bca7f49a421ce5e7a5b7d8f79509ff97ec3 |
Close
Hashes for rpaudio-0.0.4-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b50518f822b646ea86a9e4d73bee856daaae8f06a7107517ca4a23a3803a607f |
|
MD5 | 7e7194b28db76628f6cacb53b9e37373 |
|
BLAKE2b-256 | dbdb75f6447c42e6c09e3a1d2794a7ef170d94749407d2b845d5953e82294ec6 |
Close
Hashes for rpaudio-0.0.4-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d261db23421c005130ede8bb3a987c781745f9b2f6504150f25d3bd086cd0e79 |
|
MD5 | 13d0f1dbc7a8575f4c00e498c4c111e3 |
|
BLAKE2b-256 | acc35a9c99b218fef040e1e200ff05e9b81e6285e0802970ef9185f62dfc4809 |
Close
Hashes for rpaudio-0.0.4-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1619cc2e00786eb6aad6180fd72a5542e49e4324d44a8cc1726922a3e0c3ab27 |
|
MD5 | 46df22f71007694f79c0bcabc310afac |
|
BLAKE2b-256 | 6064c1b2362a00d2d1a327f47c569b43988749be5d9c8ea897a8b77c6f5ce806 |