简体   繁体   English

iPhone中的循环音频样本

[英]Looped Audio samples in the iPhone

I am trying to made a musical iPhone application and I am having some problems playing looped samples. 我正在尝试制作音乐手机应用程序,但在播放循环采样时遇到一些问题。

I have read this question: audio-on-the-iphone 我已经阅读了这个问题: iPhone上的音频

and several other posts and blogs in the web about the "RemoteIO"/AudioUnits framework but without success. 以及网络上有关“ RemoteIO” / AudioUnits框架的其他一些帖子和博客,但没有成功。

I have been able to do a sample application that plays a finite sound with a predefined duration (I am using a playbackCallback) but I need the sound to start playing with the user touches the screen and stop playing when the user lift the finger. 我已经能够制作一个示例应用程序,该应用程序以预定义的持续时间播放有限的声音(我正在使用playbackCallback),但是我需要声音来让用户触摸屏幕开始播放,并在用户松开手指时停止播放。

Any ideas? 有任何想法吗?

Thanks in advance. 提前致谢。

Assuming your code is correct, you're probably omitting one (or more) of these steps: 假设您的代码正确,那么您可能会省略以下一个或多个步骤:

  1. Stopping reading/writing at the wrong times (because you're likely writing 'a power of 2' samples per render call) 在错误的时间停止读取/写入(因为您可能在每个渲染调用中写入“ 2的幂”样本)
  2. Not providing a fade in/fade out (start at 10 ms fade out and adjust as desired) 不提供淡入/淡出(从10毫秒开始淡出并根据需要进行调整)
  3. Not stopping write on a zero crossing 不停止过零写入
  4. not resetting the read position to 0 when the user lifts their finger - resuming in the middle of the sample 用户抬起手指时不将读取位置重置为0-在样本中间恢复
  5. Your samples are not properly trimmed to zero crossings at start, end, and/or loop positions 您的样本在开始,结束和/或循环位置未正确修剪为零交叉
  6. Not resetting internal effects, filters, or convertors 不重置内部效果,滤镜或转换器

You will not need all of these to avoid clicks. 您将不需要所有这些来避免单击。

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

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