在8kHz采样率使用OpenSL所有Android设备的语音通信 [英] Voice communication at 8KHz sampling rate for all android device using OpenSL

查看:617
本文介绍了在8kHz采样率使用OpenSL所有Android设备的语音通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要建立一个VOIP应用程序,我使用OpenSL ES。我需要捕捉和播放PCM音频数据在8kHz采样速率为所有Android设备。但是,当我捕捉音频采样率为8KHz的,并在同一时间(语音通信)播放,它产生的噪音和音频失真像三星Galaxy S3,S4等我知道的一些设备,有一个特定的preferred采样速率为每一个设备,我想知道有没有什么解决方法或以任何方式不作任何失真8KHz的采样速率工作? 我试图增加缓冲区的大小和许多其他的东西,但没能找到一个最佳的和通用的解决方案。我需要采样8KHz的我EN codeR和去codeR音频数据。我花了重新采样的音频数据之前,它被传递给我的恩codeR或去codeR作为我的第二个想法,但它不是解决方案,我正在寻找。 我发现CSipSimple用OpenSL,我通过他们的一些codeS中去了。不过,但我无法找到一个解决办法,可能是我不明白的地方集中。 我困在这里!

I need to create a VOIP app and I'm using OpenSL ES. I need to capture and play pcm audio data at 8KHz sampling rate for all android devices. But, when i capture audio at sampling rate 8KHz and play it at the same time (voice communication), it produces noise and the audio is distorted for some devices like Samsung Galaxy S3, S4 etc. I know, there's a specific preferred sampling rate for each device and I want to know is there any workaround or any way to work with 8KHz sampling rate only without any distortion? I tried increasing buffer size and many other things but failed to find an optimum and generic solution. I need audio data sampled at 8KHz for my encoder and decoder. I took re-sampling audio data before it is passed to my encoder or decoder as my second thought, but its not the solution i'm looking for. I found CSipSimple used OpenSL and I went through some of their codes too. But, yet I couldn't find a solution and may be I failed to understand where to concentrate. I'm stuck here!

推荐答案

下面是我如何解决我的问题:

Here's how I solved my problem:

我是用OpenSL ES和工作的音频流为Android <一个href="http://audioprograming.word$p$pss.com/2012/03/03/android-audio-streaming-with-opensl-es-and-the-ndk/"相对=nofollow>这个教程帮助了我很多。我跟着指示这里得到的东西的工作。然后我发现声音这种做法流不能很好地工作,有些设备(主要是三星设备)。我试过很多东西增加缓存大小,禁用环境混响等等等等,我发现<一href="http://stackoverflow.com/questions/14842803/low-latency-audio-playback-on-android/16205370#16205370">this回答改善流性能非常有用。

I was working on audio streaming for Android using OpenSL ES and this tutorial helped me a lot. I followed the instructions here and got the thing working. Then i found audio streaming with this approach doesn't work very well for some devices (mostly samsung devices). I tried many things like increasing buffer size, disabling environmental reverb etc etc. I found this answer very useful for improving streaming performance.

最后,我发现声音是因为theadlocks我不得不使用同步缓冲开关的扭曲。使用无锁结构,提出了更好的音频性能。然后我去维克托拉扎里尼的另一种方法是锁免费音频IO。本文的<一个href="http://audioprograming.word$p$pss.com/2012/10/29/lock-free-audio-io-with-opensl-es-on-android/"相对=nofollow>无锁音频IO与OpenSL ES在Android 帮助了很多沿一个更好的音频性能,实现无锁结构。

Finally, I found the audio is distorted because of theadlocks I had to use for synchronizing the buffer switches. Using lock free structure is suggested for better audio performance. Then I went with another approach of Victor Lazzarini which is a lock free Audio IO. This article of Lock-free audio IO with OpenSL ES on Android helped a lot to implement a lock free structure along with a better audio performance.

这篇关于在8kHz采样率使用OpenSL所有Android设备的语音通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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