简体   繁体   English

如何在Android中同时录制2个麦克风?

[英]How can I record 2 microphone in Android simultaneously?

I'm trying to record audio signals from 2 in-built microphone(bottom, top) at the same time. 我正在尝试同时录制来自2个内置麦克风(底部,顶部)的音频信号。 I can pick up bottom microphone signal using 我可以使用

MediaRecorder.AudioSource.MIC

and top microphone signal using 和顶部麦克风信号使用

MediaRecorder.AudioSource.CAMCORDER

I can record separately but I want to record at the same time from 2 microphones. 我可以单独录音,但我想同时用2个麦克风录音。 Does anyone know how to record simultaneously? 有人知道如何同时录制吗? I tried & or | 我尝试过&或| operator but I can get only 1 channel signal. 运算符,但我只能得到1个通道信号。

I use Galaxy S2 device. 我使用Galaxy S2设备。

I will appreciate any response :) Thanks in advance. 我将不胜感激任何答复:)预先感谢。

You can achieve this by doing a stereo recording using the AudioRecord ( http://developer.android.com/reference/android/media/AudioRecord.html ) class. 您可以通过使用AudioRecord( http://developer.android.com/reference/android/media/AudioRecord.html )类进行立体声录音来实现此目的。 Have a look at How to access the second mic android such as Galaxy 3 . 看看如何访问第二个麦克风android,例如Galaxy 3

Specifying the audio format as stereo and the audio source as the camcorder automatically selects two microphones, one for each channel, on a (compatible) two microphone device. 在(兼容)两个麦克风设备上,将音频格式指定为立体声,将音频源指定为便携式摄像机会自动选择两个麦克风,每个通道一个。

For example: 例如:

            audioRecorder = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER,sampleRate,android.media.AudioFormat.CHANNEL_CONFIGURATION_STEREO,android.media.AudioFormat.ENCODING_PCM_16BIT,bufferSize);

will initialise a new AudioRecord class, that can record from two device microphones in stereo in PCM, 16 bit format. 将初始化一个新的AudioRecord类,该类可以从两个设备的麦克风以16位PCM立体声录音。

For more help on recording using AudioRecord (to record .wav), have a look at: http://i-liger.com/article/android-wav-audio-recording . 有关使用AudioRecord录制(录制.wav)的更多帮助,请访问: http ://i-liger.com/article/android-wav-audio-recording。

There is a misconception that in devices with 2 microphones, both the microphones will be used when recording in the stereo mode. 有一个误解,在带有2个麦克风的设备中,以立体声模式录制时将同时使用两个麦克风。

In my 3 years experience of testing on tens of devices, I have found that this was never the case. 在我对数十种设备进行测试的3年经验中,我发现从来没有这样。

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. 光是主麦克用于无论是在单声道和立体声录音在广泛的Android设备,我已经工作过-从低成本大众车型的旗舰。

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. 造成这种情况的原因之一是,主麦克风的质量比次麦克风更好(更灵敏,噪声更低等),并且价格更高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM