Understanding how multiple ducking levels cumulate

Higher priority audio types can each apply a ducking level to a lower priority audio type, which creates a cumulative ducking level.

This behavior ensures that the relative ducking levels are correct. For example, using the file shown in “Example of an audio policy configuration file”, a system plays three active audio streams that match the audio types voice, ringtone, and multimedia. Each stream starts with a volume level of 100:

voice = 100
ringtone = 100
multimedia = 100

The volume decreases to the following levels after ducking occurs:

voice = 100
ringtone = 50
multimedia = 10

The voice audio type's duck_lower_prio_percent key causes both the lower priority audio types to adjust to 50% volume (50), but because the ringtone audio type's duck_lower_prio_percent key is set to 20, ringtone applies additional ducking to the lower priority audio type, multimedia. In this case, 20% of 50 is a volume level of 10.

Example of an audio policy configuration file

[audio_type]
name=voice
prio=same
duck_same_prio_policy=last_wins
duck_same_prio_percent=0
duck_lower_prio_percent=50

[audio_type]
name=ringtone
# priority of the audio type is decreased by one from previous audio type
prio=decr
# ducking policy of same priority is last_wins, i.e., the last added
# audio stream can duck previously  added audio streams of same priority
duck_same_prio_policy=last_wins
duck_same_prio_percent=50                
duck_lower_prio_percent=20

[audio_type]
name=nav
prio=decr
duck_same_prio_policy=last_wins
# Channel 0 ducked to 50 percent, Channel 1 remains at 100 percent
# Ducking values default to 100 (no ducking) for channels not listed
duck_same_prio_percent=ch0:50,ch1:100
duck_lower_prio_percent=ch0:50,ch1:100

[audio_type]
name=tts_front
prio=decr
duck_same_prio_policy=last_wins
# Ducking values apply to all channels
duck_same_prio_percent=50
duck_lower_prio_percent=50

[audio_type]
name=tts_back
prio=same
duck_same_prio_policy=last_wins
duck_same_prio_percent=50
duck_lower_prio_percent=50

[audio_type]
name=multimedia
prio=decr
duck_same_prio_policy=last_wins
duck_same_prio_percent=0
duck_lower_prio_percent=50

[audio_type]
name=default
prio=decr
# Mix audio streams at same priority with the below ducking configuration
duck_same_prio_policy=mix
# 100 percent means that no ducking is performed
duck_same_prio_percent=100
duck_lower_prio_percent=noducking