Created by: Arian Khademolghorani
The Air Drum Kit is a virtual drumming application that turns your webcam into a musical instrument. Using Computer Vision (OpenCV) and Color Tracking, it allows you to play drums in mid-air using any blue objectโlike a blue marker, a drumstick with blue tape, or even a blue toy.
- Real-time Color Tracking: Uses HSV color filtering to track blue objects with precision.
- Virtual Overlay: Visualizes drum pads (Snare, Kick, Hi-Hat, Toms, Crash) directly on your video feed.
- Visual Feedback: Drums light up with a red tint when struck.
- Low-Latency Audio: Uses Pygame Mixer for responsive sound triggering.
- Menu System: Integrated Main Menu and Credits screen.
To run this project, you need Python 3.x installed on your machine along with a webcam.
Install the dependencies using pip:
pip install opencv-python numpy pygame
Important: For the code to run successfully, your file and folder structure must look exactly like this. The application relies on specific paths to load images and sounds.
Air-Drum-Kit/
โ
โโโ main.py # The main Python script
โโโ README.md # This file
โ
โโโ assets/
โโโ Samples/ # Audio files (.wav)
โ โโโ kick-808.wav
โ โโโ snare-808.wav
โ โโโ openhat-808.wav
โ โโโ tom-acoustic01.wav
โ โโโ tom-acoustic02.wav
โ โโโ crash-808.wav
โ
โโโ images/ # Visual assets (.png)
โโโ kick_drum.png
โโโ snare_drum.png
โโโ hi_hat.png
โโโ tom.png
โโโ crash_cymbal.png
- Connect your webcam.
- Navigate to the project folder in your terminal.
- Run the script:
python main.py
- The application will open in the Main Menu.
This application is tuned to detect BLUE objects.
- Best Results: Use a bright blue marker cap, a blue fidget spinner, or wrap blue electrical tape around a pen/stick.
- Lighting: Ensure your room is well-lit so the camera can distinguish the blue color.
| Key | Action |
|---|---|
| P | Play Mode (Start Drumming) |
| C | View Credits |
| B | Back to Main Menu |
| Q | Quit / Exit Application |
You can tweak the settings inside the air_drum_kit.py file:
- Window Size: Modify
WINDOW_WIDTHandWINDOW_HEIGHT(Default: 640x480). - Color Sensitivity: If your blue object isn't being detected, adjust the HSV values:
BLUE_LOWER_BOUND = np.array([90, 50, 20])
BLUE_UPPER_BOUND = np.array([140, 255, 255])- Developer: Arian Khademolghorani
- Art/Drawings: Ceylin Ipek Ak
- Audio Samples: 99Sounds
- Libraries: OpenCV, Pygame, NumPy
This project is open-source. Feel free to modify and improve it!