Accessing the Android media stream for audio visualization

It looks like in 2.3 things have changed here, there is permissions now

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

And there is a AudioCapture helper class in the aosp to help the live wallpapers do it properly.
https://android.googlesource.com/platform/packages/wallpapers/MusicVisualization/+/gingerbread-release/src/com/android/musicvis/AudioCapture.java

Edit:

One of the imports in the AOSP doesn’t match the public api.
import android.media.audiofx.Visualizer;

it is
import android.media.Visualizer;

if it gives a headache make sure to switch. This is all 2.3 api, it apparently returns a low-resolution audio stream for viz, but not good enough for recording.

Leave a Comment