- Java 98.2%
- Nix 1.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
Some checks failed
Java CI with Maven / build (push) Has been cancelled
fix: restore mute LED state on app start |
||
| .github/workflows | ||
| .idea | ||
| doc | ||
| src/main | ||
| .envrc | ||
| .gitignore | ||
| dependency-reduced-pom.xml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| pom.xml | ||
| README.md | ||
Alternative repos:
https://github.com/Katacc/Midi-pw-mixer
https://codeberg.org/Katacc/Midi-pw-mixer
Getting started
Prequisites
- Java 21 JDK or JRE
- Pipewire
- pw-dump
- wpctl
- User configuration file
- Korg nanoKONTROL2
Installation
You can either grab the repo and compile the software with maven using
$ mvn package
$ cd target
$ java -jar midi-mixer-<VERSION>.jar # Run the program
$ java -jar midi-mixer-<VERSION>.jar & disown # To send the program to background
Or just grab the latest build from release, I will include a bash script for easier launching of the application, then just put them into your PATH and autostart on login if you want to
Usage
This software relies on the user configuration file. Please create a folder and
a file in your /home/user/.config/ The folder and configuration files should
be /home/user/.config/midi-mixer/config.ini
The config allows you to map applications to faders (rectangles), knobs (circles) and buttons (squares):
Green controls are freely assignable and not preassigned. Transport and cycle controls (buttons 41 [play-pause], 42 [stop], 43 [previous], 44 [next] and 46 [cycle]) are also freely assignable, but are preassigned to their standard functions when not specified in configuration.
Here is a configuration file example:
[fader 5]
application = spotify
[fader 6]
application = Zen
[fader 7]
application = Last Epoch.exe:Warframe.x64.exe
[button 55]
application = Last Epoch.exe:Warframe.x64.exe
action = mute
[knob 16]
application = Firefox
# assign default behaviour of #43 and #44 (prev/next) to #58 and #59, change #43 and #44 to offset -/+ 15
[button 58]
action = previous
[button 59]
action = next
[button 43]
action = position
offset = -15
[button 44]
action = position
offset = +15
Follow the same syntax to add the rest of the faders, knobs and applications to map to the faders or knobs.
The faders IDs are from left to right 0 - 7 and the knob IDs are 16 - 23. To map spotify to the leftmost fader you would type
[fader 0]
application = spotify
To map Firefox to the leftmost knob you would type
[knob 16]
application = Firefox
To map Firefox mute/unmute to the leftmost "M" button you would type
[button 48]
application = Firefox
action = mute
To map seeking forward/backward to buttons, you can configure position actions with an offset:
[button 51]
action = position
offset = +5
[button 52]
action = position
offset = -5
Supported button actions include:
mute: Toggles mute for the mapped application(s) or node(s). LED state syncs to the mute state of the respective sink/source. You may need to set your nanoKONTROL2 mode setting to "External" in the original nanoKONTROL2 software.position: Seeks playback position by an arbitraryoffset(e.g.,+5or-5) viaplayerctl.play-pause: Toggles media play/pause viaplayerctl(default for button 41).stop: Stops media playback viaplayerctl(default for button 42).previous: Jumps to the previous track viaplayerctl(default for button 43).next: Jumps to the next track viaplayerctl(default for button 44).cycle: Reloads the configuration file (default for button 46).
You can map any pipewire node to any fader, knob or button, i.e. not only applications, but also for example output and devices:
[fader 6]
application = alsa_output.usb-Beyerdynamic_FOX_5.00-00.analog-stereo
[fader 22]
application = alsa_input.usb-Beyerdynamic_FOX_5.00-00.mono-fallback.3
[knob 54]
application = alsa_output.usb-Beyerdynamic_FOX_5.00-00.analog-stereo
You can force reconfiguration with cycle button from midiKONTROL2. This is
required if you open up a application after starting midi-mixer
(This way we avoid any time based configuration parsing that would lead to constant CPU usage for the time calculations)
Logging and Debugging
You can set the log level using the -l (--log-level) parameter. Valid values
are TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Defaults to INFO. DEBUG dumps
raw MIDI messages received and Pipewire commands sent.
$ java -jar midi-mixer-<VERSION>.jar -l DEBUG # Run the program with DEBUG log level
$ java -jar midi-mixer-<VERSION>.jar -l OFF # Run the program without logging
The -d (--debug) parameter is deprecated and is equivalent to -l DEBUG.
Changing cooldown time for Pipewire ID refreshes
If a Pipewire node is not found (because for example it was not active while pw-mixer was started), the program will try to refresh the Pipewire ID every 10000ms.
That cooldown time can be changed through the -c parameter:'
$ java -jar midi-mixer-<VERSION>.jar -c 1000 # Change the cooldown to 1000ms
Future and additions
This project was meant to target my specific setup, but if enough interest rises, I might add support for other configurations. If you want a feature added, be sure to make an issue or pull request with the added feature, or make a fork for yourself :)