L3. LAB 3: ANDROID AUDIO SIGNAL SAMPLING 63
3. Loading native libraries into memory when the program runs. e following code should
be placed in the class file responsible for defining the Android activity. In the example app,
this can be found in the GUI class:
static {
System.loadLibrary("yourlibrary");
}
System.loadLibrary links the native method declaration in the Java class with the processing
code declared in the C file. ere are alternative methods of declaring native functions and
performing the linking which will be covered in a later chapter.
Depending on the input data types in the methods and the expected return data types,
the JNI method signature will change. If any of these steps are not correctly done, Java will not
be able to find the native methods and an exception will be thrown when the app attempts to
call the native method.
L3.6 SUPERPOWERED SDK
For real-time low-latency througputs on Android devices, the Superpowered utility can be used.
is utility is an audio API which is developed for mobile devices. On Android devices, Su-
perpowered uses OpenSL to allow processing of audio data in a low-latency manner. More
information on these APIs are available at the following links:
• Superpowered: http://superpowered.com
• OpenSL ES: https://www.khronos.org/opensles/
In what follows, a simple audio I/O path is implemented via Superpowered and it is shown
how to implement a low-latency Android app.
• Go to http://superpowered.com and download the SuperpoweredSDK. Store it in
C:Android.
• Open Android Studio. In the splash screen, select Open an existing Android Studio Project.
• Navigate to the SuperpoweredSDK folder. In the Android subfolder, open the Frequency-
Domain example in Android Studio, as shown in Figure L3.2.
• If the project shows errors on opening, it may be due to an incorrect path
to the Superpowered directory. Go to local.properties of the project in the
project navigator window and change the path of the Superpowered directory to
C:AndroidSuperpoweredSDKSuperpowered and sync the gradle again.