在android中采集音频的api是android.media.AudioRecord类

其中构造器的几个参数就是标准的声音采集参数

以下是参数的含义解释

public AudioRecord (int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes)

Since: API Level 3

Class constructor.

Parameters

audioSource

the recording source. See MediaRecorder.AudioSource for recording source definitions.

音频源:指的是从哪里采集音频。这里我们当然是从麦克风采集音频,所以此参数的值为MIC

sampleRateInHz

the sample rate expressed in Hertz. Examples of rates are (but not limited to) 44100, 22050 and 11025.

采样率:音频的采样频率,每秒钟能够采样的次数,采样率越高,音质越高。给出的实例是44100、22050、11025但不限于这几个参数。例如要采集低质量的音频就可以使用4000、8000等低采样率。

channelConfig

describes the configuration of the audio channels. See CHANNEL_IN_MONO and CHANNEL_IN_STEREO

声道设置:android支持双声道立体声和单声道。MONO单声道,STEREO立体声

audioFormat

the format in which the audio data is represented. See ENCODING_PCM_16BIT and ENCODING_PCM_8BIT

编码制式和采样大小:采集来的数据当然使用PCM编码(脉冲代码调制编码,即PCM编码。PCM通过抽样、量化、编码三个步骤将连续变化的模拟信号转换为数字编码。) android支持的采样大小16bit 或者8bit。当然采样大小越大,那么信息量越多,音质也越高,现在主流的采样大小都是16bit,在低质量的语音传输的时候8bit 足够了。

bufferSizeInBytes

the total size (in bytes) of the buffer where audio data is written to during the recording. New audio data can be read from this buffer in smaller chunks than this size. See getMinBufferSize(int, int, int) to determine the minimum required buffer size for the successful creation of an AudioRecord instance. Using values smaller than getMinBufferSize() will result in an initialization failure.

采集数据需要的缓冲区的大小,如果不知道最小需要的大小可以在getMinBufferSize()查看。

采集到的数据保存在一个byteBuffer中,可以使用流将其读出。亦可保存成为文件的形式

更多相关文章

  1. 研究Android音视频-3-在Android设备上采集音视频并使用MediaCode
  2. Android(安卓)音视频采集那些事
  3. 【流媒體】Android(安卓)实时视频采集方案一
  4. android实现emoji输入
  5. Android数据加密之Base64编码算法
  6. Android音频开发(2):如何采集一帧音频
  7. Android屏幕直播方案
  8. Android数据加密之Base64编码算法
  9. [Android(安卓)调试/测试] Android(安卓)LOGCAT输出编码,eclipse

随机推荐

  1. Android电话拨打流程源码分析
  2. Android高性能编码实战:网络框架优化
  3. 更新Android(安卓)SDK到3.0版本时,遇到Fai
  4. Android客户端与Tomcat服务器通信实现登
  5. Android技术点总结
  6. android之字体阴影效果
  7. Android菜单详解(一)——理解Android中的Me
  8. 【Android(安卓)Developer】2.Android的
  9. Android(安卓)***测试学习手册(二)准备实验
  10. Android(安卓)核心分析(13) -----Android