Is there a way to record mic input in android while it is being process for playback/preview in real time? I tried to use AudioRecord
and AudioTrack to do this
Following permission in manifest is required to work properly:
Also, 2d buffer array is not necessary. The logic of the code is valid even with just one buffer, like this:
short[] buffer = new short[160];
while (!stopped) {
//Log.i("Map", "Writing new data to buffer");
int n = recorder.read(buffer, 0, buffer.length);
track.write(buffer, 0, n);
}