简体   繁体   English

在Android中用AudioRecord录制立体声

[英]recording stereo with AudioRecord in android

I'm looking for a definitive answer on getting audioRecord to use both the top mounted and bottom mounted microphones so I don't have 2 identical (mono) channels. 我正在寻找一个明确的答案,让audioRecord同时使用顶部安装和底部安装的麦克风,所以我没有2个相同的(单声道)声道。 I'd like to know what polling I could do before hand to ensure that a gadget will provide a good stream. 我想知道我可以做什么轮询,以确保小工具能提供良好的流。

I'm working on a galaxy nexus 5, and can't get that to work so I'm no way near getting it stable across all the devices. 我正在研究一个Galaxy nexus 5,并且无法让它工作,所以我无法在所有设备上保持稳定。

I've tried all the MediaRecorder.AudioSource . 我已经尝试了所有的MediaRecorder.AudioSource

AudioRecord audioInputStream1 = new AudioRecord(Media.Recorder.CAMCORDER,
    sampleRate, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

and also instantiating two records: 并实例化两个记录:

AudioRecord audioInputStream1 = new AudioRecord(Media.Recorder.MIC,
    sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

AudioRecord audioInputStream2 = new AudioRecord(Media.Recorder.CAMCORDER,
    sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

If anyone did get stereo recording on a nexus 5 I'd greatly appreciate the help. 如果有人在nexus 5上获得立体声录音,我会非常感谢你的帮助。 Should I move to alsa or tinyAlsa? 我应该搬到alsa还是tinyAlsa?

thanks, j 谢谢,j

Your question is closely related to my question and it seems the answer is device-dependent: 您的问题与我的问题密切相关,似乎答案取决于设备:

1) For some devices (eg Samsung S2 Plus GT-I9105P , HTC One M7 , HTC One M8 , G3 LG-D855 , Nexus 5 , ...) there is simply no way to activate real stereo recordings via the built-in microphone capsules. 1)对于某些设备(例如三星S2 Plus GT-I9105PHTC One M7HTC One M8G3 LG-D855Nexus 5 ......),根本无法通过内置麦克风激活真正的立体声录音胶囊。 Although in some cases the camcorder app of the manufacturer produces real stereo you won't find any other app which is able to do that. 虽然在某些情况下制造商的摄像机应用程序生产真正的立体声,但你找不到任何能够做到这一点的应用程序。

2) For some other devices, only few specific combinations of MediaRecorder.AudioSource and eg sample rate (or other basic settings) enable real stereo recording (eg Motorola Moto G needs MediaRecorder.AudioSource.CAMCORDER and 48kHz sample rate ). 2)对于其他一些设备,只有少数MediaRecorder.AudioSource特定组合和例如采样率(或其他基本设置)能够实现真正的立体声录音(例如, 摩托罗拉Moto G需要MediaRecorder.AudioSource.CAMCORDER和48kHz采样率 )。

3) On most devices with two microphone capsules AudioFormat.CHANNEL_IN_STEREO is sufficient to activate real stereo recording. 3)在大多数带有两个麦克风胶囊的设备上, AudioFormat.CHANNEL_IN_STEREO足以激活真正的立体声录音。

Unfortunately, Alsa or tinyAlsa will most probably not solve the problem without rooting the device. 不幸的是,如果不使用设备,Alsa或tinyAlsa很可能无法解决问题。

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

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