Take the tour ×  I'm recording live audio from a bluetooth
headset's mic and playing it onto the phone's speaker.
Streaming code:   int bufferSize =
AudioRecord.getMinBufferSize(samplingRate,
AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
arec = new
AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION,
samplingRate, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
//STREAM_MUSIC - no sound         //STREAM_ALARM - beep from
phone's speaker         //STREAM_RING - no sound
//STREAM_NOTIFICATION - no sound         //STREAM_SYSTEM - no
sound         //STREAM_VOICE_CALL - plays back on bt headset
//STREAM_DTMF - sound from loud speaker, not very clear but
works for now         atrack = new
AudioTrack(AudioManager.STREAM_VOICE_CALL, samplingRate,
AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT,
bufferSize, AudioTrack.MODE_STREAM);         byte[] buffer = new
byte[bufferSize];         while(isRecording) {
arec.rea