Transform any surface into a drum kit using computer vision and accelerometer data!
┌─────────────┐
│ Drumstick │
│ ESP32+MPU │
└──────┬──────┘
│ USB
↓
┌──────────────────┐ ┌────────────┐
│ Python Backend │←────→│ Webcam │
│ - Hit Detection │ │ (CV) │
│ - Sound Engine │ └────────────┘
└────────┬─────────┘
│ WebSocket
↓
┌──────────────────┐
│ React Frontend │
│ - Visualization │
│ - Controls │
└──────────────────┘
See firmware/esp32_sensor/README.md
cd backend
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your configuration
python app.pycd frontend
npm install
npm run devOpen firmware/esp32_sensor/esp32_sensor.ino in Arduino IDE and upload to ESP32.
virtual-drum-kit/
├── firmware/ # ESP32 code
├── backend/ # Python Flask server
│ ├── services/ # Core logic modules
│ ├── utils/ # Helper functions
│ └── app.py # Main server
├── frontend/ # React web app
│ └── src/
│ ├── components/
│ └── services/
├── sounds/ # Audio samples
├── config/ # Configuration files
└── docs/ # Documentation
- Person 1: Hardware + Sensor Integration
- Person 2: Computer Vision + ML
- Person 3: Web UI + Sound Engine
Open http://localhost:5173 in your browser and click "Start Streaming".
Option 1: Local YOLO (Development)
pip install ultralytics
python app.py- ✅ No deployment needed
- ✅ Real segmentation
- ✅ Fast iteration
Option 2: Baseten (Production)
# Deploy your model to Baseten
# Update .env with endpoint
python app.py- ✅ GPU acceleration
- ✅ Scalable
- ✅ Production ready
- Webcam captures frames at 10fps
- Frame buffer keeps last 2 seconds
- Calibration runs: once, 2s after clicking "Start Streaming"
- Segments stored in memory for hit localization
- Hits map to nearest segment → drum pad
cd backend
python3 test/test_hit_mapping.pyVerifies:
- Segmentation store saves/retrieves segments
- Hit localizer maps coordinates to objects
- Object class names are properly associated
socketService.emit('simulate_hit', {
intensity: 500,
timestamp: Date.now()
});- Check USB cable (must support data transfer)
- Install CH340 drivers if needed
- Try different USB port
- Check
sounds/directory has .wav files - Verify pygame.mixer initialized correctly
- Check system audio isn't muted
- Reduce webcam resolution
- Disable CV and use accelerometer only
- Check network latency if using hosted model EOF