Tractus Volume Control HTTP API for Windows

Control the volume on a Windows PC from anywhere.

Windows
Last updated Aug 8, 2024

This app is a simple HTTP-based API for controlling output and input volume levels and mute status on a Windows PC. It will allow you to list out all your sound cards, plus inputs and outputs. You can control mute, unmute, and volume levels with simple HTTP requests.

If you’ve ever needed to remotely control microphone or speaker volumes on a Windows PC, this web API lets you do that.

I created this application to allow us to quickly remotely control audio on drone PCs sent to clients for virtual and hybrid productions.

Huge thanks to the NAudio project - this app uses the NAudio library for control.

How to Use

  1. Run Tractus.WinAudioControlApi.exe.
  2. Optional - provide the -p=1234 parameter to specify the HTTP port to listen on.

The app will listen on all interfaces (0.0.0.0).

Documentation is available on the /swagger route, and the OpenAPI specification is available at /swagger/v1/swagger.json.

Command Line Flags

FlagDescription
-p={port}The HTTP port to listen on. E.g. -p=9009 will have the app listen on port 9009.
-warnonlyChanges the log level to warnings and errors.
-debugChanges the log level to provide a lot of detail. Not recommended.

Routes

Output Control

RouteDescription
/outputsGets a list of output devices currently connected to the PC. Use ?all=true to list all output devices regardless of connection state.
/outputs/statusGets a JSON dictionary of output device volumes and mute status. Use ?all=true to list all output devices regardless of connection state.
/output/{id}/muteMutes an output device. {id} is the ID of the device as provided by /outputs.
/output/{id}/unmuteUnmutes an output device. {id} is the ID of the device as provided by /outputs.
/output/{id}/mute/toggleUnmutes or mutes an output device based on its current state. {id} is the ID of the device as provided by /outputs.
/output/{id}/volume/{level}Sets the volume level, from 0.0 to 1.0, of an output device. {id} is the ID of the device as provided by /outputs.

Input Control

RouteDescription
/inputsGets a list of input devices currently connected to the PC. Use ?all=true to list all input devices regardless of connection state.
/inputs/statusGets a JSON dictionary of input device volumes and mute status. Use ?all=true to list all input devices regardless of connection state.
/input/{id}/muteMutes an input device. {id} is the ID of the device as provided by /inputs.
/input/{id}/unmuteUnmutes an input device. {id} is the ID of the device as provided by /inputs.
/input/{id}/mute/toggleUnmutes or mutes an input device based on its current state. {id} is the ID of the device as provided by /outputs.
/input/{id}/volume/{level}Sets the volume level, from 0.0 to 1.0, of an input device. {id} is the ID of the device as provided by /inputs.

Miscellaneous

RouteDescription
/appinfoGets the version and build platform of the app.
/swaggerProvides a list of routes.
/swagger/v1/swagger.jsonProvides an OpenAPI documentation endpoint for the app.

Important Notes

  • This app was tested on Windows 11.
  • There are no security safeguards - it is not recommended to expose this to a hostile network.

License

This project is licensed under the GNU General Public License (GPL) version 2. It is free to use for any purpose, personal or commercial.

For paid support options, please contact us.