This app is just meant to show how to hook the Ableton Link library to an Android app. It's not intended to show some best practice code (I'm just starting with Android development), but rather to document how I was able to achieve it, in case it helps others.
- join session: The app creates an instance of Link, and joins a Link session. If you have other apps running link on the same wifi, the peer count should be incremented when you launch the app.
- capture session tempo: tapping the capture button should query the current tempo from the session state and display it. Try changing the tempo from another peer, and hit the button again: the tempo should update to the new value.
That's all. No audio.
- Make sure your setup can build for NDK with Android Studio.
- Clone the Link repo with submodules somewhere on your machine.
git clone --recurse-submodules https://github.com/Ableton/link.git
- In the app project folder, edit the
app/CMakeLists.txt
file and replace
set (LINK_DIR /Users/bloit/LIBS/link)
with the path to your local Link repo. 4. Open this app project in Android Studio (tested on v3.0.1) 5. Sync project with gradle files 6. Build...
Be sure to add this permission to the manifest, or link will silently fail.
<uses-permission android:name="android.permission.INTERNET"/>
The LinkHut command line app is the most straightforward way of testing. Just follow the build instructions to install it on your machine. I usually test by first launching the LinkHut app, and then launch the Android app.
When launching the command line LinkHut, you should see something like the following (assuming there is no other Link peer on your wifi):
peers: 0 | quantum: 4 | start stop sync: off | tempo: 120 | beats: 10.245176 | XXXO
Then once you launch the app, the output should update the peers field:
peers: 1 | quantum: 4 | start stop sync: off | tempo: 120 | beats: 16.005898 | XOOO
Now try increasing or decreasing the tempo in LinkHut (w / e keys), and hit the capture button on the app. You should see the tempo field in the app updating to the same value.
peers: 1 | quantum: 4 | start stop sync: off | tempo: 134 | beats: 65.568589 | XXOO