简体   繁体   English

我需要哪种音频播放技术?

[英]Which audio playback technology do I need for this?

I have trouble choosing the right audio playback technology. 我在选择正确的音频播放技术时遇到了麻烦。 There's a ton of technologies to use on the iPhone, it's so confusing. iPhone上有大量技术要使用,这是如此令人困惑。

What I need to do is this: 我需要做的是:

  • start playing short sounds ranging between 0.1 and 2 seconds 开始播放介于0.1到2秒之间的短声音

  • high quality playback, no crackle (I heard some of the iPhone audio playback technologies do a crackle sound on start or end, which is bad!) 高质量的播放,没​​有crack啪声(我听说某些iPhone音频播放技术在开始或结束时发出crack啪声,这很糟糕!)

  • ability to start playback of a sound, while there's already another one playing right now (two, three or more sounds at the same time) 能够开始播放声音,而现在又有一个声音正在播放(同时有两个,三个或更多声音)

What would you suggest here, and why? 您在这里提出什么建议,为什么? Thanks :-) 谢谢 :-)

There are basically four options for playing audio on the iPhone: 在iPhone上播放音频基本上有四个选项:

  1. Audio Toolbox . 音频工具箱 Easy, but only good for playing sound effects in applications ( sample code ). 简单,但仅适用于在应用程序中播放声音效果( 示例代码 )。

  2. Audio Queue Services . 音频队列服务 Very powerful, can do anything. 非常强大,可以做任何事情。 C API, pretty messy to work with. C API,使用起来非常混乱。 Callbacks, buckets, pain. 回调,水桶,痛苦。

  3. AVAudioPlayer . AVAudioPlayer About the easiest option. 关于最简单的选择。 Can play compressed audio, with a simple wrapper you can easily play multiple instances of the same sample at once (non-compressed audio only, as there is only one HW audio decoder). 可以播放压缩的音频,只需使用一个简单的包装即可轻松地一次播放同一样本的多个实例(仅非压缩音频,因为只有一个HW音频解码器)。 Starting to play a sound with AVAudioPlayer seems to lag about 20 ms , could be a problem. 开始使用AVAudioPlayer播放声音似乎滞后了大约20毫秒 ,这可能是一个问题。

  4. OpenAL . OpenAL Decent compromise between complexity and features. 复杂性和功能之间的妥协。 Sounds do not lag, you can play multiple sounds just fine, but you have to do a lot of the work yourself. 声音不会滞后,您可以播放多种声音,但是您必须自己做很多工作。 I've written a sound engine called Finch that can help you. 我编写了一个名为Finch的声音引擎,可以为您提供帮助。

Don't know much about cracking, never experienced it. 对裂纹了解不多,从未经历过。 I think there were some issues with playing seamless compressed loops with AVAudioPlayer , can be overcome by saving the loop without compression. 我认为使用AVAudioPlayer播放无缝压缩循环存在一些问题,可以通过保存未压缩的循环来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM