开发者

Looping audio on iOS with explicit loop-in and loop-out points

I am developing an iO开发者_如何学CS application which resembles a musical instrument.

I am trying to loop the sound samples to make them last infinitely. Simple looping is not sufficient in this case, as the samples have an "attack" section: Each sample has a part at the beginning which should not be looped. Therefore, I need some way to loop only a certain part of the sound sample.

I found a few iOS sound libraries (e.g. ObjectAL), but they all seem to support only simple looping, without an option to set loop-in and loop-out points.

Are they any iOS audio libraries which support this feature? Otherwise, what would be the best method to implement it? (Audio units? Audio queues? Some other trick with existing libraries?)

Thanks!


I can't say if it's the best solution, but for my loops that have an intro / outro... I use multiple .caf files that blend together: one for the intro, one for the loop, and one for the outro.

After the intro, the loop starts and plays until an event fires that makes the sound stop looping and finish, and then the outro immediately plays once the loop sound finishes.

I use Audacity to edit the sound files to make sure that they blend together perfectly.

Edit:

My application uses cocos2d, so I'm using the cocosDehension audio library since it is built in to cocos2d. As long as the sound file has been properly edited, it loops cleanly with no clicks or pops.

Here's a link to the technique that I used in Audacity to make sure the file looped without clicks:

http://forum.audacityteam.org/viewtopic.php?f=13&t=2820#p11073

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜