Leap Motion – Pure Data external for Windows

It's quite a struggle to make Leap Motion work with Pure Data on Windows. This may help you out.

Here you will find external object which outputs data from Leap Motion controller. Based on Chikashi Miyama's mac external.


Download Leap Motion external for Windows v0.1.1 as a zip file.


Unzip the archive and put extracted leapmotion folder into extra folder in your Pure Data installaion. For a demo how to use the leapmotion object, right click on it in Pure Data and see the help patch.


Update Dec 30, 2014:
  • Recompiled with Leap SDK 1.2.0+10970, it should not crash your Pure Data anymore!
  • Added help patch

Update Nov 20, 2013 – v0.1.1:
  • palm normal now gives correct values
  • patches worked only when launched by double clicking on patch file, this is now fixed
  • patches now receive events even when their window is in the background; you can control this behavior with "Allow Background Apps" toggle in Leap Motion Control Panel

If you want to compile it yourself

  1. Download and install Microsoft Visual Studio. I use 2013 Community Edition, it's free. Leap Motion library can be only compiled with MSVC, so you are out of luck with MinGW and Cygwin.
  2. Get flext via svn from https://svn.grrrr.org/ext/trunk/flext/ Put it into C:\flext
  3. Get pthreads-win32 from ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip, unpack it and copy contents of Pre-built.2 folder into C:\pthreads-win32
  4. Get Leap Motion SDK from https://developer.leapmotion.com/downloads, unpack it and copy folder LeapSDK to C:\LeapSDK
  5. Get "Pure Data for Windows" from http://puredata.info/downloads/pure-data, unpack it and put pd folder to C:\pd
  6. Get copy of Pd_leapmotion from https://github.com/jakubvaltar/Pd_leapmotion. Copy all the files to C:\Pd_leapmotion
  7. Locate file vcvars32.bat. It should be a part of your Microsoft Visual Studio installation. I have it at C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
  8. Start -> Run -> cmd
  9. cd to folder with vcvars32.bat and run it. This will allow you to run msvc compiler from this terminal window. If you close the terminal window, you will have to do it again.
  10. cd C:\flext
    build pd msvc

    This should throw an error, so don't panic. Open C:\flext\buildsys\config-win-pd-msvc.txt in text editor. Make changes so that


    At the end of the file, add these three lines:

    INCPATH=$(INCPATH) /I"C:\LeapSDK\include"
    LIBPATH=$(LIBPATH) /LIBPATH:"C:\LeapSDK\lib\x86"
    LIBS=$(LIBS) Leap.lib

    Save the file.

    build pd msvc

    It should create another config file and return error. We don't need to make any changes to this file.

    build pd msvc

    Now it should finally build flext.

    build pd msvc install
    cd C:\Pd_leapmotion
    C:\flext\build pd msvc
    C:\flext\build pd msvc install

  11. Go to C:\pd\extra and find there leapmotion.dll. Create pd/extra/leapmotion folder in your Pure Data installation. Copy leapmotion.dll there.
  12. Go to C:\LeapSDK\lib\x86 and copy Leap.dll to pd/extra/leapmotion folder in your Pure Data installation.
  13. Congrats! Now you can use leapmotion object!
  14. If you don't want to build the external again, now is the right time to delete