An interactive virtual guitar powered by Computer Vision, MediaPipe and Python, allowing users to play guitar chords in real time using only hand gestures and motion tracking.
Air Guitar Motion Studio transforms your webcam into a playable musical instrument.
Using real-time hand tracking, the system detects:
- Chord selection gestures
- Strumming motions
- Dynamic capo adjustments
The project combines gesture recognition, audio processing and interactive UI systems to simulate an air guitar experience without any physical hardware.
- Real-time webcam hand tracking
- Gesture-based chord selection
- Motion-controlled strumming
- Live chord playback
- Adjustable capo system
- Low-latency audio response
- Interactive chord grid UI
- Automatic audio silence trimming
- Dynamic pitch shifting for capo simulation
Your left hand selects chords from the visual grid displayed on screen.
Supported chords:
- C
- D
- E
- F
- G
- A
- Em
- Am
- Gm
Your right hand performs downward strumming motions.
The system:
- Tracks hand landmarks using MediaPipe
- Detects rapid vertical hand movement
- Triggers real-time chord playback
- OpenCV → Webcam input & rendering
- MediaPipe Hands → Real-time hand landmark tracking
- Pygame Mixer → Real-time sound playback
- Pydub → Audio preprocessing & silence trimming
- NumPy → Dynamic pitch shifting & interpolation
- Handedness detection
- Motion threshold analysis
- Strumming cooldown logic
- Grid-based chord mapping
.
├── assets/
│ └── chords/
│ ├── C.wav
│ ├── D.wav
│ ├── E.wav
│ └── ...
├── main.py
├── requirements.txt
└── README.md
git clone https://github.com/chngzyashley-spec/air-guitar.git
cd air-guitarpython3 -m venv .venv
source .venv/bin/activatepython -m venv .venv
.venv\Scripts\activateIf you are using VS Code, make sure your Python Interpreter is set to the .venv environment.
pip install -r requirements.txt| Key | Action |
|---|---|
[ |
Decrease capo |
] |
Increase capo |
0 |
Reset capo |
q |
Quit application |
- Hover over the chord grid to select chords
- Perform downward strumming gestures to play
- Python
- OpenCV
- MediaPipe
- Pygame
- NumPy
- Pydub
- Computer Vision
- Gesture Recognition
- Audio Signal Processing
This project explores:
- Real-time Computer Vision
- Gesture recognition systems
- Audio signal processing
- Human-computer interaction
- Interactive media applications