Skip to content

alexbuildstech/virtual-physics-drum-kit

Repository files navigation

Virtual Physics Drum Kit 🥁✨

Turn your webcam into a high-speed, low-latency spatial instrument.

🚀 Features

  • ⚡ Zero-Lag Audio: Custom Pygame mixer implementation for <10ms latency.
  • ✋ High-Precision Tracking: Powered by MediaPipe Hands for millimeter-accurate hit detection.
  • 🌊 Physics-Based Audio: Volume scales with your hand velocity ($v = \Delta y / \Delta t$).
  • ✨ Holographic UI: Semi-transparent, futuristic HUD with ripple visual effects.
  • 📷 Universal Support: Works with laptop webcams and external USB cameras.

🛠️ Installation

  1. Clone the repository

    git clone https://github.com/alexbuildstech/virtual-physics-drum-kit.git
    cd virtual-physics-drum-kit
  2. Create a Virtual Environment

    python -m venv venv
    source venv/bin/activate  # Linux/Mac
    # venv\Scripts\activate   # Windows
  3. Install Dependencies

    pip install -r requirements.txt

    Note: Requires MediaPipe, OpenCV, Pygame, and NumPy.

🎮 How to Play

  1. Run the App

    python main.py

    By default, it uses the built-in webcam.

  2. Using an External USB Camera If you have a fancy USB camera connected:

    python main.py --camera 1

    (Use check_camera_index.py if you aren't sure which index to use)

  3. Drumming

    • Snare: Top Left
    • Hi-Hat: Bottom Left
    • Tom: Top Right
    • Kick: Bottom Right

    Strike the air in these zones! The harder you hit, the louder the sound.

🔧 Architecture

  • Core: Python 3.12
  • Vision: MediaPipe Hands (Landmark Tracking)
  • Audio: Pygame Mixer (Buffer size 512 for low latency)
  • Visuals: OpenCV (cv2) for overlay and particle effects

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

📄 License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages