Skip to main content

Route Windows app audio output devices using the same policy API path as EarTrumpet.

Project description

winappaudiorouter

winappaudiorouter is a Python library for changing output 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.

Features

  • Enumerate active output devices.
  • Enumerate active app audio sessions.
  • Route one app PID (or all active sessions by process name) to a target output.
  • 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-sessions
winappaudiorouter route --process-name chrome.exe --device "Headphones"
winappaudiorouter route --pid 1234 --device "{0.0.0.00000000}.{GUID}"
winappaudiorouter clear --process-name chrome.exe
winappaudiorouter get --pid 1234

Python Usage

import winappaudiorouter as war

devices = war.list_output_devices()
sessions = war.list_app_sessions()

war.set_app_output_device(process_name="chrome.exe", device="Headphones")
war.clear_app_output_device(process_name="chrome.exe")

Running tests

python -m pytest -q

CI and PyPI publish

  • CI tests/build run on push and pull requests.
  • PyPI publish workflow runs on tag pushes like v1.0.1.
  • GitHub repo secret required: PYPI_API_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.
  • Session re-binding can be asynchronous; some apps require playback restart.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winappaudiorouter-1.0.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

winappaudiorouter-1.0.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file winappaudiorouter-1.0.0.tar.gz.

File metadata

  • Download URL: winappaudiorouter-1.0.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for winappaudiorouter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 03881454042027d3b502f4fdf18a9bb6fe4a203e2512daafcbf5878b3618118e
MD5 1ae315217f993c71ba8ec330be4c8ba3
BLAKE2b-256 f59016b98927813ee04067e983b9aa5d6d94509469ca6a60dc509ab50a4bae5d

See more details on using hashes here.

File details

Details for the file winappaudiorouter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for winappaudiorouter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30553cc082c87236bc88af681e13d9c536b9e73560eff73660a1f3f3b6addf6e
MD5 aa2d83d173b5e8dd5812227678e1778d
BLAKE2b-256 3d838d8bb884f244cdb360621b5a97d4bf48b7f8987757ed50c51414ab609757

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page