Code Monkey home page Code Monkey logo

airdrum's Introduction

AirDrum

Air drum with the Leap device

Video: http://www.youtube.com/watch?v=xdm_2FO44ug

Platforms

This should work under Windows, Linux and Mac, though only Windows was tested yet.

Requirements

Python 2.x (32-bit):

PyGame (32-bit):

Leap Motion device and Leap app v0.7.3 or higher.

Alongside with the source file AirDrum.py, the Leap python API (again SDK v0.7.3 or higher) should be provided in the same directory: A copy of the following three files are available when you checkout, AirDrum.

  • Leap.py
  • _LeapPython.pyd (no underscore( _ ) from v0.7.4 onwards)
  • Leap.dll

It is preferred to replace these three files from your local LeapSDK installation folder.

  • \Leap_Developer_Kit_<v0.7.3 or higher>_<OS>\Leap_SDK\lib\Leap.py
  • \Leap_Developer_Kit_<v0.7.3 or higher>_<OS>\Leap_SDK\lib\x86\Leap.dll
  • \Leap_Developer_Kit_<v0.7.3 and lower>_<OS>\Leap_SDK\lib\x86\_LeapPython.pyd
  • OR
  • \Leap_Developer_Kit_<v0.7.4 or higher>_<OS>\Leap_SDK\lib\x86\LeapPython.pyd

If no Midi output is used, there have to be four audio files in the same directory as well:

  • Kick_soft.ogg
  • Kick_hard.ogg
  • Snare_soft.ogg
  • Snare_hard.ogg

If the Midi output want to be used instead, there has at least one Midi output device to be present.

Usage

Start the tool, connect the Leap and make sure the Leap app is running. Moving down a finger/hand/tool fast enough will trigger a drum. If you hit on the left side of the Leap, a snare drum will be triggered. On the right side, a kick drum will be triggered. The volume is depending on the speed of the finger/hand/tool.

  • python AirDrum.py
  • ...
  • ...

"Press Enter to quit...", after you see this printed on the console, you can start drumming...

  • *Happy Drumming... /\ || \\ // || /\ /*

Midi

If you selected to use a Midi output, the kick drum hit will be sent on note 36 (C1) and the snare drum hit on note 40 (E1). Note that if you require as little latency as possible during playing, you should absolutely select the Midi output instead of the audio output.

Audio

If you selected to use an audio output, there are two double sampled drum samples for each snare and kick drum. The hard sample will only play above a certain finger/hand/tool speed of the hit. If you notice sound playback failures, try setting the sample rate of the audio device initialization to a higher value (the last parameter of the function pygame.mixer.pre_init() in DrumListener::init_audio())

Dev Tip:

For better performance and clean console: Search for 'DEBUG' in the AirDrum.py and comment out any 'print' lines. Comment char is '#'.

airdrum's People

Contributors

stocyr avatar sreev avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.