Cross-platform process-level audio capture library
Project description
๐ก ProcTap
Cross-Platform Per-Process Audio Capture
ProcTap is a Python library for per-process audio capture with platform-specific backends.
Capture audio from a specific process only โ without system sounds or other app audio mixed in. Ideal for VRChat, games, DAWs, browsers, and AI audio analysis pipelines.
Platform Support
| Platform | Status | Backend | Notes |
|---|---|---|---|
| Windows | โ Fully Supported | WASAPI (C++ native) | Windows 10/11 (20H1+) |
| Linux | โ Fully Supported | PipeWire Native / PulseAudio | Per-process isolation, auto-fallback (v0.4.0+) |
| macOS | ๐งช Experimental | Core Audio Process Tap | macOS 14.4+ (Sonoma) required |
* Linux is fully supported with PipeWire/PulseAudio (v0.4.0+). macOS support is experimental (see requirements).
๐ Features
-
๐ง Capture audio from a single target process (VRChat, games, browsers, Discord, DAWs, streaming tools, etc.)
-
๐ Cross-platform architecture โ Windows (fully supported) | Linux (fully supported, v0.4.0+) | macOS (experimental, 14.4+)
-
โก Platform-optimized backends โ Windows: ActivateAudioInterfaceAsync (modern WASAPI) โ Linux: PipeWire Native API / PulseAudio (fully supported, v0.4.0+) โ macOS: Core Audio Process Tap API (macOS 14.4+)
-
๐งต Low-latency, thread-safe audio engine โ 44.1 kHz / stereo / 16-bit PCM format (Windows)
-
๐ Python-friendly high-level API
- Callback-based streaming
- Async generator streaming (
async for)
-
๐ Native extensions for high-performance โ C++ extension on Windows for optimal throughput
๐ฆ Installation
From PyPI:
pip install proc-tap
Platform-specific dependencies are automatically installed:
- Windows: No additional dependencies
- Linux:
pulsectlis automatically installed, but you also need system packages:# Ubuntu/Debian sudo apt-get install pulseaudio-utils # Fedora/RHEL sudo dnf install pulseaudio-utils
Optional: High-Quality Audio Resampling (74% faster / 3.8x speedup for sample rate conversion):
pip install proc-tap[hq-resample]
Performance: With libsamplerate, resampling achieves 0.66ms per 10ms chunk (vs 2.6ms with scipy-only).
Compatibility Notes:
- โ Python 3.10-3.12: Works on all platforms
- โ Linux/macOS + Python 3.13+: Should work (you can try it!)
- โ ๏ธ Windows + Python 3.13+: May fail to build (as of 2025-01)
- If it fails, the library automatically falls back to scipy's polyphase filtering
- Still provides excellent audio quality, just 74% slower for resampling
- You can still try installing - if it works, great! If not, no harm done.
๐ Read the Full Documentation for detailed guides and API reference.
From TestPyPI (for testing pre-releases):
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ proctap
From Source:
git clone https://github.com/m96-chan/ProcTap
cd ProcTap
pip install -e .
๐ Requirements
Windows (Fully Supported):
- Windows 10 / 11 (20H1 or later)
- Python 3.10+
- WASAPI support
- No admin privileges required
Linux (Fully Supported - v0.4.0+):
- Linux with PulseAudio or PipeWire
- Python 3.10+
- Auto-detection: Automatically selects best available backend
- Native PipeWire API (recommended):
libpipewire-0.3-dev:sudo apt-get install libpipewire-0.3-dev- Ultra-low latency: ~2-5ms
- Auto-selected when available
- PipeWire subprocess:
pw-record: install withsudo apt-get install pipewire-media-session
- PulseAudio fallback:
pulsectllibrary: automatically installedpareccommand:sudo apt-get install pulseaudio-utils
- โ Per-process isolation using null-sink strategy
- โ Graceful fallback chain: Native โ PipeWire subprocess โ PulseAudio
macOS (Experimental):
- macOS 14.4 (Sonoma) or later
- Python 3.10+
- Swift CLI helper binary (proctap-macos)
- Audio capture permission
- โ ๏ธ EXPERIMENTAL: Core Audio Process Tap API support implemented
- โ ๏ธ REQUIREMENT: Requires macOS 14.4+ for Process Tap API
๐งฐ Basic Usage (Callback API)
from proctap import ProcTap, StreamConfig
def on_chunk(pcm: bytes, frames: int):
print(f"Received {len(pcm)} bytes ({frames} frames)")
pid = 12345 # Target process ID
tap = ProcTap(pid, StreamConfig(), on_data=on_chunk)
tap.start()
input("Recording... Press Enter to stop.\n")
tap.close()
๐ Async Usage (Async Generator)
import asyncio
from proctap import ProcTap
async def main():
tap = ProcTap(pid=12345)
tap.start()
async for chunk in tap.iter_chunks():
print(f"PCM chunk size: {len(chunk)} bytes")
asyncio.run(main())
๐ API Overview
class ProcTap
Control Methods:
| Method | Description |
|---|---|
start() |
Start WASAPI per-process capture |
stop() |
Stop capture |
close() |
Release native resources |
Data Access:
| Method | Description |
|---|---|
iter_chunks() |
Async generator yielding PCM chunks |
read(timeout=1.0) |
Synchronous: read one chunk (blocking) |
Properties:
| Property | Type | Description |
|---|---|---|
is_running |
bool | Check if capture is active |
pid |
int | Get target process ID |
config |
StreamConfig | Get stream configuration |
Utility Methods:
| Method | Description |
|---|---|
set_callback(callback) |
Change or remove audio callback |
get_format() |
Get audio format info (dict) |
Audio Format
Native Backend Format (Windows WASAPI, hardcoded in C++):
| Parameter | Value | Description |
|---|---|---|
| Sample Rate | 44,100 Hz | CD quality (fixed in C++) |
| Channels | 2 | Stereo (fixed in C++) |
| Bit Depth | 16-bit | PCM format (fixed in C++) |
Output Format Conversion (v0.2.1+):
The StreamConfig class controls the output format through automatic conversion:
- Native format โ converted to match your
StreamConfigsettings - Supports sample rate conversion (e.g., 44.1kHz โ 48kHz)
- Supports channel conversion (mono โ stereo)
- Supports bit depth conversion (8/16/24/32-bit)
- Zero overhead when formats match (automatic bypass)
Example:
# Get audio as 48kHz mono 24-bit
config = StreamConfig(sample_rate=48000, channels=1, width=3)
tap = ProcTap(pid, config=config)
๐ฏ Use Cases
- ๐ฎ Record audio from one game only
- ๐ถ Capture VRChat audio cleanly (without system sounds)
- ๐ Feed high-SNR audio into AI recognition models
- ๐น Alternative to OBS "Application Audio Capture"
- ๐ง Capture DAW/app playback for analysis tools
๐ Example: Save to WAV
from proctap import ProcTap
import wave
pid = 12345
wav = wave.open("output.wav", "wb")
wav.setnchannels(2)
wav.setsampwidth(2) # 16-bit PCM
wav.setframerate(44100) # Native format is 44.1 kHz
def on_data(pcm, frames):
wav.writeframes(pcm)
with ProcTap(pid, on_data=on_data):
input("Recording... Press Enter to stop.\n")
wav.close()
๐ Example: Synchronous Read API
from proctap import ProcTap
tap = ProcTap(pid=12345)
tap.start()
try:
while True:
chunk = tap.read(timeout=1.0) # Blocking read
if chunk:
print(f"Got {len(chunk)} bytes")
# Process audio data...
else:
print("Timeout, no data")
except KeyboardInterrupt:
pass
finally:
tap.close()
๐ง Linux Example
from proctap import ProcessAudioCapture, StreamConfig
import wave
pid = 12345 # Your target process ID
# Create WAV file
wav = wave.open("linux_capture.wav", "wb")
wav.setnchannels(2)
wav.setsampwidth(2)
wav.setframerate(44100)
def on_data(pcm, frames):
wav.writeframes(pcm)
# Create stream config (Linux backend respects these settings)
config = StreamConfig(sample_rate=44100, channels=2)
try:
with ProcessAudioCapture(pid, config=config, on_data=on_data):
print("โ ๏ธ Make sure the process is actively playing audio!")
input("Recording... Press Enter to stop.\n")
finally:
wav.close()
Linux-specific requirements:
- Install system package:
sudo apt-get install pulseaudio-utils(providespareccommand) - Python dependency
pulsectlis automatically installed withpip install proc-tap - The target process must be actively playing audio
- See examples/linux_basic.py for a complete example
๐ macOS Example
from proctap import ProcessAudioCapture, StreamConfig
import wave
pid = 12345 # Your target process ID
# Create WAV file
wav = wave.open("macos_capture.wav", "wb")
wav.setnchannels(2)
wav.setsampwidth(2)
wav.setframerate(48000) # macOS backend default is 48 kHz
def on_data(pcm, frames):
wav.writeframes(pcm)
# Create stream config (macOS backend respects these settings)
config = StreamConfig(sample_rate=48000, channels=2)
try:
with ProcessAudioCapture(pid, config=config, on_data=on_data):
print("โ ๏ธ Make sure the process is actively playing audio!")
print("โ ๏ธ On first run, macOS will prompt for permission.")
input("Recording... Press Enter to stop.\n")
finally:
wav.close()
macOS-specific requirements:
- macOS 14.4 (Sonoma) or later
- Swift CLI helper binary (proctap-macos) - automatically built during installation if Swift toolchain available
- Audio capture permission - macOS will prompt on first run
- The target process must be actively playing audio
- See examples/macos_basic.py for a complete example
Building the Swift helper manually:
cd swift/proctap-macos
swift build -c release
cp .build/release/proctap-macos ../../src/proctap/bin/
๐ Build From Source
git clone https://github.com/m96-chan/ProcTap
cd ProcTap
pip install -e .
Windows Build Requirements:
- Visual Studio Build Tools
- Windows SDK
- CMake (if you modularize the C++ code)
Linux:
- No C++ compiler required (pure Python)
- System dependencies:
pulseaudio-utilsorpipewirewithlibpipewire-0.3-dev
macOS:
- No C++ compiler required (pure Python)
- Swift toolchain (optional, for building the Swift CLI helper)
- If Swift is not available, pre-built binary is included in the package
๐ค Contributing
Contributions are welcome! We have structured issue templates to help guide your contributions:
- ๐ Bug Report - Report bugs or unexpected behavior
- โจ Feature Request - Suggest new features or enhancements
- โก Performance Issue - Report performance problems or optimizations
- ๐ง Type Hints / Async - Improve type annotations or async functionality
- ๐ Documentation - Improve docs, examples, or guides
Special Interest:
- PRs from WASAPI/C++ experts are especially appreciated
- Linux backend improvements (PulseAudio/PipeWire per-app isolation)
- macOS backend testing (Core Audio Process Tap on macOS 14.4+)
- Cross-platform testing and compatibility
- Performance profiling and optimization
๐ License
MIT License
๐ค Author
m96-chan
Windows Audio / VRChat Tools / Python / C++
https://github.com/m96-chan
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proc_tap-0.3.0.tar.gz.
File metadata
- Download URL: proc_tap-0.3.0.tar.gz
- Upload date:
- Size: 61.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
002c5ef666eae000641cb5cbd66802cbcace8a79845f8781d468b5e0295d3746
|
|
| MD5 |
5e46570eb9e03b29bdd2be462156804d
|
|
| BLAKE2b-256 |
46165401678eae7a91c48bfe050d2e891c0e2d189d1d6ee923bf886683746f20
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0.tar.gz -
Subject digest:
002c5ef666eae000641cb5cbd66802cbcace8a79845f8781d468b5e0295d3746 - Sigstore transparency entry: 704891744
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file proc_tap-0.3.0-py3-none-any.whl.
File metadata
- Download URL: proc_tap-0.3.0-py3-none-any.whl
- Upload date:
- Size: 58.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f30b038a3ae5090a7b0a20a4e215bdcb845995fc16b346e2c07d82770cd950a5
|
|
| MD5 |
a6916bb9a58588044fe8cef506201948
|
|
| BLAKE2b-256 |
7a28d9ba76b13049effffc7fba1a4912869fa2d06756dda74a50d83b19ec77c9
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0-py3-none-any.whl -
Subject digest:
f30b038a3ae5090a7b0a20a4e215bdcb845995fc16b346e2c07d82770cd950a5 - Sigstore transparency entry: 704891806
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file proc_tap-0.3.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: proc_tap-0.3.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 78.2 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf77f7dae4fab1dfbadaa6898480cb9d4e203ef84c83c0c2d895539bba3c14be
|
|
| MD5 |
57e74eb6495058dd1a382d2f744201a5
|
|
| BLAKE2b-256 |
e3b81d654838bb64b46b1ca5c96f04a44e0def13f936ba60ee3ad8cb5c71fa5f
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0-cp313-cp313-win_amd64.whl:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0-cp313-cp313-win_amd64.whl -
Subject digest:
bf77f7dae4fab1dfbadaa6898480cb9d4e203ef84c83c0c2d895539bba3c14be - Sigstore transparency entry: 704891756
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file proc_tap-0.3.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: proc_tap-0.3.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 78.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65a26e29fb629fc1110c7615ee43961d833b103be9d582fd76ce1b1e1e177127
|
|
| MD5 |
890c083f8d5c5c50fd374ec1fd0ad375
|
|
| BLAKE2b-256 |
85b3cdfdd89b5959a620bdabb0fee8ce534446b1dcd20440e55fd3a8bb0cb80a
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0-cp312-cp312-win_amd64.whl:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0-cp312-cp312-win_amd64.whl -
Subject digest:
65a26e29fb629fc1110c7615ee43961d833b103be9d582fd76ce1b1e1e177127 - Sigstore transparency entry: 704891792
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file proc_tap-0.3.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: proc_tap-0.3.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 78.2 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dacc66418207ef681cef737842a7a3612b21db898055eb3b20c935d5800115a7
|
|
| MD5 |
c67fbb584fa12b26240daed34a6d96b7
|
|
| BLAKE2b-256 |
f5f9a750d4a943c01a481ddeccf1e28e676633721f6d72d6af436c4b61a9a761
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0-cp311-cp311-win_amd64.whl:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0-cp311-cp311-win_amd64.whl -
Subject digest:
dacc66418207ef681cef737842a7a3612b21db898055eb3b20c935d5800115a7 - Sigstore transparency entry: 704891769
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file proc_tap-0.3.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: proc_tap-0.3.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 78.2 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e9abe606ddaed623c0fb11f014a9401af9c487fa75028d0874cfb1b4f3817fd
|
|
| MD5 |
ac8cd5299593ac87041564a51efbc03c
|
|
| BLAKE2b-256 |
0261bfa41d04fb18d3b2d9c9e7a944e9199bc6eff6b3b37c5197884ba31cd231
|
Provenance
The following attestation bundles were made for proc_tap-0.3.0-cp310-cp310-win_amd64.whl:
Publisher:
publish-pypi.yml on m96-chan/ProcTap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proc_tap-0.3.0-cp310-cp310-win_amd64.whl -
Subject digest:
2e9abe606ddaed623c0fb11f014a9401af9c487fa75028d0874cfb1b4f3817fd - Sigstore transparency entry: 704891782
- Sigstore integration time:
-
Permalink:
m96-chan/ProcTap@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8af0df80a89f01595b3a7a0c5d8b2e5bcc0b2679 -
Trigger Event:
workflow_dispatch
-
Statement type: