iPhone - 使用 AVAudioPlayer 防止播放声音结束时发出滴答声
在使用 AVAudioPlayer 播放短声音结束时,我听到“滴答”声。我正在重复播放一段非常短的声音(0.1 秒),每次播放结束时的“滴答声”非常令人不安。我怎样才能防止这种“蜱虫”?
At the end of a short sound played with an AVAudioPlayer, I hear a "tick" sound. I'm playing a repeatedly timed very short sound (0.1 sec) and that "tick" at the end of each play is very very disturbing. How may I prevent that "tick" ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保声音文件的开头和结尾至少包含几毫秒的静音。
即使在 100 毫秒的静默后,AVAudioPlayer 仍可能在某些操作系统版本的设备上产生滴答声。如果是这样,您可能必须使用其他音频 API。将音效混合到连续运行的音频队列或 RemoteIO 音频单元中可能是保证在所有 iOS 设备和应用程序上绝对没有点击的唯一方法。操作系统版本组合。
Make sure the beginning and end of your sound file contains at least a few milliseconds of silence.
The AVAudioPlayer may still produce a tick on some devices with some OS versions, even after 100 mS of silence. If so, you may have to use another audio API. Mixing sound effects into a continuously running Audio Queue or the RemoteIO Audio Unit may be the only way to guarantee absolutely no clicks on all iOS device & OS version combinations.