Physical Computing Meets AI
re:Button transforms physical MIDI controllers into intelligent command centers for your digital life—similar to StreamDeck, but open-source, DIY, and much more powerful.
The Concept
Imagine creating your own keyboard but instead of regular keys, it triggers smart shortcuts that help you operate your life. Press a button to check your bank balance, turn a knob to control system volume, launch project workspaces, control media playback, or trigger custom workflows with a single touch.
How It Works
Connect any MIDI controller to your computer. re:Button listens for MIDI events and executes configured actions—from simple keystrokes to complex shell commands, API calls, or AI-powered workflows. The Presonus ATOM (US$ 136) offers 16 pads, 8 knobs, and 20 buttons, but any MIDI device works.
Configuration Made Simple
Markdown-Based Mapping
Define your shortcuts in a simple markdown file (rebutton-config.md). Each line maps a MIDI note or control to an action:
# Quick Responses
- 109[control_change]=osascript -e 'tell application "System Events" to keystroke "y"'
- 107[control_change]=osascript -e 'tell application "System Events" to keystroke "n"'
# Launch Apps
- 96[note_on]=/Applications/Kiro.app/Contents/MacOS/Electron ~/code/project
- 92[note_on]=open -a "Microsoft PowerPoint"
# Media Control
- 86[note_on]=open -a Spotify && osascript -e 'tell application "Spotify" to play'
- 14[control_change]=osascript -e "set volume output volume $value"
# Smart Shortcuts
- 112[note_on]=balance=$(curl -s http://localhost:8080/api/balance | jq -r '.balance'); python3 text_to_speech.py "Your balance is $balance"
The format is simple: note_number[event_type]=command. Variables like $value and $velocity get replaced with actual MIDI values.
- 14[control_change]=osascript -e "set volume output volume $value"
Using Kiro CLI for Mapping
Leverage Kiro's AI capabilities to help you create and manage your button mappings:
- Discover MIDI events: Run
rebutton-mqtt.py to see which notes/controls your device sends
- Generate commands: Ask Kiro to create shell commands for your desired actions
- Build workflows: Use Kiro to chain multiple commands or integrate with APIs
- Optimize mappings: Let Kiro suggest ergonomic button layouts based on usage patterns
# Ask Kiro to help
kiro-cli chat
> "Help me create a rebutton config that opens my project folders
on buttons 96-99 and controls Spotify on buttons 86-87"
> "Generate a command to check my bank balance via API and
speak it using text-to-speech"
> "I have 16 pads. Suggest an ergonomic layout for:
4 project launchers, 4 media controls, 4 quick responses"
Getting Started
What You Need
- Any MIDI controller (Presonus ATOM recommended, US$ 136)
- Python 3 with
mido, python-rtmidi, and paho-mqtt libraries
- Optional: MQTT broker for IoT integration and debugging
Installation
pip install mido python-rtmidi paho-mqtt
# On macOS, you might also need:
brew install portmidi
Quick Start
- Connect your MIDI controller via USB
- Run
python3 rebutton-mqtt.py to discover button numbers
- Create your
rebutton-config.md file with mappings
- Run
python3 rebutton.py and start pressing buttons
The Code (Less Than 30 Lines)
#!/usr/bin/env python3
import mido, re, subprocess
def parse_config(filename):
config = {}
with open(filename) as f:
for line in f:
match = re.match(r'^-\s*(\d+)\[(\w+)\]=(.+)$', line.strip())
if match:
note, event_type, command = match.groups()
config[(int(note), event_type)] = command.strip()
return config
config = parse_config("rebutton-config.md")
midi_port = mido.open_input(mido.get_input_names()[0])
for msg in midi_port:
key = (getattr(msg, 'note', None) or getattr(msg, 'control', None), msg.type)
if key in config:
command = config[key].replace('$value', str(getattr(msg, 'value', '')))
subprocess.Popen(command, shell=True)
Why This Matters
re:Button is part of the Renascence Computing vision—rethinking how we interact with computers to serve our lives, not the other way around.
Tangible Interface
Physical buttons create a tangible interface to your digital life. Instead of context-switching between apps and memorizing shortcuts, you have dedicated controls for what matters most.
AI-Powered Evolution
Combined with AI (via Kiro), you can rapidly prototype and evolve your interface. The barrier between "I wish I could..." and "Done!" shrinks to minutes.
Infinitely Customizable
Your button layout will be completely different from anyone else's because your life and workflows are unique. What will you put on your buttons?
Join the Revolution
re:Button is open source and actively developed as part of the Renascence Computing ecosystem.
Contribute your configurations, suggest features, or build integrations with re:OS and re:Money. Check out the GitHub repository or read the full step-by-step guide on dev.to.