L3. LAB 3: ANDROID AUDIO SIGNAL SAMPLING 59
delay is added to the filtering code by the use of the usleep function within the C processing
segment. e filtered signal is then passed back to Java and is saved to a file or played back
through the target audio output. e app settings menu allows the adjustment of the sampling
rate, frame size, and computational delay of the signal processing pipeline.
L3.2 APPLICATION CODE
e app manifest appears below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dsp.filter"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application android:label="@string/app_name">
<activity android:name=".RealTime"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
An important aspect of the app manifest is enabling the correct permissions to perform
file IO and record audio. Permissions are set with the uses-permission directive, where
RECORD_AUDIO is defined for audio input and WRITE_EXTERNAL_STORAGE enables saving files
to the device storage. A detailed list of the permissions can be found on the Android developer
website at:
http://developer.android.com/reference/android/Manifest.permission.html
e code to be executed is referred to as an Activity—in this case named .RealTime in the
manifest, which corresponds to the RealTime.java file. e manifest indicates namings which
are necessary for hooking into the UI elements, defined in the layout. RealTime.java contains
the code which hooks the UI elements and controls the app execution.