Skip to main content

Pytest Version

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

FastAPI LAN Audio Web Client

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.

Release files for rpaudio 0.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for rpaudio 0.0.18
File
rpaudio-0.0.18-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
rpaudio-0.0.18-cp38-abi3-win32.whl CPython 3.8 abi3 Windows x86-32 Details
rpaudio-0.0.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
rpaudio-0.0.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-32 Details
rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details
rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details

Total release size: 8.8 MB

Release files / rpaudio-0.0.18-cp38-abi3-win_amd64.whl

Download URL rpaudio-0.0.18-cp38-abi3-win_amd64.whl
Size 993.3 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cc4eacd17d7132278bbb30027c454a48939d2b95586d7a088bf7f912aeceb73a
BLAKE2b-256 checksum
How to use checksums
22469c3485bed2a9d024b9b6d1ecbfa843fa7b911b177cc605c62e2d525f6a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / rpaudio-0.0.18-cp38-abi3-win32.whl

Download URL rpaudio-0.0.18-cp38-abi3-win32.whl
Size 942.8 kB
Tags CPython 3.8 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
0910ea6d9f10c338e210e40a0d03c2b0a644b2991c42eb7af0c2fd0b4b638c1a
BLAKE2b-256 checksum
How to use checksums
6d6ca1499fdc6049a56caf6082d6f77017b1087e6969b082857e99f3b78787ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / rpaudio-0.0.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rpaudio-0.0.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e9069eaf4af4e0bb7e4481cba9ab3dd5d2189308767e6a3e37ff7cb6202827e1
BLAKE2b-256 checksum
How to use checksums
d134b8e684a2955e37877e6f07d00e95e60eef672ef360783f9a5802cf50e664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / rpaudio-0.0.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL rpaudio-0.0.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.8 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
a8218f30957d7d3f12ba8c134688c8db0ea7dc19e5c73706c8d97f3d1567fd35
BLAKE2b-256 checksum
How to use checksums
4929ae8c144ee7ad433fee5e8f3afce32b101ed5153a773a62295747c181f5db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.whl

Download URL rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.whl
Size 1.1 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
fb1fd4561bed772ba6d96157fc451edab97828b945016dea0901bdf3f6f61ae0
BLAKE2b-256 checksum
How to use checksums
813d18a8ff7af7d05edddb787e81d71a273eb93f21076ee3015befc7bb7ec16f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL rpaudio-0.0.18-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 2.2 MB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0309110464a09be8243327355d8912d5d0895ee91910072accefc0f44716282a
BLAKE2b-256 checksum
How to use checksums
52ce161cea072ff64e28316c634624b8d7299e9fe72c33c661f5f83dfd9c7371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.0.18 This release

6 release files

0.0.16

6 release files

0.0.15

6 release files

0.0.12

6 release files

0.0.11

6 release files

0.0.10

6 release files

0.0.9

6 release files

0.0.8

6 release files

0.0.7

6 release files

0.0.6

6 release files

0.0.5

6 release files

0.0.4

7 release files

0.0.3

11 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page