Understanding audio ducking

When audio ducking is enabled, all audio streams adhere to an audio ducking policy that's defined in the audio policy configuration file.

Each audio stream on the system should match an audio type that's defined in the audio policy configuration file. Calls to snd_pcm_*_params() with an audio type that doesn't match a defined audio type will fail with EINVAL. If you call snd_pcm_*_params() without providing an audio type, then the default type is assigned. Each audio type is prioritized based on the order it appears in the configuration file. The highest priority is assigned to the first audio type that's defined at the top of the file, and the lowest priority audio type is assigned to last audio type defined in the file.

If multiple audio streams are played concurrently, the higher-priority audio type listed in the audio policy configuration file applies ducking, which forces the lower priority audio type to be ducked (or lowered in volume). For example, if you have a voice call occur while music is playing, and the voice call is defined as having a higher priority than the music audio type, then music is ducked (or lowered in volume) so that the voice call is heard more clearly. In this case, the voice call is performing ducking and the music is ducked.

If you have subchannels in the same PCM group and one channel is playing, when the other stream in the group plays, the other stream has audio ducking applied to it so that the second stream in the PCM can play.

Tip: If you have Audio component BuildID 237—June 29, 2017 (7.0.237.S201706290957) or a later update installed, the following applies:

Previously, the audio management polices weren't correctly applied to subchannels that were grouped together. Subchannels in the same PCM link group caused audio management polices to be applied on one another. For example, if you had two subchannels grouped together and one of those streams was playing, but then you played the second stream in that group (which is the same audio type), incorrect audio ducking occurred where the first stream would have audio ducking applied to it so that the second stream could play.

This update applies audio management policies so that grouped subchannels are treated as a single audio stream rather than as individual streams.

Using audio ducking

You must create an audio policy configuration file that follows the rules defined in the Syntax of the audio policy configuration file section in this chapter. If the specified audio ducking file isn't specified (or doesn't exist), audio ducking won't be used.

Note: If you disable the software mixer (by specifying disable_sw_mixer option when you run io-audio), ducking isn't available, regardless of the audio policy configuration file. For information, see the disable_sw_mixer option in the entry for io_audio in the Utilities Reference.

To configure the audio policy configuration file with io-audio so that you can use ducking, do one of the following: