A performant audio capture pipeline that encodes raw PCM to Opus, skipping silence.
Project description
pcmflux
pcmflux is a high-performance audio capture and encoding module for Python.
It is designed to capture system audio using PulseAudio, encode it into the Opus format, and stream it with low latency. A key optimization is its ability to detect and discard silent audio chunks, significantly reducing network traffic and CPU usage during periods of no sound.
Core Features
- PulseAudio Capture: Uses the
pa_simpleAPI for efficient, low-level audio capture. - Opus Encoding: Integrates the high-quality, low-latency Opus codec.
- Silence Detection: Intelligently skips encoding and sending silent audio chunks.
- Python
ctypesWrapper: Provides a clean and simple Python API over a high-performance C++ core. - CMake Build System: Uses a robust CMake setup for compiling the C++ module and its dependencies.
Example Usage
The example directory contains a standalone demo that captures system audio, broadcasts it over a WebSocket, and plays it back in a web browser using the WebCodecs API.
To run the example:
- Install the module:
python3 setup.py install - Run the server:
python3 example/audio_to_browser.py - Open
http://localhost:9001in a modern web browser (Chrome, Edge, etc.).
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
File details
Details for the file pcmflux-1.0.0.tar.gz.
File metadata
- Download URL: pcmflux-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db06a49cfd8d021b5f94470cc23ea33d23a0ee3357e62a044379d8040889bc56
|
|
| MD5 |
48acefa4b22934ae23af7feea89a6d6c
|
|
| BLAKE2b-256 |
61ebcd4197ce7a36a3b12e46fd8c1bcf9b26f6fb0affa83015b1025e650c5a67
|