Hobby build — 2025 – 2026
A webcam watches both of my hands. The shape each hand makes picks a note, a chord or a drum, how fast I make it sets how loud it plays, and moving the hand bends the sound. Everything can be looped, saved as MIDI or scored in a rhythm game.

01 — The story
Gesture Music turns an ordinary webcam into a musical instrument. Hold up one finger and it plays a note; hold up two and it plays the next one. A closed fist is silence. With the extended set, each hand has eight signs, a full octave on one hand.
Over time it grew into a small music studio: chords and drums for two hands, a looper with overdubs, live MIDI into music software, a rhythm game that writes its charts from your own songs, and a calibration wizard that learns how your fingers bend.
I also wrote a 61-page handbook that explains how to play it, how the code is built and the music and maths behind every part. It is at the end of this page.
Credit where it’s due
The hand tracking is Google’s MediaPipe: its Hand Landmarker finds 21 points on each hand in every frame, and its Selfie Segmenter separates me from the room. Everything after that (reading the signs, the sound, the looper, the game) is my own code, released under the MIT licence.
All credits and sources ↓
02 — Timeline
The start
MediaPipe gives 21 points on each hand. From the angles of each finger the code works out which fingers are up, and 1 to 4 raised fingers pick four notes. A fist means silence. This basic set is still the heart of the instrument.
Two hands, one band
Modes for Notes, Chords, Drums and Band, so the left hand can drum while the right plays chords. A real-time synthesizer with 10 instruments and a 12-piece drum kit, the extended set of 8 signs, repeats by tapping or pumping, and hand height for volume or pitch bend.

Record and share
A looper that records actions rather than audio, with overdub layers; live MIDI into music software; demo videos with the exact sound. The background blur went from 35 ms per frame in its first version to about 1 ms, by running alongside hand tracking.
Play along
Song sheets scroll toward a hit line, and you make the right sign on the beat: Perfect, Good or Miss, combos, grades and best scores.

Released, with a handbook
The code goes up under the MIT licence with the handbook. This edition adds calibration, hand sessions, a metronome and quantise, MIDI files, strike dynamics, a mixer with reverb, key-mapping presets, ghost-hand hints, and songs made from your own music files.

03 — What it does

Play
Notes, Chords, Drums, Band, Custom (your own sound on every sign) and Song, where a song sheet chooses every sound.
Shape
A quick, snappy sign plays louder than a slow one. Raise your hand for volume, or move it while holding a sign to bend the pitch by up to two semitones.
Sound
Ten instruments made live from sine waves, from piano to flute, chosen separately for each hand, with its own volume and reverb.
Record
Stack loop layers over a metronome with count-in and quantise. Send everything to a DAW over MIDI, or save it as a MIDI file.
Game
Add an MP3, WAV or MIDI file: it finds the tempo, the first bar, the key, the chords and the tune, and writes a chart to play along to.
See
The room behind you can become a flowing colour field, with each note in Scriabin’s colour for it, blooming as you play.
04 — Under the hood
Every frame follows the same path. The camera thread keeps only the newest image, MediaPipe locates 21 points on each hand, and the code turns finger angles into a sign. The sign becomes a small musical event such as “note on, D4, strength 0.85, right hand”, and that one event goes to the synthesizer, the MIDI port and the looper at the same time.
The tricky part is making a sign feel solid. A finger half-way between up and down would flicker, so each finger has two lines instead of one, and a new sign must be seen in two frames before it plays. Try it below.
Drag the slider. Going down, the finger only flips to DOWN past the second line; coming back up, it stays DOWN until it crosses the first. In between it keeps whatever it was, so a half-bent finger never flickers.
Within 100 ms of the target is Perfect, within 220 ms is Good, anything later or earlier is a Miss. The game times the frame where the sign first appeared, so the confirmation frame does not count against you.
Which file does what
| Job | Module |
|---|---|
| Keep the newest camera image | camera.py |
| Read, confirm and time hand signs | gestures.py |
| Fit thresholds to your hands | calibration.py |
| Choose notes, dispatch events | gesture_music.py |
| Draw the window, mouse and keys | ui.py |
| Make the sound, mix and reverb | sound_engine.py · drums.py |
| Live MIDI and MIDI files | midi_out.py · midi_file.py |
| Loop recorded actions | looper.py |
| Charts, timing and scoring | game.py |
| Turn a music file into a chart | audio_analysis.py · songmaker.py |
Where the delay goes
| Stage | Typical time |
|---|---|
| Camera frame at 30 fps | 33 ms |
| Hand tracking | 10–16 ms |
| Sign confirmation | 1 frame |
| Background blur (in parallel) | ≈ 1 ms |
| Audio block | 5.8 ms |
| Audio output (WASAPI) | 23 ms |
05 — Credits, inspiration and sources
Gesture Music stands on open-source libraries and published research. Thank you to everyone below.
| Library | Used for | Licence |
|---|---|---|
| MediaPipe (Google) | hand landmarks, person segmentation | Apache 2.0 |
| OpenCV | webcam, image processing, video | Apache 2.0 |
| NumPy | synthesis, reverb, music analysis | BSD-3 |
| pygame | the window, drawing, input, MIDI backend | LGPL 2.1 |
| sounddevice / PortAudio | real-time audio output | MIT |
| soundfile / libsndfile | reading music files | BSD-3 / LGPL 2.1 |
| mido | MIDI messages and files | MIT |
| FFmpeg (optional) | merging demo audio and video | LGPL / GPL |
Ideas and research
The code
Gesture Music’s own code is MIT-licensed, © 2026 rayangmendrofa. It runs on Windows with Python 3.13 and a webcam, and has a camera-free demo mode.
Open the repository ↗06 — The handbook
Thirteen illustrated pages first, then the full handbook: how to play, how to calibrate, how the code is built, and the theory behind it, from finger angles and smoothing filters to sound synthesis, MIDI and music analysis.





























































Discussion
Register with your email to join the discussion
No comments yet. Be the first to share your thoughts.
Hobby build — 2025 – 2026
A webcam watches both of my hands. The shape each hand makes picks a note, a chord or a drum, how fast I make it sets how loud it plays, and moving the hand bends the sound. Everything can be looped, saved as MIDI or scored in a rhythm game.

01 — The story
Gesture Music turns an ordinary webcam into a musical instrument. Hold up one finger and it plays a note; hold up two and it plays the next one. A closed fist is silence. With the extended set, each hand has eight signs, a full octave on one hand.
Over time it grew into a small music studio: chords and drums for two hands, a looper with overdubs, live MIDI into music software, a rhythm game that writes its charts from your own songs, and a calibration wizard that learns how your fingers bend.
I also wrote a 61-page handbook that explains how to play it, how the code is built and the music and maths behind every part. It is at the end of this page.
Credit where it’s due
The hand tracking is Google’s MediaPipe: its Hand Landmarker finds 21 points on each hand in every frame, and its Selfie Segmenter separates me from the room. Everything after that (reading the signs, the sound, the looper, the game) is my own code, released under the MIT licence.
All credits and sources ↓
02 — Timeline
The start
MediaPipe gives 21 points on each hand. From the angles of each finger the code works out which fingers are up, and 1 to 4 raised fingers pick four notes. A fist means silence. This basic set is still the heart of the instrument.
Two hands, one band
Modes for Notes, Chords, Drums and Band, so the left hand can drum while the right plays chords. A real-time synthesizer with 10 instruments and a 12-piece drum kit, the extended set of 8 signs, repeats by tapping or pumping, and hand height for volume or pitch bend.

Record and share
A looper that records actions rather than audio, with overdub layers; live MIDI into music software; demo videos with the exact sound. The background blur went from 35 ms per frame in its first version to about 1 ms, by running alongside hand tracking.
Play along
Song sheets scroll toward a hit line, and you make the right sign on the beat: Perfect, Good or Miss, combos, grades and best scores.

Released, with a handbook
The code goes up under the MIT licence with the handbook. This edition adds calibration, hand sessions, a metronome and quantise, MIDI files, strike dynamics, a mixer with reverb, key-mapping presets, ghost-hand hints, and songs made from your own music files.

03 — What it does

Play
Notes, Chords, Drums, Band, Custom (your own sound on every sign) and Song, where a song sheet chooses every sound.
Shape
A quick, snappy sign plays louder than a slow one. Raise your hand for volume, or move it while holding a sign to bend the pitch by up to two semitones.
Sound
Ten instruments made live from sine waves, from piano to flute, chosen separately for each hand, with its own volume and reverb.
Record
Stack loop layers over a metronome with count-in and quantise. Send everything to a DAW over MIDI, or save it as a MIDI file.
Game
Add an MP3, WAV or MIDI file: it finds the tempo, the first bar, the key, the chords and the tune, and writes a chart to play along to.
See
The room behind you can become a flowing colour field, with each note in Scriabin’s colour for it, blooming as you play.
04 — Under the hood
Every frame follows the same path. The camera thread keeps only the newest image, MediaPipe locates 21 points on each hand, and the code turns finger angles into a sign. The sign becomes a small musical event such as “note on, D4, strength 0.85, right hand”, and that one event goes to the synthesizer, the MIDI port and the looper at the same time.
The tricky part is making a sign feel solid. A finger half-way between up and down would flicker, so each finger has two lines instead of one, and a new sign must be seen in two frames before it plays. Try it below.
Drag the slider. Going down, the finger only flips to DOWN past the second line; coming back up, it stays DOWN until it crosses the first. In between it keeps whatever it was, so a half-bent finger never flickers.
Within 100 ms of the target is Perfect, within 220 ms is Good, anything later or earlier is a Miss. The game times the frame where the sign first appeared, so the confirmation frame does not count against you.
Which file does what
| Job | Module |
|---|---|
| Keep the newest camera image | camera.py |
| Read, confirm and time hand signs | gestures.py |
| Fit thresholds to your hands | calibration.py |
| Choose notes, dispatch events | gesture_music.py |
| Draw the window, mouse and keys | ui.py |
| Make the sound, mix and reverb | sound_engine.py · drums.py |
| Live MIDI and MIDI files | midi_out.py · midi_file.py |
| Loop recorded actions | looper.py |
| Charts, timing and scoring | game.py |
| Turn a music file into a chart | audio_analysis.py · songmaker.py |
Where the delay goes
| Stage | Typical time |
|---|---|
| Camera frame at 30 fps | 33 ms |
| Hand tracking | 10–16 ms |
| Sign confirmation | 1 frame |
| Background blur (in parallel) | ≈ 1 ms |
| Audio block | 5.8 ms |
| Audio output (WASAPI) | 23 ms |
05 — Credits, inspiration and sources
Gesture Music stands on open-source libraries and published research. Thank you to everyone below.
| Library | Used for | Licence |
|---|---|---|
| MediaPipe (Google) | hand landmarks, person segmentation | Apache 2.0 |
| OpenCV | webcam, image processing, video | Apache 2.0 |
| NumPy | synthesis, reverb, music analysis | BSD-3 |
| pygame | the window, drawing, input, MIDI backend | LGPL 2.1 |
| sounddevice / PortAudio | real-time audio output | MIT |
| soundfile / libsndfile | reading music files | BSD-3 / LGPL 2.1 |
| mido | MIDI messages and files | MIT |
| FFmpeg (optional) | merging demo audio and video | LGPL / GPL |
Ideas and research
The code
Gesture Music’s own code is MIT-licensed, © 2026 rayangmendrofa. It runs on Windows with Python 3.13 and a webcam, and has a camera-free demo mode.
Open the repository ↗06 — The handbook
Thirteen illustrated pages first, then the full handbook: how to play, how to calibrate, how the code is built, and the theory behind it, from finger angles and smoothing filters to sound synthesis, MIDI and music analysis.





























































Discussion
Register with your email to join the discussion
{{cm.err}}
{{cm.err}}
No comments yet. Be the first to share your thoughts.
{{c.text}}