Skip to content

v1.3.1 β‚ͺ A Year of Work πŸŽ‰

Latest

Choose a tag to compare

@s0d3s s0d3s released this 22 Nov 21:20
· 5 commits to main since this release

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 CaptureTarget Model: 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 installing VB-Cable, BlackHole, or Soundflower.
  • No Silent Scope Fallbacks: Unsupported scopes, backends, or OS versions fail explicitly with typed CapabilityError / PlanError diagnostics 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 ms best-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_idle synthesizes metadata-flagged silent frames when endpoints emit zero packets.
    • Automatic device-switch tracking: Follow mode seamlessly transitions across OS default speaker or microphone changes; Pin locks 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.
  • Real-Time & Zero-Allocation Steady State: Preallocated bounded slot pools (StorageBudget) and 0 steady-state heap allocations on warmed read_into paths across Rust, Python, C++17, and C11.
  • OS Recording Permissions API: Target-aware 5-state preflight (Granted, NotDetermined, Denied, Restricted, Unknown), interactive AutoRequest vs non-prompting CheckOnly policies, and macOS .app bundle Info.plist SIGABRT protection.
  • 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_audio

Rust (1.88+, #![forbid(unsafe_code)] facade)

cargo add capture-system-or-process-audio

C++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.txt

Note 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 with xattr -d com.apple.quarantine <archive>.tar.gz before extracting.


πŸ—ΊοΈ What's Next

  • Drop-In Ecosystem Adapters: Zero-rewrite compatibility layers for PyAudio / PyAudioWPatch, python-sounddevice, SoundCard, SpeechRecognition, and faster-whisper / live STT sliding-window streams.
  • Node.js / TypeScript / Electron SDK (napi-rs): Prebuilt Node-API binaries (UtilityProcess & V8 Memory Cage safe) with AsyncIterable, Readable, and zero-GC readInto(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.