Deej - Physical Volume Sliders Per-application

About the project

Arduino project for controlling per-application audio volume with physical sliders

Project info

Difficulty: Easy

Platforms: Arduino

Estimated time: 1 hour

License: MIT license (MIT)

Items used in this project

Hardware components

Arduino Uno - R3 Arduino Uno - R3 Any controller with Serial capabilities and enough analog I/O pins for your desired amount of sliders will do here! x 1
Slide Potentiometer with Plastic Knob - 45mm Long - 10K Slide Potentiometer with Plastic Knob - 45mm Long - 10K You can use knobs too if you prefer those. x 5

Software apps and online services

Windows PC Windows PC The OS-side app I wrote only supports Windows at the moment.
Python 2.7 Python 2.7 You need a tiny bit of Python background to customize the sliders to your desired apps. It's really easy, I promise!

Story

deej is an Arduino project for controlling audio volume for separate Windows apps with physical sliders (like a DJ!) Full source code and documentation are available on GitHub.

Ever since I was a child, I loved all kinds of buttons and knobs.  Elevators were my favorite place to be. When I was 3, I had a Boston hotel evacuated because its fire alarm looked all kinds of shiny to me. My obsession with physical controls that are tactile and give you instant feedback hasn't gone anywhere in the years since, and a few months ago I decided to finally do something about it and build myself a box that I've been wanting for a while.

As a PC gamer I often find myself balancing audio levels between several sources at once - the game I'm playing vs. music from Spotify or a video from YouTube, voice chat from Discord vs. game audio and background music, etc.

Balancing these manually can be a pain, especially mid-game - you have to pause (which you sometimes can't) to open an options menu, or even tab out to find the other program's volume slider, or you have to use Windows' Mixer.

Enter deej:

How it works

Hardware

  • The sliders are connected to 5 analog pins on an Arduino Uno board. They're powered from the board's 5V output (see schematic)
  • The board connects via a USB cable to the PC

Software

  • The code running on the Arduino board is a C program constantly writing current slider values over its Serial interface deej-arduino.ino
  • The PC runs a Python script deej.py that listens to the board's Serial connection, detects changes in slider values and sets volume of equivalent audio sessions accordingly.
  • A VBScript-based run helper run.vbs allows this Python script to run in the background (from the Windows tray).

Slider mapping

A configuration is passed to the Deej object as follows:

    deej = Deej({
        'slider_mapping': {
            0: 'master',
            1: 'chrome.exe',
            2: 'spotify.exe',
            3: [
                'pathofexile_x64.exe',
                'rocketleague.exe',
            ],
            4: 'discord.exe',
        },
        'process_refresh_frequency': 5,
    })

  • Process names aren't case-sensitive
  • You can use a list of process names to either:
    • define a group that is controlled simultaneously
    • choose whichever process in the group is currently running (in this example, one slider is for different games that may be running)
  • master is a special option for controlling master volume of the system.
  • The process_refresh_frequency option limits how often deej may look for new processes if their appropriate slider moves. This allows you to leave deej running in background and open/close processes normally - the sliders will #justwork

How to run

To make sure you're using the correct up-to-date instructions, please check out the GitHub repository. Running deej is simple, and it runs silently in the background - all that's left for you is to push some sliders around!

Schematics, diagrams and documents

Arduino connection schematic

You can use a breadboard if you like, but I just tied the slider positive and grounds together and hooked up directly to the Arduino as shown.

Code

deej code repository on GitHub

Contains both the arduino code to upload (deej-arduino.ino), and the Python app that you'll need to run on the PC.

Credits

Leave your feedback...