Skip to content
protopapa edited this page Sep 20, 2011 · 2 revisions

###Welcome to the Piano wiki!

Piano is an application created using Library, Processing.org and Minim. The Light sensors from 6 SunSPOTs are used in order to simulate the twelve basic Piano keyboards, 7 white and 5 black. The player with his hands changes the light range that the sensor feels and so the note changes. The Light range has been split into three intervals/scales. The first scale (light value 0 or in human perception darkness) represents the 7 white keyboards, while the second scale (light values 41-149) represents the black keyboards. Some pictures of the application come next:

The source of the application is available on the homonymous file. Class SoundCreator implements the ILThresholdListener interface in order to listen for the according notifications and runs on its own thread.

As you see, on lines 63-68 SunSPOTs motes are being registered. On lines 43-48 Light thresholds are set and on lines 49-54 the class subscribes itself to the listener's list. Whenever a notification comes from a SunSPOT, the incoming value is placed on the appropriate priority queue. Last, inside run() method the values are being processed to determine the interval. According to the interval, values to a byte array are set. This byte array is sent to the processing class to play the according note.

Processing class extends PApplet. At first loads note samples with Minim library. Then process the byte array to trigger the appropriate sample.

PianoGraphics class is the class that creates the visualized output of the piano keyboards.

###Can I play?

If you wish to play with this application, you just have to download the source, change the MAC addresses to match with the MAC-addresses of your SunSPOT's , do ant host-run -Dport=/path/to/usb and start playing.

Clone this wiki locally