SC_airpods - access Gyroscope and Accelerometer data from Airpods

I want to share a UGen which I wrote some weeks ago - it allows to access the gyroscope and accelerometer data of supported AirPods.

This will only work on Apple Silicon MacBooks and only with a recent 3.15 development build of SuperCollider, see Add NSMotionUsageDescription for AirPod positional tracking support by capital-G · Pull Request #7151 · supercollider/supercollider · GitHub for specifics.
You can download nightly builds from Downloads | SuperCollider under Bleeding Edge

It can also be used to sketch out a spatialization engine by oneself, which works surprisingly well w/o much effort. You can use the examples as a starting point.
I also used it in a live coding performance to position modulation sources around my head.


To make it accessible beyond Apple Silicon machines one would have to implement the reverse engineered BT reference, see librepods/AAP Definitions.md at main · kavishdevar/librepods · GitHub. I am happy to accept a PR for this as an alternative way.
It is a pitty that the gyroscope API is not accessible from Intel based MacBooks - but thats Apple…

Interestingly enough I thought about providing a patch for existing 3.14 installations to add the NSMotionUsageDescription to /Applications/SuperCollider.app/Contents/Info.plist. This even has some affects since it makes the server not crash, but it still doesn’t expose any data. Yet it seems strange to me that one can edit the Info.plist of a signed binary…?

4 Likes

Omg this is such a cool idea. In the context of (your) live performance, is it possible to use the airpod’s data whilst outputting through a separate audio interface?