iPhone,以音频形式播放字节形式的原始数据
我有字节形式的原始数据,我想在应用程序启动时播放它。字节流将每隔几秒传输一次,我需要播放它,因此它也应该具有非常低的延迟。如果可能,请提供示例代码。谢谢。
I have raw data in byte form and I want to play it when my application starts. The byte stream will be streamed in every few seconds and I need to play it so it should also have very low latency. Please provide sample code, if possible. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 Apple 的示例 iOS 应用程序 aurioTouch(位于developer.apple.com 上的某个位置),了解有关如何使用音频单元 RemoteIO API 播放原始音频 PCM 示例缓冲区的示例代码。您还可以使用音频队列 API,但 RemoteIO API 提供最低的延迟。这些不是仅用几行示例代码就可以正确描述的简单 API。
Look at Apple's sample iOS application aurioTouch (somewhere on developer.apple.com) for example code on how to use the Audio Unit RemoteIO API to play raw audio PCM sample buffers. You can also use the Audio Queue API, but the RemoteIO API provides the lowest latency. These are not simple APIs that can be properly described with only a few lines of sample code.
播放原始音频的另一种可能方法是使用 OpenAL图书馆。
以下是一些使用原始 PCM 音频流加载和播放音频文件的苹果示例:
OpenAExample 和 oalTouch
Another possible way to play raw audio is to use the OpenAL library.
Here are some apple examples of loading and playing audio files using raw PCM audio streams:
OpenALExample and oalTouch