How to adjust microphone sensitivity while recording audio in android

As I understand you don’t want any automatic adjustments, only manual from the UI. There is no built-in functionality for this in Android, instead you have to modify your data manually. Suppose you use read (short[] audioData, int offsetInShorts, int sizeInShorts) for reading the stream. So you should just do something like this: float gain … Read more

Android AudioRecord class – process live mic audio quickly, set up callback function

After experimenting lots with the notifications and a bunch of other techniques I settled on this code: private class AudioIn extends Thread { private boolean stopped = false; private AudioIn() { start(); } @Override public void run() { android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); AudioRecord recorder = null; short[][] buffers = new short[256][160]; int ix = 0; try { // … Read more

Android audio FFT to retrieve specific frequency magnitude using audiorecord

First you need to ensure that the result you are getting is correctly converted to a float/double. I’m not sure how the short[] version works, but the byte[] version only returns the raw byte version. This byte array then needs to be properly converted to a floating point number. The code for the conversion should … Read more