18.2 · The audio session, interruptions, routes and AVAudioEngine

On iOS, audio is a shared resource with rules. The session tells the system what your app is doing with sound, and the system answers with who gets to play, who is silenced and where it goes.

Mental model. Declare intent (the category), listen for interruptions and route changes, and build processing graphs only when you need them.

Sharing the speaker

Audio session categories, interruptions and route changes.

  1. What is the AVAudioSession, how do categories and modes decide behaviour, and how do you handle interruptions and route changes? 18.2.1 · L3
    The audio session (AVAudioSession.sharedInstance()) is your app’s contract with the system about audio. Its category declares intent and decides defaults…

Processing sound

AVAudioEngine graphs, formats and buffers.

  1. How does AVAudioEngine work: nodes, formats, buffers, and when do you use it instead of AVAudioPlayer? 18.2.2 · L5
    Use AVAudioPlayer to play a file with minimal code, and AVAudioEngine when you need a processing graph: mixing several sources, effects (reverb, EQ, delay…

More in Media & graphics