录制立体声音频与摩托罗拉摩托G(或极限摩托)摩托、摩托罗拉、立体声、音频

2023-09-06 22:59:36 作者:眼裡沒有我.

我希望有人能帮助我解决这个问题。

I hope someone could help me with this issue.

前段时间我为了同时记录由前麦克风和背面之一,智能手机捕获的声音开发的应用程序。基本上,我做的下一个对象是这样的:

Some time ago I developed an application in order to record simultaneously the sound captured by the front mic and the back one in a smartphone. Basically, I make the next object like this:

AudioRecord audioRecord =新AudioRecord( MediaRecorder.AudioSource.CAMCORDER ,频率的 AudioFormat.CHANNEL_IN_STEREO ,音频编码,缓冲区大小的);

AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER, frequency, AudioFormat.CHANNEL_IN_STEREO, audio encoding, buffer size);

它的工作完美的索尼Xperia新为v,但不是为摩托罗拉摩托G(或摩托十一猜测)。纵观文档我看到了下一个在摄像机的标志:

It worked perfectly for a Sony Xperia Neo V but not for a Motorola Moto G (or Moto X I guess). Taking a look at the documentation I saw the next for the CAMCORDER flag:

麦克风音频源,如相机如果有相同的方向,主要设备的麦克风,否则。的

Microphone audio source with same orientation as camera if available, the main device microphone otherwise.

摩托罗拉摩托G不具有摄像机话筒但一个在顶部(索尼Xperia具有在背部或摄像机话筒1话筒)。事实上,与摩托GI得到了相同的信号(由前话筒所捕获的一个)的两倍,根据文档这是正确的。

Motorola Moto G does not have a camera mic but one in the top (Sony Xperia has one mic in the back or camera mic). In fact, with Moto G I got the same signal (the one captured by the front mic) twice, which is correct according to the documentation.

任何人可以帮助我吗?

谢谢!

推荐答案

我有同样的问题,我得到了它使用48000 Hz的采样速率工作。我想它会工作,因为使用默认的相机应用所取得的录像立体声工作,有这样的采样率。使用功能getMinBufferSize当该频率也必须考虑()。

I had the same problem, and I got it to work using a sample rate of 48000 Hz. I figured it would work since the video recordings made with the default camera app worked in stereo and had this sampling rate. This frequency must also be considered when using the function getMinBufferSize().

下面是我的设置:

private static final int RECORDER_BPP = 16;
private static final int RECORDER_SAMPLERATE = 48000;
private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_STEREO;
private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;

然后我创建了AudioRecord对象:

and then I create the AudioRecord object with:

recorder = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER,
                                            RECORDER_SAMPLERATE, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize);

我现在用的是摩托G,安装奇巧。

I am using the Moto G, with KitKat installed.