Leap Motion musical UI for closed eyes

How many musicians do you know that play with their eyes closed? Not many computer music apps allow this. Bloom is an exception.  http://www.generativemusic.com/bloom.html

As an exercise, I tried to make something like Bloom, using Leap Motion. With your eyes closed you can accurately position your hand at the level of eyes, shoulders, hips, etc., And you can quickly move to a point directly outward from your nose, or shoulders. This is the basis of sobriety tests.

The interface, works with a hand motion like sprinkling seeds. Every time you open your hand, it triggers a note based on the height of your hand. It also triggers one of the “Bloom”  circles at the XY position.

The prototype was done in Max/MSP Jitter. It was derived from a “bloom clone” project by John Mayrose at: http://www.johnmayrose.com/maxmsp.html

Here’s an example:

download

https://github.com/tkzic/max-projects

folder: bloom

patches

  • (main patch) circlething.maxpst
  • (poly~ sub-patch) FMPoly2~.maxpat
  • (Leap Motion main-patch) leap-finger-switch.maxpat
  • (Leap Motion sub-patch) leap-switch-test2.maxpat
externals and dependencies

Note: If you don’t have a Leap Motion sensor, you can use a mouse.

If you are using Leap Motion, download the aka.leapmotion external – and add it to your Max file path in options | file preferences: http://akamatsu.org/aka/max/objects/

instructions

(if not using Leap Motion sensor, skip to step 4)

  1. Plug in the Leap Motion sensor.
  2. Open leap-finger-switch.maxpat and click the “start” toggle. 
  3. Wave your hand around – it should be detected and displayed
  4. Open circlething.maxpat
  5. If using mouse, just click in the black “circlething” window to play.
  6. If using Leap Motion, click the message box to activate Leap Motion
  7. Then open and close your hand, over the sensor to play
  8. High notes are higher in the window.

Leap Motion example using Cinder and c++ audio

This is a prototype from October – just getting around to posting it.

The hand position (x,y,z) is sensed by LeapMotion to control parameters of an FM synth with feedback delay written in Cinder audio (c++). The graphics were adapted from a Cinder LeapMotion demo.

Local source is in: cinder/cinder_dev/blocks/Cinder-LeapSdk/samples/LeapApp/xcode/LeapAppTZ2.xcodeproj

Uses cinder Leap demo code combined with simple audio synthesis using callbacks in c++

 

 

PID controller in Max

Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue.

Tried using fiddle~ for frequency detection (as the sensor input) but it provides faulty data below about 200hz – and that totally messes up the PID. so I am just using the actually frequency being used to set the oscillator as the response sensor.

update:  Tristan Jehan wrote a Max external that extends lower frequency range of  [fiddle~]. It would be worth trying for this patch.

The PID algorithm is written in javascript.

download

https://github.com/tkzic/max-projects

folder: pid-controller

patch: pid-mrmapes2.maxpat

javascript code: pid.js

Instructions

  • turn on audio
  • change test interval to something like 20
  • click on message boxes to change set point. Listen and watch results
  • try different presets – which alter PID settings and then try changing the set point. For example, with the 2nd preset you will see overshoot and oscillation during settling phase.

more about PID controllers

wikipedia page: http://en.wikipedia.org/wiki/PID_controller

 

Leap Motion hand data

notes

When using the sphere vector, if you make a fist – the sphere Y value goes straight up (as radius decreases) also, x value decreases slightly and z value increases significantly

So its probably better to use palm position as a vector – if you want to detect sphere radius