With the help of the AudioRecord API I am now able to record audio using the microphone of the watch. However, this is uncompressed audio and the file sizes get pretty big.
Around 5.3MB per minute recording at 16bit, 44.1Khz, mono. So I started looking into reducing the size by encoding it to a different format.
I looked into MediaCodec and the other low level audio multimedia support that is mentioned.
Looping over the available codecs:
MediaCodecList codecs = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
MediaCodecInfo[] infos = codecs.getCodecInfos();
for(MediaCodecInfo info : infos) {
Log.d(TAG, "Name: " + info.getName());
Log.d(TAG, "Types: " + Arrays.toString(info.getSupportedTypes()));
Log.d(TAG, "Encoder? " + info.isEncoder());
}
It turns out that none of them are encoders. Just 9 decoders. Attempting to use any of these in MediaCodec.createByCodecName() results in an exception. Any idea how I can compress my recorded audio on Android Wear?