Code Monkey home page Code Monkey logo

wave-link-audio-wrapper's Introduction

๐Ÿ”‰ Wave Link Key Wrapper

This is a Python script that allows you to turn keys on your keyboard into volume controls for Elgato's Wave Link software, and displays a simple popup of the current volume level.

Elgato leaves a websocket open, currently on port 1824, that is intended to be used to communicate between their Wave Link and Stream Deck software. I utilize this websocket connection to send actions based upon whatever the current volume or mute status is.

โš™๏ธ How to Use

Prerequisites

  • Must be using Windows 10/11. This script does not support macOS.

Note

If you just want to use the script to control Wave Link and you remove the popup functionality, it should be compatible with macOS. I don't have a machine to test this on, so take this with a grain of salt.

  • You will need to have Elgato's Wave Link software installed for this to work. This script works as of the version: 1.10.1 (2293)

  • A "nerd font" is required to properly display icons. I use SpaceMono, but you can change the font to one of your chosing here: nerdfonts.com

Installation

  • Clone the repo with the command: git clone https://github.com/TheLtWilson/wave-link-audio-wrapper

  • In the cloned folder, install the required dependencies with the command: pip install -r requirements.txt

Running the Script

This small project was made to fit my own needs. If you want to change the keybindings, you will need to open the script and modify it yourself to fit your own needs.

I have the F13, F14, and F15 keys binded to a knob on my keyboard, as such the controls look like the following:

Knob Direction Key Action
Clockwise F13 Volume Up
Counter-clockwise F14 Volume Down
Knob Button F15 Toggle Mute

Once the script has been adjusted to your likings, you can simply run the script by opening it in your file manager and it will run in the background.

You can run the script on startup by adding a shortcut to it in your shell:startup folder.

โ„น๏ธ Notice: My script assumes you always want the script to be running, so if you want to close the script you will need to end the Python process or implement your own hotkey.

๐Ÿ“ƒ Available Functions

Here is a list of basic Wave Link functions that you can use to shape your own project to whatever fits for you.

Function Description Example
get_output_config() This function is ran when the script starts, and provides initial data for the volume and mute status of each mixer. get_output_config()
get_output_devices() This function is ran when the script starts, and displays all available output devices, and the currently selected output device in the log. You should add and label your output devices in the Output class. get_output_devices()
change_output_device(device: class Output) Changes the current output device to the one provided. You'll need to use the get_output_devices() function to setup your output class.' change_output_device(Output.Speakers)
set_output_volume(mixer: class Mixer, volume: int) Sets the output volume on the specified mixer to the provided volume. set_output_volume(Mixer.Stream, 75)
set_output_mute(mixer: class Mixer, value: bool) Sets the output mute status on the specified mixer to the provided value. set_output_mute(Mixer.Local, True)
set_input_volume(mixer: class Mixer, identifier: class Input, volume: int) Sets the volume of a specified input on the specified mixer to the provided volume. set_input_volume(Mixer.Local, Input.Browser, 50)
set_input_mute(mixer: class Mixer, identifier: class Input value: bool) Sets the specified input mute status to the specified mixer to the provided value. set_input_mute(Mixer.Stream, Input.Game, False)

Functions for my use case:

Warning

I don't actually keep track of the volume of the stream mixer. So passing a different mixer to these functions doesn't actually do anything. I'll fix it eventually.

Function Description Example
increase_output_volume(mixer: class Mixer) Gets the current output volume, and increases it by the step in the config file. It calls set_output_volume() to set the volume. increase_output_volume(Mixer.Local)
decrease_output_volume(mixer: class Mixer) Gets the current output volume, and decreases it by the step in the config file. It calls set_output_volume() to set the volume. decrease_output_volume(Mixer.Local)
toggle_output_mute(mixer: class Mixer) Gets the mute status of the output, and sets it to the opposite to toggle it. It calls set_output_mute() to set the volume. toggle_output_mute(Mixer.Local)

โš ๏ธ Handling Errors

Because the script is intended to run in the background without a terminal open, a log file is created in the directory where the script is located. This can be used to determine errors in the script, or get a gist of what the script is doing. As a matter of fact, you'll need to check the logs when you first start the script so that you can modify the script to include your own output devices.

wave-link-audio-wrapper's People

Contributors

theltwilson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tronnic trueniv

wave-link-audio-wrapper's Issues

Great Work ! But...

It's very good work, the code is well done and easy to understand, and it is the only code that offers an alternative to the SDK made by the community which is now abandoned, the only downside is that in your code you do not offer all the functions that we can have, such as changing the volume of the browser on the local or the stream (but you detect it which is already great!) another "negative" point is that a small wiki is missing which could help a lot to understand how the Wavelink Websocket works, if I had not tested your raw code I would not have understood that Wavelink uses an "indentifer" and the "name" to manage a audio output, I think fixing these two little things would make it a great base for anyone wanting to develop things with the WaveLink wbesocket ! And also the repos is pretty active for a small project like that so it's nice too :D

More Features

This is awesome! I'm wondering, where did you get the information on what to send to the websocket for commands?

I really want to be able to toggle between 2 devices for Monitor Mix with a Hotkey, or preferably programmatically with my audio manager.
Is there any way you could add this feature? Along with being able to adjust the levels of each audio input, this would basically be like a Stream Deck replacement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.