1
votes

I'm trying to figure out how to add some sound design elements to my game. For example.. I want an engine sound to change pitch or grow louder as my sprite moves faster. Obviously this is outside the scope of SKAction. I've tried AVAudioPlayer.. this works but it seems to be more suited towards playing music. Even running a short loop using AVAudioPlayer produces popping sounds between each loop.

How can I control things like pitch, volume, playback speed programmatically?

This seems useful.

http://kstenerud.github.io/ObjectAL-for-iPhone/index.html

but is there a swift version.. or can I bridge this over to swift somehow.

1
You can seamlessly integrate ObjC with Swift: developer.apple.com/library/prerelease/ios/documentation/Swift/… - idmean
If you really want to go nuts, there's a port of Pure Data's libpd for iOS. I'm just going through this book right now. Warning: Pure Data's design interface looks like someone's university project from 1991. It's utterly awful. But it does work and allow you to completely synthesise sound from scratch with dynamic realtime control. - Matt Gibson
About the loop thing... there are a couple of workarounds that are very usefull: 1) Use uncompressed audio for short loops, they behave better since they do not need of decompressing before adding data into buffer, thus using less cpu, they take more space but sound better and behave nice. 2) Use a blank (silence) sound and loop it always in the background, this will keep the audio engine always ready and available. Hope it helps, and remember that they are workarounds. - Juan Boero

1 Answers

-1
votes

ObjectAL can be added as a Pod into a Swift project, i am using it right now in my own Swift projects.