In this episode we add looping background music to the game using AVFoundation and AVAudioPlayer. We then add sound effects using Sprite Kit's SKAction. In order to reduce lag, we preload the audio files so that they play instantaneously. We also implement rate limiting to avoid sound effect overload using SAMRateLimit.
Episode Links Audio Tutorial for iOS - This post by Ray Wenderlich has a great explanation of various audio formats and why some are better than others for use on iOS. Audio Jungle - This is the site where I purchased licensed sound files for use in the game. I can't distribute these, so the ones you'll see in the sample code will be lower-quality stand-ins. Envato Marketplace - Envato is the umbrella company around Audio Jungle and others. You can buy graphics, photos, 3d art, video projects, and more here. It's quite a valuable resource. WWDC Session 404 - Advancements in Objective-C - This WWDC Session has some background on the module import feature I've used a couple of times. If that syntax is unfamiliar to you, take a look here. Episode Source Code- Note that the sounds have been replaced with free ones. See the readme in this repository for more information.