Skip to main content

winappaudiorouter

CI Coverage Docs PyPI Version Python Versions License Platform

winappaudiorouter is a Python library for changing output and input audio devices per app on Windows, without requiring external tools. It follows the same Windows routing path used by EarTrumpet/SoundVolumeView: Windows.Media.Internal.AudioPolicyConfig::SetPersistedDefaultAudioEndpoint.

Full documentation lives at https://winappaudiorouter.readthedocs.io/.

Features

  • Enumerate active output and input devices.
  • Enumerate active app audio sessions for output or input flows.
  • Read persisted app output or input devices by PID or process name.
  • Route one app PID (or all active sessions by process name) to a target output or input device.
  • Clear persisted app routing (return to system default).
  • CLI + Python API.

Installation

pip install winappaudiorouter

For local development:

pip install -e .[dev]

CLI Usage

winappaudiorouter list-devices
winappaudiorouter list-devices --flow input
winappaudiorouter list-sessions
winappaudiorouter list-sessions --flow input
winappaudiorouter route --process-name chrome.exe --device "Headphones"
winappaudiorouter route --flow input --process-name obs64.exe --device "USB Mic"
winappaudiorouter route --pid 1234 --device "{0.0.0.00000000}.{GUID}"
winappaudiorouter clear --process-name chrome.exe
winappaudiorouter clear --flow input --pid 4567
winappaudiorouter get --pid 1234
winappaudiorouter get --flow input --process-name obs64.exe
winappaudiorouter get --process-name chrome.exe  # Get the current device for all chrome.exe processes

--flow accepts output (default) or input.

Python Usage

import winappaudiorouter as war

output_devices = war.list_output_devices()
input_devices = war.list_input_devices()
output_sessions = war.list_app_sessions()
input_sessions = war.list_input_sessions()

war.set_app_output_device(process_name="chrome.exe", device="Headphones")
war.clear_app_output_device(process_name="chrome.exe")
war.get_app_output_device(process_name="chrome.exe")  # {} means <system default>

war.set_app_input_device(process_name="obs64.exe", device="USB Mic")
war.clear_app_input_device(process_name="obs64.exe")
war.get_app_input_device(process_name="obs64.exe")  # {} means <system default>

Running tests

python -m pytest -q
python -m pytest --cov=winappaudiorouter --cov-report=term-missing --cov-report=xml
python -m sphinx -W --keep-going -b html docs docs/_build/html

CI and PyPI publish

  • CI tests/build run on push and pull requests.
  • Coverage is uploaded to Codecov from the main branch CI workflow.
  • Documentation is published on Read the Docs.
  • PyPI publish workflow runs on tag pushes like v1.0.1.
  • GitHub repo secrets required: PYPI_API_TOKEN, RTD_API_KEY, and CODECOV_TOKEN.

Contribution guidelines

Please read CONTRIBUTING.md before opening a pull request.

License

This project is licensed under the MIT License. See LICENSE.

Limitations

  • Windows 10 1803+ only.
  • process_name routing requires at least one active audio session for that app in the selected flow.
  • Session re-binding can be asynchronous; some apps require playback or recording restart.

Metadata

Release files for winappaudiorouter 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for winappaudiorouter 1.1.1
File Size Uploaded Provenance Actions
winappaudiorouter-1.1.1.tar.gz 22.0 kB Without provenance Details for winappaudiorouter-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for winappaudiorouter 1.1.1
File Interpreter ABI Platform Actions
winappaudiorouter-1.1.1-py3-none-any.whl Python 3 none any Details for winappaudiorouter-1.1.1-py3-none-any.whl

Total release size: 36.5 kB

Release files / winappaudiorouter-1.1.1.tar.gz

Download URL winappaudiorouter-1.1.1.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
10f89dc91ffcd21a3c938f892f53c0523582d6d9b3e6565d110470479448113d
BLAKE2b-256 checksum
How to use checksums
32216a16e93ad68e62422de5b6b279c41eb6a5956cb054639d2df357b76020d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / winappaudiorouter-1.1.1-py3-none-any.whl

Download URL winappaudiorouter-1.1.1-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44c5e3d69ede2f29ccb9e9a51d674b14021ec67a646ee8b2d7069a2ad9f32272
BLAKE2b-256 checksum
How to use checksums
48b7d06ea62437db3c6a821cf8881f2fdd394303f78aac8967c481b885dcdb7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for winappaudiorouter 1.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page