Run shell commands from your piano
Linux CLI tool to assign shell commands to keys or knobs on a USB MIDI Keyboard/Controller
# options:
# find by port number. (e.g. pianoterm -p 22)
# find by device name. (e.g. pianoterm -n "Digital Piano")
# specify config path. (e.g. pianoterm -p 22 -c ~/path/to/config)
pianoterm [-p|-n] <port | name> [-c] <config_path>Note:
- It will keep trying to connect until it finds the port, use ctrl+c to stop it
- You must have aconnect and aseqdump in your path
- You can use 'acconect -i' to find the port/name
- default path: ~/.config/pianoterm/config
## Control audio playback
on_press
21 = playerctl previous # first key on an 88-key keyboard
22 = playerctl play-pause
23 = playerctl next
## Map directly to keyboard keys (Wayland)
on_press
107 = ydotool key 108:1
108 = ydotool key 103:1
on_release
107 = ydotool key 108:0
108 = ydotool key 103:0
## Run custom scripts
69 = /home/me/my_script.sh
## Assign multiple commands to run sequentially on the same key press
60 = notify-send "command 1"
60 = notify-send "command 2"
## Map controller events (pedal presses, knob switches, ...)
64 (127) = notify-send "Pressed pedal" # 127 in this case is the max pedal output
64 (0) = notify-send "Released pedal"- Keys and buttons:
# Default - on_press
[on_press|on_release|on_hold]
key = command- Controllers (pedals, knobs, etc.):
# Must include a trigger value
# A trigger is numeric value greater than 0. (usually the pressure on a pedal, the volume on a knob, etc.)
key (trigger) = commandNotes:
- A different key and controller can share the same key.
- You can use aseqdump -p to find keycodes and controller values.
git clone https://github.com/vustagc/pianoterm.git
cd pianoterm && make- C compiler
- alsactl (1.2.15.2)
- make (optional)
supertux_piano_demo.mp4
- chord on_press support
- allow config to use standard notation (C#1 = "echo hello")
- reload config file
- check if instance already running on the same port