Android stereo recording. Exact same data from two different channels

你离开我真会死。 提交于 2019-12-08 13:17:09

问题


I'm trying to do stereo recording from my galaxy nexus phone. By its spec, the phone has 2 microphones build-in. Correct me if I'm wrong, 2 microphones will be used when stereo recording is supported on the device

I get no errors initializing and using AudioRecord class to record stereo audio. But the results I'm getting from two audio channels are exactly the same. Has anyone encountered the same problem before? Any ideas? Thank you. The following code snippet is what I'm using for stereo recording setup:

            int bufferRead = 0;
        int bufferSize = AudioRecord.getMinBufferSize(44100,
                AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT);
        // if doesn't support that sampling frequency
        if (bufferSize == AudioRecord.ERROR_BAD_VALUE
                || bufferSize == AudioRecord.ERROR) {
            Log.i(this.toString(), "doesn't support sampling rate of "
                    + frequency);
            throw new IllegalArgumentException(
                    "entered unsupported audio sampling rate");
        }
        // grabbing 16-bit pcm audio
        short[] tempBuffer = new short[bufferSize];
        AudioRecord recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC,
                44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT,
                bufferSize);
        recordInstance.startRecording();

回答1:


Correct me if I'm wrong, 2 microphones will be used when stereo recording is supported on the device

In my 3 years experience of testing on tens of devices, I have found that this was never the case.

The primary mic alone is used both in mono and stereo recording in the wide range of Android devices that I have worked with - from low-cost mass models to flagships.

One reason for this is that the primary mic is of a better quality (more sensitive, less noisy, etc.) and costlier than the secondary mic.



来源:https://stackoverflow.com/questions/17982714/android-stereo-recording-exact-same-data-from-two-different-channels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!