Giter Club home page Giter Club logo

deej's Introduction

deej

Arduino project for controlling audio volume for separate Windows processes using physical sliders (like a DJ!)

Video demonstration (click here)

Physical build

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

Schematic

Hardware schematic

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 (configuration)

deej uses an external YAML-formatted configuration file named config.yaml.

The config file determines which applications are mapped to which sliders, and which COM port/baud rate to use for the connection to the Arduino board.

This file auto-reloads when its contents are changed, so you can change application mappings on-the-fly without restarting deej.

It looks like this:

slider_mapping:
  0: master
  1: chrome.exe
  2: spotify.exe
  3:
    - 'pathofexile_x64.exe'
    - 'rocketleague.exe'
  4: discord.exe

# recommend to leave this setting at its default value
process_refresh_frequency: 5

# settings for connecting to the arduino board
com_port: COM4
baud_rate: 9600
  • 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

If you've actually gone ahead and built yourself this kind of box, here's how you can run deej:

Requirements

  • Python 2.7.x (Sorry!) and pip
  • virtualenv

Installation

  • Download the repository by either cloning it or downloading its archive.
  • In the repo's directory, run:
    • virtualenv venv
    • venv\Scripts\activate.bat
    • pip install -r requirements.txt
  • Make a shortcut to run.vbs by right-clicking it -> "Create Shortcut"
  • (Optional, but mandatory) Change the shortcut's icon to assets/logo.ico
  • (Optional, but optional) Copy the shortcut to %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup to have deej run on boot

Missing stuff

  • Better logging and error handling
  • Automatic COM port detection

deej's People

Contributors

omriharel avatar

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.