https://github.com/yeswanthvelugoti/ai-virtual-drumset
Virtual Drumset is a fun and interactive computer vision project built using Python and OpenCV. It lets users play a virtual drumset by simply moving colored objects (like pens or sticks) in front of a webcam. No physical drumset required!
https://github.com/yeswanthvelugoti/ai-virtual-drumset
ai drumset imutils opencv pyautogui python
Last synced: about 2 months ago
JSON representation
Virtual Drumset is a fun and interactive computer vision project built using Python and OpenCV. It lets users play a virtual drumset by simply moving colored objects (like pens or sticks) in front of a webcam. No physical drumset required!
- Host: GitHub
- URL: https://github.com/yeswanthvelugoti/ai-virtual-drumset
- Owner: YeswanthVelugoti
- Created: 2022-10-12T16:41:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-21T06:59:45.000Z (about 1 year ago)
- Last Synced: 2025-06-21T18:39:15.674Z (about 1 year ago)
- Topics: ai, drumset, imutils, opencv, pyautogui, python
- Language: Jupyter Notebook
- Homepage:
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฅ AI-Based Virtual Drumset ๐ต
A real-time virtual drumset built using Python and OpenCV that allows you to play drums using colored objects (like sticks or markers) tracked by your webcam. When a colored object enters predefined zones on the screen, the system triggers keyboard events to simulate drum hits.
---
## ๐ Features
- ๐ฏ **Color-based object tracking** using HSV masking.
- ๐ฅ **Live webcam feed** processing with OpenCV.
- โจ๏ธ **Keyboard simulation** using PyAutoGUI to trigger drum sounds.
- ๐ **Interactive hit zones** detected using contour analysis.
- โก **Real-time response** with optimized video frame handling.
---
## ๐ง How It Works
1. Capture webcam video using OpenCV.
2. Convert frames to **HSV color space** to isolate specific colors (e.g., red or blue).
3. Track motion of colored objects (drumsticks) by detecting contours.
4. Define **zones on the screen** where a hit triggers a specific keypress.
5. Use `pyautogui.press()` to simulate keypress events (e.g., mapped to drums in a DAW or online drum kit).
---
## ๐ ๏ธ Technologies Used
- Python 3.x
- OpenCV
- NumPy
- PyAutoGUI
- Imutils
---
## ๐ธ Screenshots
>

---
## ๐งช How to Run
### 1. Clone the repository:
```bash
git clone https://github.com/your-username/AI-virtual-drumset.git
cd AI-virtual-drumset
```
### 2. Install dependencies:
```bash
pip install opencv-python numpy pyautogui imutils
```
### 3. Run the script:
```bash
python virtual_drumset.py
```
Make sure your webcam is active. Use a red/blue colored object to simulate a drumstick.
---
## ๐ฏ Applications
- Virtual musical instrument interfaces
- Interactive music education tools
- Gesture-controlled interfaces
- Fun AI/Computer Vision projects for students and beginners
---
## ๐โโ๏ธ Author
**Yeswanth Sai Kumar Velugoti**
[Email](mailto:yeswanthvelugoti@gmail.com) โข [LinkedIn](https://www.linkedin.com/in/yeswanth-velugoti-4290741a0/)