Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Record only caller's voice in android

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.

like image 406
sheetal_158 Avatar asked May 14 '13 05:05

sheetal_158


1 Answers

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.

like image 155
Ajay Pandya Avatar answered Dec 01 '22 20:12

Ajay Pandya