Beyond text quizzes
Maths and English work beautifully as text-based tutors. The kid types an answer, the tutor checks it, screen time is earned. Simple loop, clean feedback.
Music is different. You can't tutor someone on the piano through text alone. You need to hear what they're playing — or at least see the notes. That's where the MIDI interface comes in.
The setup: two Pis, one keyboard
The idea is straightforward: plug a USB MIDI keyboard into a second Raspberry Pi (a 3B+ is more than enough), run a Python script that reads the MIDI data, and send it to the ClawTutor Pi via MQTT. Melody — the Music tutor agent — picks it up and knows exactly what's being played.
The midi_sender.py runs on the Musik-Pi as a systemd service. It auto-detects USB MIDI devices — Korg, Yamaha, Roland, whatever you plug in. Every note press, every release, every velocity value gets published to MQTT topics on the ClawTutor Pi.
On the other end, music_receiver.py listens, aggregates the data into practice sessions, calculates how long the kid played, evaluates rhythm consistency, and feeds everything to the Melody agent inside OpenClaw.
What Melody actually does
Melody is a full tutor agent with her own personality, curriculum, and progress tracking — just like Matteo (Maths) and Nelly (English). But she has something the others don't: live instrument data.
She can see:
- 🎹 Which notes were played and in what order
- ⏱️ How long the practice session lasted
- 🥁 Rhythm score — how evenly and consistently the child played
- 📈 Progress over days and weeks
Here's what a typical Melody interaction looks like:
She can also quiz on music theory — note names, intervals, chord types, composer trivia — the same way Matteo quizzes on fractions. Text-based quizzes for theory, MIDI data for practice. Both earn screen time.
Screen time for practice
The reward system for Music is slightly different from the quiz-based subjects. Instead of per-answer credits, it's time-based:
| Action | Reward |
|---|---|
| 1 minute of practice | +2 min screen time |
| Rhythm score ≥ 75/100 | +25% bonus |
| 3+ day streak | +20% bonus |
| Theory quiz (correct answer) | +10 min |
The bonuses stack. A kid who practices 10 minutes with good rhythm on a 3-day streak earns 30 minutes of screen time (20 base + 25% rhythm + 20% streak). That's a strong incentive to keep showing up at the keyboard.
Hardware: what you need
The Musik-Pi is intentionally cheap and simple:
- 🍓 Raspberry Pi 3B+ or newer — doesn't need to be fast
- 🎹 Any USB MIDI keyboard — Korg, Yamaha, Roland, Arturia, whatever you have
- 🔌 Power supply (2.5A minimum)
- 📶 WiFi connection to your home network
Total cost if you don't already have a Pi: about €40–50. If you already have one lying around from another project, it's essentially free.
MQTT under the hood
The communication uses three MQTT topics:
clawtutor/music/notes— live note-on/note-off eventsclawtutor/music/session— end-of-session summary (duration, note count, rhythm score)clawtutor/music/control— control commands (start/stop/reset)
Mosquitto runs on the ClawTutor Pi as the MQTT broker. It's lightweight, stable, and needs zero maintenance once installed. The Musik-Pi connects over WiFi — no cables between the two Pis.
Why a second Pi?
USB MIDI needs a host device. The keyboard plugs into a USB port, and something has to read that data in real time. I could have connected the keyboard directly to the ClawTutor Pi, but I wanted the keyboard to be in the kids' room — and the ClawTutor Pi lives in the server closet. MQTT over WiFi solves that cleanly.
It also keeps the addon modular. If you don't want Music, you don't need the second Pi. If you do, you just add it — no changes to the main ClawTutor installation.
What's next for Melody
Right now, Melody tracks notes and rhythm. Future plans include:
- 🎼 Specific exercises ("play C major scale ascending") with automatic grading
- 🎵 Song recognition — detect when the child is playing a known piece
- 📊 Visual progress charts in the weekly report
- 🎤 Voice integration — singing along to keyboard accompaniment
The full addon documentation is on GitHub: addons/midi-interface. And you can see how it fits into the overall setup on the Oliver's Setup page.
— Oliver, Feb 2026