From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Ducking sound in AVAudioSession

Ducking sound in AVAudioSession

From the course: iOS Development Tips

Ducking sound in AVAudioSession

- [Instructor] Ducking has nothing to do with water file. Sometimes you'll want to add sound to your app. The user will be using the music or others' apps along with your app. For that, you want to slightly lower the volume of the background music so you can put your sounds in the foreground, that's ducking. That's not very hard to do. Download the exercise file, which is the Speech Synthesizer app from an earlier tip. I'm already running this on my iPad mini, but before I do, I'm going to start up a bit of music. (soft rock music) And with the music playing, I'm going to go ahead and hit the Speak! button. - [Computer] I could go for a good pizza right now. - [Instructor] And the music disappears. Okay, you can stop the app now. There's an object called the AVAudioSession. While part of AVFoundation, it has a default setting that without AVFoundation, it only plays one channel of sound. To combine channels, you have to configure the current AVAudioSession to do so. Usually you'll do…

Contents