The Tangible Theremin
From Music Hack Day
 The Tangible Theremin
This hack involves 2 iOS devices used to recreate the modern Theremin instrument .
David @ayman  Shamma.
 About the hack
This hack requires two iOS devices. They are linked together over Bluetooth (through Apple's GameKit). Once linked, one iPhone's tilt becomes the frequency control, the other becomes volume—simulating the virtual/space controls of a theremin.
The accelerometers are used to determine device frequency and volume (not gyroscope for backwards compatibility reasons). The data is run through a smoothing low-pass filter to remove noise and provide a continuous glissando .
There is a tutorial which will display where to tilt the phone and 'buzz/vibrate' the frequency controller to guide you through the tilt motions to (hopefully) play something that might sound like Somewhere Over the Rainbow.
The volume and frequency readings are sent UDPBroadcast across the local subnet, so they can be reused by some other service/application.
 What APIs, tools or kit did you use?
- Matt Gallagher's excellent ToneGenerator  was used to make the sine wave.
- In Apple's iOS framework, GameKit is used to discover and link the two devices over bluetooth (see GKPeerPickerController).
- Cocoa Async Socket  lib was used for the UDP broadcast.
- The lowpass filter (while not really rocket science) took a bit of parameter noodling to get right:
- new_z = (current_z * kFilteringFactor) + ((1.0 - kFilteringFactor) * last_z) where kFilteringFactor = 0.06 and the accelerometer sampling is 90.0 Hz.