No description
  • Python 35.3%
  • C++ 35.3%
  • HTML 29.4%
Find a file
2026-03-27 17:24:15 -04:00
example add debug flag to stop continuous logging on non dev setups 2025-09-10 11:29:05 -04:00
pcmflux Add an option to configure server latency 2026-01-30 22:42:59 +05:30
.gitignore update for pip install 2025-06-29 13:50:56 -04:00
LICENSE initial version 2025-06-29 13:26:47 -04:00
MANIFEST.in Edit build pipeline without CMake 2025-07-21 23:55:26 +09:00
pyproject.toml Edit build pipeline without CMake 2025-07-21 23:55:26 +09:00
README.md Edit build pipeline without CMake 2025-07-21 23:55:26 +09:00
setup.py bump version 2026-03-27 17:24:15 -04:00

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.

Prerequisites

This package compiles a C++ extension and requires the development headers for PulseAudio and Opus to be installed on your system.

On Debian/Ubuntu, you can install them with:

sudo apt-get install libpulse-dev libopus-dev

Core Features

  • PulseAudio Capture: Uses the pa_simple API 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 ctypes Wrapper: Provides a clean and simple Python API over a high-performance C++ core.
  • Python Build System: Uses a robust Python build 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:

  1. Install the module: pip3 install .
  2. Run the server: cd example && python3 audio_to_browser.py
  3. Open http://localhost:9001 in a modern web browser (Chrome, Edge, etc.).