Repository navigation
Initial public release of capture-system-or-process-audio (v1.3.1) β a cross-platform native system-speaker, per-application/process, and microphone PCM audio capture and live-mixing engine built from the ground up in safe Rust, with first-class Python, Rust, C++17, and C11 SDKs.
Created by @s0d3s (author of PyAudioWPatch), this library brings zero-virtual-cable native audio capture across Windows 10/11, Linux, and Apple Silicon macOS without silent scope fallbacks or audio-thread heap allocations.
π Documentation & User Manuals β’ Multi-SDK API Reference β’ PyPI β’ crates.io β’ docs.rs
β¨ Highlights
- Unified
CaptureTargetModel: Capture default or specific speakers/headphones (default_output,device), isolate a single running application or process tree (find_app,process), or capture microphones (microphone,input_device) β without installingVB-Cable,BlackHole, orSoundflower. - No Silent Scope Fallbacks: Unsupported scopes, backends, or OS versions fail explicitly with typed
CapabilityError/PlanErrordiagnostics rather than silently broadening per-app capture into full-system audio. - Live Multi-Source Mixing (
CspaMixer) & Format Conversion (OutputConverter): Combine heterogeneous sources (such as[microphone(), find_app("Zoom")]or cross-backend[ScreenCaptureKit + CoreAudio]/[PipeWire + PulseAudio]) into one drift-compensated PCM stream (< 10 msbest-effort relative skew), resampled and dithered on the fly (16 kHz/24 kHz/44.1 kHz/48 kHz,f32/i16/i24/i32, mono/stereo). - Production Loopback Reliability:
- Silent-speaker hang protection: Opt-in
silence_on_idlesynthesizes metadata-flagged silent frames when endpoints emit zero packets. - Automatic device-switch tracking:
Followmode seamlessly transitions across OS default speaker or microphone changes;Pinlocks to a specific hardware endpoint. - Live target hot-swap (
update_targets): Add, remove, or re-weight sources mid-session without tearing down unchanged streams. - Side-effect-free planning (
inspect()): Preview backend selection, combine strategy, stream count, and memory footprint before opening any OS audio handle.
- Silent-speaker hang protection: Opt-in
- Real-Time & Zero-Allocation Steady State: Preallocated bounded slot pools (
StorageBudget) and 0 steady-state heap allocations on warmedread_intopaths across Rust, Python, C++17, and C11. - OS Recording Permissions API: Target-aware 5-state preflight (
Granted,NotDetermined,Denied,Restricted,Unknown), interactiveAutoRequestvs non-promptingCheckOnlypolicies, and macOS.appbundleInfo.plistSIGABRTprotection. - Interactive Terminal Studio (
cspa-tui-demo): Standalone terminal app with live 4-tab target discovery, mid-recording source hot-swap, permission inspector/prompts, 2048-pt Hann FFT / Truecolor Waterfall / Braille Oscilloscope views, RAM takes, and WAV export.
π Quick Install
Python (3.11β3.15 + Free-Threaded 3.14t & 3.15t)
Prebuilt cp311-abi3, cp314-cp314t, and PEP 803 cp315-abi3.abi3t wheels with zero mandatory dependencies, native -Xgil=0 free-threading (Py_MOD_GIL_NOT_USED), PEP 3118 zero-copy memoryview / optional NumPy views, asyncio support, and full .pyi type stubs:
pip install capture-system-or-process-audio
# Optional NumPy support for block.to_numpy(copy=False):
pip install "capture-system-or-process-audio[numpy]"
# Verify platform backends & list live CaptureTargets:
python -m capture_system_or_process_audioRust (1.88+, #![forbid(unsafe_code)] facade)
cargo add capture-system-or-process-audioC++17 (Header-Only RAII) & C11 (Stable FFI + CMake)
Download the cspa-ffi-1.3.1-<target> archive for your platform below, extract it, and point CMake at lib/cmake/Cspa:
find_package(Cspa 1.3.1 EXACT REQUIRED CONFIG)
target_link_libraries(your_app PRIVATE Cspa::cspa_ffi)Includes include/cspa.hpp (supports both /EHsc / -fexceptions and exception-free /EHs-c- / -fno-exceptions builds via cspa::Result<T>) and include/cspa_experimental.h (cspa_abi_check schema verification + catch_unwind FFI boundary).
Interactive Studio TUI Demo (No Code Required)
Download cspa-tui-demo-1.3.1-<target> below, extract, and run cspa-tui-demo (cspa-tui-demo.exe on Windows).
π₯οΈ Platform & Native Backend Matrix
| Platform | Architecture | Native Backends | System / Device Output | Single App / Process Capture | Microphones & Inputs |
|---|---|---|---|---|---|
| Windows 10 / 11 | x86_64, ARM64 |
wasapi |
β
Build 19041+ |
β
Build 20348+ (scope="tree") |
β
Build 19041+ |
Linux (manylinux_2_28) |
x86_64, aarch64 |
pipewire (0.3.65+), pulseaudio (15.0+)* |
β Sink monitor | β
PipeWire virtual-sink fan-in (tree/exact) & Pulse per-stream mix |
β
Sources (.monitor excluded) |
| macOS | Apple Silicon (arm64) |
coreaudio, screencapturekit |
β
macOS 14.2+ Core Audio Taps |
β
14.2+ Core Audio Taps (tree/exact) & 13.0+ ScreenCaptureKit (exact app) |
β
13.0+ Core Audio HAL |
*Linux prebuilt wheels, FFI shared libraries, and demo binaries load libpipewire-0.3.so.0 and libpulse.so.0 dynamically via dlopen at runtime (0 compile-time NEEDED links to audio client libraries).
π¦ Release Assets & Verification
This release includes 31 verified build artifacts plus SHA256SUMS.txt:
| Asset Group | Files | Notes |
|---|---|---|
| Studio TUI Demo | cspa-tui-demo-1.3.1-<target>.{zip,tar.gz} (Γ5) |
Standalone terminal mixer, spectroscope & target explorer |
| C / C++17 FFI SDK | cspa-ffi-1.3.1-<target>.{zip,tar.gz} (Γ5) |
cspa.hpp, cspa_experimental.h, CspaConfig.cmake, shared lib & notices |
| Python Wheels & sdist | capture_system_or_process_audio-1.3.1-*.whl (Γ15) + .tar.gz (Γ1) |
Mirrors the exact wheels and sdist published to PyPI |
| Rust Crates | capture-system-or-process-audio*-1.3.1.crate (Γ5) |
Mirrors the exact crate archives published to crates.io |
| Checksums | SHA256SUMS.txt |
SHA-256 digests for every release asset |
Verify artifact provenance & checksums:
# Verify GitHub Actions build provenance attestation (GitHub CLI):
gh attestation verify <downloaded-file> --repo s0d3s/capture-system-or-process-audio
# Verify SHA-256 checksums (Linux / macOS):
shasum -a 256 --ignore-missing -c SHA256SUMS.txtNote on unsigned OS binaries: Prebuilt standalone archives are attested via GitHub Artifact Attestations (
gh attestation verify) rather than platform code-signing certificates. On macOS, if Gatekeeper quarantines a browser-downloaded archive, clear the quarantine attribute withxattr -d com.apple.quarantine <archive>.tar.gzbefore extracting.
πΊοΈ What's Next
- Drop-In Ecosystem
Adapters: Zero-rewrite compatibility layers forPyAudio/PyAudioWPatch,python-sounddevice,SoundCard,SpeechRecognition, andfaster-whisper/ live STT sliding-window streams. - Node.js / TypeScript / Electron SDK (
napi-rs): PrebuiltNode-APIbinaries (UtilityProcess& V8 Memory Cage safe) withAsyncIterable,Readable, and zero-GCreadInto(TypedArray). - Cross-Platform Statistical Benchmark Suite: Standalone reproducible latency, tail-jitter (
p50/p95), and allocation benchmarks across Windows 11, Linux (PipeWire&PulseAudio), and Apple Silicon macOS.
π License
Dual-licensed under MIT OR Apache-2.0 at your option.