WinAudio Python API
Modern, ultra-low-latency per-process Windows audio capture, session routing, and volume control library by SINARY™.
Powered by native Windows WASAPI Process Loopback APIs (AUDIOCLIENT_ACTIVATION_PARAMS / PROCESS_LOOPBACK_MODE).
Features
- 🎯 Per-Process Capture: Capture clean, isolated audio from any specific running application without capturing background noise or unwanted system sounds.
- 🎚️ Session Management: Query active audio sessions, display names, process IDs, and inspect or modify session volume and mute states.
- 🎛️ Multi-App Mixing & Exclusion: Mix audio from multiple applications simultaneously or capture the entire system while excluding specific programs.
- 🔴 Continuous Recording: Record indefinitely with clean WAV finalization upon interrupt (
Ctrl+Cor programmatic stop). - ⚡ Real-Time Streaming: Stream raw 16-bit PCM frames in real-time directly into Python (ideal for speech-to-text, AI models, DSP pipelines).
- 🦀 Rust Core Engine: Built on a high-performance native Rust core with zero garbage-collection jitter.
Installation
pip install sinary-winaudio
System Requirements
- Operating System: Windows 10 (Build 20348 / 21H2 or later) or Windows 11
- Python: 3.8, 3.9, 3.10, 3.11, 3.12, or 3.13 (64-bit)
Quick Start
1. List Sessions & Control Volume
import winaudio
# List all active audio sessions
for session in winaudio.list_sessions():
state_str = "Active" if session.state == 1 else "Inactive"
print(f"[{session.pid}] {session.name} (Host: {session.host_app_name}) - Vol: {session.volume * 100:.0f}% ({state_str})")
# Set volume and mute by process name
winaudio.set_volume_by_name("spotify.exe", 0.75) # 75% volume
winaudio.set_mute_by_name("zoom.exe", True) # Mute
2. Capture Single Application Audio
import winaudio
# Capture 5 seconds from Spotify
with winaudio.Capture(name="Spotify", sample_rate=48000, channels=2) as cap:
print(f"Recording from PID {cap.target_pid}...")
cap.record_to_wav("spotify_clip.wav", duration_seconds=5.0)
3. Continuous Recording with Graceful Stop
Record continuously until you press Ctrl+C. The WAV file header is safely flushed and finalized with zero audio loss or file corruption:
import winaudio
with winaudio.Capture(name="Discord") as cap:
print("Recording live stream... Press Ctrl+C to stop.")
try:
# Omitting duration_seconds enables continuous recording
cap.record_to_wav("discord_meeting.wav")
except KeyboardInterrupt:
print("\nRecording stopped safely!")
4. Master Loopback (All System Audio)
import winaudio
# Capture all desktop audio output
with winaudio.Capture(all=True) as cap:
cap.record_to_wav("system_sound.wav", duration_seconds=10.0)
5. Multi-App Mixing & Exclude Mode
import winaudio
# Multi-App Mixing: Mix audio from Spotify and Chrome simultaneously
with winaudio.Capture(name="Spotify,chrome") as cap:
cap.record_to_wav("music_and_browser.wav", duration_seconds=15.0)
# Exclude Mode: Record everything except games and chat
with winaudio.Capture(exclude="steam,discord") as cap:
cap.record_to_wav("clean_desktop.wav", duration_seconds=30.0)
6. Real-Time Streaming for AI & DSP
Read raw PCM chunks in real-time (16-bit signed, mono or stereo, configurable sample rate) for Whisper, live transcription, or real-time visualization:
import winaudio
with winaudio.Capture(name="chrome.exe", sample_rate=16000, channels=1) as cap:
print("Listening to Chrome audio in real-time...")
for _ in range(100):
# Reads raw 16-bit PCM bytes (100ms timeout)
frame = cap.read_frame(timeout_ms=100)
if frame:
# Process frame bytes with NumPy, PyTorch, Whisper, etc.
pass
License & Trademark
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
Trademark Notice: "SINARY" and the SINARY logo are trademarks of SINARY™.
Metadata
Release files for sinary-winaudio 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| sinary_winaudio-0.1.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp313-cp313-win_amd64.whl |
| sinary_winaudio-0.1.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp312-cp312-win_amd64.whl |
| sinary_winaudio-0.1.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp311-cp311-win_amd64.whl |
| sinary_winaudio-0.1.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp310-cp310-win_amd64.whl |
| sinary_winaudio-0.1.0-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp39-cp39-win_amd64.whl |
| sinary_winaudio-0.1.0-cp38-cp38-win_amd64.whl | CPython 3.8 | CPython 3.8 | Windows x86-64 | Details for sinary_winaudio-0.1.0-cp38-cp38-win_amd64.whl |
Total release size: 1.5 MB
Release files / sinary_winaudio-0.1.0-cp313-cp313-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 255.2 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5e41c39db7bd6a0e2c65f59704ad6afb669dc9c4d1d13b2b197b24cce0efd269
|
|
BLAKE2b-256 checksum How to use checksums |
6736817127230b40f6d669e36008cbd9b8e1f94d5418dd2f0b3c30f52ac72245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sinary_winaudio-0.1.0-cp312-cp312-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 255.3 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e7d5c27fd0a1f1b6cfb1f8f2c5f6b01408a345d4d28cfc79aab90873ed2cae5f
|
|
BLAKE2b-256 checksum How to use checksums |
01b2af8db45c300782ffb3af00a8fdd562e0f358749a793af52180d48c704d4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sinary_winaudio-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 255.8 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5c1aca55abe0faddf6c188ae34d89fc7be5e8367e1c1f1bac0d8af2403abc42c
|
|
BLAKE2b-256 checksum How to use checksums |
d45692815f0309430d9e08fe3e00d7298ba65b776c1054e2d7bef2100ad23b24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sinary_winaudio-0.1.0-cp310-cp310-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 256.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f0d0fb3685f506a669c05eae3d01e358cfa9b717fd2ab721cdf86685bd5a92b8
|
|
BLAKE2b-256 checksum How to use checksums |
f9ee0d2a6007e2856e241e750a149450bdae67db613b98f226df675c9c20c2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sinary_winaudio-0.1.0-cp39-cp39-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 256.8 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
59b5821a3ca27959e69f5984dd5d3a388c6bb0b26fdedd3cda725e68fee82c12
|
|
BLAKE2b-256 checksum How to use checksums |
c1b603336db1e4e65a0c6056149ced813d42b4d7978a4532b327ce7f6e05d5ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sinary_winaudio-0.1.0-cp38-cp38-win_amd64.whl
| Download URL | sinary_winaudio-0.1.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 256.6 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
02bde9afd0636c65d15687b7262b21cc50e67cdfaa6982384245dab4c027e563
|
|
BLAKE2b-256 checksum How to use checksums |
86c56c7e98298ccbe03553419b618bc025a5d3dbae5d845c8408c82a03d86c58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for sinary-winaudio 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.