Skip to content

jonathan-tyler/audio-device-switcher-pycaw

Repository files navigation

Audio Device Switcher

Switch the Windows default audio output device by name.

Uses pycaw to enumerate active render devices and set the default output.

Recommended: install via wsl-sys-cli instead for WSL integration.

Installation

Install dependencies into Windows Python:

python.exe -m pip install -r requirements.txt

WSL Integration

Install wsl-sys-cli

# Switch to a Windows audio device named "speakers"
sys switch speakers

# Switch to a Windows audio device named "headphones"
sys switch headphones

(Optional) Standalone

python.exe __main__.py --switch-audio-device speakers
python.exe __main__.py --switch-audio-device headphones

Development (WSL)

This sub-project is Windows-only at runtime, but you can still develop it from WSL.

  • The Windows runtime dependencies in requirements.txt are guarded with environment markers, so in WSL they will be skipped.
  • For editor type-checking in WSL (Pylance/Pyright), the repo provides local stub packages under mswin/typings/.

Recommended WSL setup:

# In your WSL virtualenv (or whatever Python you use for editing/tools)
python -m pip install -r requirements-wsl-dev.txt

Notes:

  • If Pylance still shows unresolved imports after pulling changes, reload the VS Code window or restart the Pylance language server.
  • To actually run the switcher, install dependencies into Windows Python and execute via python.exe as shown above.

About

Set the Windows default audio output device by name using pycaw.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages