How to sample microphone on Android without recording to get live amplitude/level?

The solution from Toumal works, however I wasn’t able to get a high enough refresh rate for my needs. So I ended up using the SoundMeter.java class that Toumal linked but modified it to use the code from this answer Here is the code I used, which provides a much better refresh rate: import android.media.AudioFormat; … Read more

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

How to record microphone to more compressed format during WebRTC call on Android?

Webrtc is considered as comparatively much better pre-processing tool for Audio and Video. Webrtc native development includes fully optimized native C and C++ classes, In order to maintain wonderful Speech Quality and Intelligibility of audio and video which is quite interesting. Visit Reference Link: https://github.com/jitsi/webrtc/tree/master/examples regularly. As Problem states; I want to record but smaller … Read more

AudioRecord object not initializing

The trick with using AudioRecord is that each device may have different initialization settings, so you will have to create a method that loops over all possible combinations of bit rates, encoding, etc. private static int[] mSampleRates = new int[] { 8000, 11025, 22050, 44100 }; public AudioRecord findAudioRecord() { for (int rate : mSampleRates) … Read more