Android的AudioRecorder。如何降低分钟读取缓冲区的大小? [英] Android AudioRecorder. How to reduce min read buffer size?

查看:598
本文介绍了Android的AudioRecorder。如何降低分钟读取缓冲区的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写的应用程序,绘制实时音频信号的频谱。音频信号来自麦克风。我用audiorecorder类来录制音频。采样率是441000Hz,单声道,16位。方法AudioRecord.getMinBufferSize返回3840,在某些设备上的价值1920年1920年还算过得去,但3840是太大了。用缓冲大小3840字节和采样率44100Hz延迟是87ms最小值。它太大了实时proccesing。有谁知道如何减少最小缓冲区大小?

I'm writing app that draw spectrum of audio signal in real-time. Audio signal comes from microphone. I use audiorecorder class to record audio. Sample rate is 441000Hz, mono, 16bit. Method "AudioRecord.getMinBufferSize" returns 3840, on some devices 1920. Value 1920 is passably, but 3840 is too big. With buffer size 3840 bytes and sample rate 44100Hz latency is 87ms minimum. It's too big for real-time proccesing. Does anybody know how to reduce minimum buffer size?

推荐答案

我觉得解决这个prolem关键是不要降低MinBufferSize。其实你可以减少MinBufferSize例如通过降低采样率到8000Hz的或16000,。但时间延迟与该不能改变音频硬件的固定特性。

I think the key to solve this prolem is not to reduce the MinBufferSize. Actually you can reduce the MinBufferSize by reduce the sampling rate e.g. to 8000Hz or 16000Hz. But the time delay is a fixed characteristic related to the audio hardware that cannot be changed.

在我的经验(从PJSIP源$ C ​​$ C),我用只读我需要的样本量,例如,即使MinBUfferSize是3840,你仍然可以读取缓冲区的一小部分,例如: 20ms的用于典型的VOIP帧。我不知道如果下一读取表示读取剩余的样品,但以我的经验音质很确定。

In my experience(from the source code of pjsip), I used to read only the amount of samples I needed, for example , even though the MinBUfferSize is 3840, you can still read a small fraction of that buffer, e.g. 20ms for a typical VOIP frame. I'm not sure if the next read will retrive the remaining samples, but in my experience audio quality it is OK.

这篇关于Android的AudioRecorder。如何降低分钟读取缓冲区的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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