更改Android的音频记录默认输入源 [英] Change Android Audio Record Default input Source

查看:1415
本文介绍了更改Android的音频记录默认输入源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写,对于音频数据的记录和实时处理要求的应用程序。对于这一点,我使用的是AudioRecord类。这工作都很好,除了默认设置为我的主要测试设备,Galaxy Nexus的上录制音频,是从后置扬声器记录。我假设大多数电话默认记录来源将是背部,或底部的麦克风,因为当你使用手机打电话,你的嘴是接近底部。

I am currently writing an app that calls for the recording and real time processing of audio data. For this, I am using the AudioRecord class. This works all well and good, except the default setting for recording audio on my primary testing device, a galaxy nexus, is to record from the back speaker. I am assuming most phones default record source will be the back, or bottom microphones, because when you are using the phone to call, your mouth is near the bottom.

不过,我的应用程序需要我从扬声器记录在手机正面,所以我希望有人能帮助我如何以编程方式更改AudioRecord输入源。我已经广泛地搜索了这个问题的答案。

However, my app requires that I record from the speaker on the front of the phone, and so I was hoping someone could help me with how to change the AudioRecord input source programmatically. I have searched extensively for the answer to this.

我已经考虑有些事情是:

Some things I have considered are:

  • 使用AudioManager类,并打开免提电话,如:

  • Using the AudioManager Class and turning on the speaker phone, such as:

    AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
    am.setSpeakerphoneOn(true);


  • 在我AudioRecord对象的构造改变AudioSource参数:

  • Changing the AudioSource parameter in the construction of my AudioRecord object:

    AudioRecord ar = new AudioRecord(AudioSource.????, ..., ..., ..., ...);

  • 我发现,API的都没有太具体的哪些AudioSource格式是哪个,所以我想知道如果任何人一直在努力与这个问题,可以点我在正确的方向。

    I have found that the API's are not too specific about which AudioSource formats are which, so I was wondering if anyone else has struggled with this issue and could point me in the right direction.

    由于提前,

    推荐答案

    Android版目前不支持通话录音,所以我相信你不能改变它从听筒记录。你不应该真的需要但是,麦克风在手机的底部应能记录的东西你所需要的全部能力。要将AudioRecord设置麦克风,只是做:

    Android does not currently support call recording, so I believe you can't change it to record from the earpiece. You shouldn't really need to however, the Mic at the bottom of the phone should be able to record things to the full capacity you need. To set the AudioRecord to the mic, just do:

    AudioRecord ar = new AudioRecord(AudioSource.MIC, ..., ..., ..., ...);
    

    这会给你最好的刻录品质。

    This will give you the best recording quality.

    这篇关于更改Android的音频记录默认输入源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆