audiotap Python bindings
Python package for capturing system audio and microphone input on macOS, built on top of libaudiotap.
Audio is delivered as interleaved float32 PCM bytes via callbacks using ctypes to load libaudiotap.dylib.
Requirements
- macOS 14.2+ (Sonoma)
- Python 3.10+
Installation
pip install audiotap
The wheel includes a prebuilt libaudiotap.dylib — no C compiler or make step needed.
Usage
import audiotap
def on_audio(samples: bytes, frame_count: int, channels: int, host_time: int):
# samples is interleaved float32 PCM
...
# Capture from microphone
with audiotap.MicTap(callback=on_audio, sample_rate=48000, channels=1) as tap:
tap.start()
...
System audio capture works the same way with SystemTap:
tap = audiotap.SystemTap(
callback=on_audio,
sample_rate=48000,
channels=2,
pids=None, # None = all processes
mute=False, # True to silence speakers
)
API
| Type / Function | Description |
|---|---|
SystemTap(callback, sample_rate, channels, *, pids, mute) |
Capture system audio output |
MicTap(callback, sample_rate, channels) |
Capture microphone input |
.start() |
Begin capturing audio |
.stop() |
Pause capture without releasing resources |
.destroy() |
Stop and release all resources |
.running |
True if the tap is currently capturing |
request_mic_permission() |
Prompt for microphone permission (blocking) |
mic_permission_status() |
Check microphone permission (non-blocking) |
error_string(status) |
Human-readable message for an OSStatus code |
Both tap classes support context managers (with) and raise AudioTapError on failure.
Examples
capture_both
Records system audio (stereo) and microphone (mono) to raw PCM files at 48 kHz. Installed as a console script:
audiotap-capture-both [duration_seconds]
ffplay -f f32le -ar 48000 -ac 2 system.pcm
ffplay -f f32le -ar 48000 -ac 1 mic.pcm
Development
For working on the bindings themselves, uv is used for dependency management:
# Build the C shared library
make -C .. build/libaudiotap.dylib
# Install dependencies
make sync
# Run the capture_both example
make capture_both
# Run tests
make test
Architecture
src/audiotap/__init__.py High-level API (SystemTap, MicTap, Permission)
src/audiotap/_bindings.py Low-level ctypes bindings to libaudiotap.dylib
src/audiotap/examples/capture_both.py Audio capture to PCM files (port of C example)
tests/test_audiotap.py High-level API tests (mocked)
tests/test_bindings.py Bindings-layer tests
The library uses ctypes to load libaudiotap.dylib at runtime. Audio callbacks from the C library are bridged through a ctypes function pointer trampoline that converts the raw float pointer into Python bytes before delivering to the user callback.
Metadata
Release files for audiotap 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| audiotap-0.0.2.tar.gz | 16.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audiotap-0.0.2-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details |
Total release size: 31.5 kB
Release files / audiotap-0.0.2.tar.gz
| Download URL | audiotap-0.0.2.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3320b2c87c70cee59afea4aea18797f9a82553b7f57a31cf2a657ff5f2b13bd
|
|
BLAKE2b-256 checksum How to use checksums |
771cec672108390da30ba435b55be2d6ea1437765cd440bea5a2268becf0f3ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / audiotap-0.0.2-py3-none-macosx_14_0_arm64.whl
| Download URL | audiotap-0.0.2-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f17173d04639ce072ea03cf5f17f99a4df060ed7a64a30a503b77a6b33ac2cbb
|
|
BLAKE2b-256 checksum How to use checksums |
f5e60fa121c5b39a586ff52c269a726a8b51384fe0e12c689146215db8376e11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logSecurity for audiotap 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for audiotap-0.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.