Record only caller's voice in android

sheetal_158 picture sheetal_158 · May 14, 2013 · Viewed 10.6k times · Source

I am using MediaRecorder for recording call in android. But I only want to record the caller's voice. Can this be done?

    recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    // mRecorder.setOutputFile("/sdcard/yousuck2.3gp");
    if (audiofile == null) {
        File sampleDir = Environment.getExternalStorageDirectory();

        try {
            audiofile = File.createTempFile("ibm", ".3gp", sampleDir);
        } catch (IOException e) {
            Log.e(TAG, "sdcard access error");
            return;
        }
    }

Also what is the difference between VOICE_CALL, VOICE_UPLINK and VOICE_DOWNLINK? I read the Android docs but could not understand.

Answer

Ajay Pandya picture Ajay Pandya · Nov 2, 2015

Before time ago I had the same problem I searching a lot than I found the simple word solution from https://stackoverflow.com/a/13090413/3514144 I came to know that VOICE_UPLINK: The audio transmitted from your end to the other party. IOW, what you speak into the microphone (plus surrounding noise depending on whether noise suppression is used and how well it performs).

VOICE_DOWNLINK: The audio transmitted from the other party to your end.

VOICE_CALL: VOICE_UPLINK + VOICE_DOWNLINK.

so I use the record format as DOWNLINK and its work fine hope this is the simple word to distinguish.