Android的AudioRecord支持的采样率 [英] Android AudioRecord Supported Sampling Rates

查看:1647
本文介绍了Android的AudioRecord支持的采样率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出什么采样率支持运行Android 2.2以上的手机。我们希望的速度比44.1kHz的低采样,而不必重新取样。
我知道,所有的手机都支持44100Hz的,但不知道是否有一个表,在那里,显示了采样率的有效期为特定的手机。我已经看到了Android的文档( <一href="http://developer.android.com/reference/android/media/AudioRecord.html">http://developer.android.com/reference/android/media/AudioRecord.html)但它并没有多大帮助。
有没有人发现这些采样率??

I'm trying to figure out what sampling rates are supported for phones running Android 2.2 and greater. We'd like to sample at a rate lower than 44.1kHz and not have to resample.
I know that all phones support 44100Hz but was wondering if there's a table out there that shows what sampling rates are valid for specific phones. I've seen Android's documentation ( http://developer.android.com/reference/android/media/AudioRecord.html) but it doesn't help much.
Has anyone found a list of these sampling rates??

推荐答案

楼主有可能早已感动,但我会在情况下,任何人都张贴此发现了这个问题。

The original poster has probably long since moved on, but I'll post this in case anyone else finds this question.

不幸的是,在我的经验,每个设备都可以支持不同的采样率。知道什么是采样率的设备支持的唯一可靠的方法是通过检查AudioRecord.getMinBufferSize()的结果,分别对它们进行测试是非负(这意味着有一个错误),并返回一个有效的最小缓冲区大小。

Unfortunately, in my experience, each device can support different sample rates. The only sure way of knowing what sample rates a device supports is to test them individually by checking the result of AudioRecord.getMinBufferSize() is non negative (which means there was an error), and returns a valid minimum buffer size.

public void getValidSampleRates() {
    for (int rate : new int[] {8000, 11025, 16000, 22050, 44100}) {  // add the rates you wish to check against
        int bufferSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT);
        if (bufferSize > 0) {
            // buffer size is valid, Sample rate supported

        }
    }
}

这篇关于Android的AudioRecord支持的采样率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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