Automatic Delay Estimation & Correction (ADEC)

The ADEC module automatically corrects for possible delay offsets between the reference and the loudspeakers.

Echo cancellation is an adaptive filtering process which compares the reference audio to that received from the microphones. It models the reverberant time of a room, i.e. the time it takes for acoustic reflections to decay to insignificance. This is shown in the figure below (the red “Acoustic echo path delay”).

The time window modelled by the Acoustic Echo Canceller (AEC) is finite (filter tail length), and to maximise its performance it is important to ensure that the reference audio is presented to the AEC time aligned to the audio being reproduced by the loudspeakers. The diagram below highlights how the reference audio path delay and the audio reproduction path may be significantly different, therefore requiring additional delay to be inserted into one of the two paths, correcting this delay difference.

../../../_images/image23.png

Fig. 25 ADEC use case diagram

The functional blocks in the ADEC are shown below:

../../../_images/image24.png

Fig. 26 ADEC block diagram

The ADEC may apply a delay to either the microphone or the reference path. When the loudspeaker signal lags behind the reference signal, the ADEC places a delay into the reference channel. When the reference signal lags behind the loudspeaker speaker, the ADEC places a delay into the microphone channel..

Automatic delay estimation is triggered at power-up, or if the host system configuration changes. The process will not begin until the reference signal is present and has sufficient energy.

The delay estimation process re-purposes the AEC to detect larger delays. During estimation, the AEC does not perform cancellation. Once the delay is detected and delay correction made, the AEC restarts and converges based on the delayed signals.

Possible causes that may trigger an estimation cycle (where automatic mode is enabled):

  • Host changing applications causing a delay change between loudspeakers and reference.

  • Large volume changes between the reference and the loudspeaker play-back.

  • User equipment changes, such as switching from TV audio output to playing the audio through a sound bar.

The characteristics and specification of the ADEC function is shown below:

Table 32 ADEC characteristics

Name

Value

Description

Maximum delay correction

± 150ms

The maximum delay that can be added to either the microphone channel or the reference channel.

Estimation time

With good reference SNR: 2-5 seconds

During this time AEC is disabled. Note that estimation will not start unless reference is available and loudspeakers are playing back.

The configuration commands are shown below:

Table 33 Automatic Delay Estimator parameters

COMMAND

TYPE

VALUE

DESCRIPTION

NOTES

GET_DELAY_SAMPLES SET_DELAY_SAMPLES

uint32

[0 .. 2399]

Change the number of samples of input delay at the sample rate 16kHz. The delay is applied to either the reference or the microphone input according to the delay direction. This provides a maximum delay of +/- 150mS.

A

GET_DELAY_DIRECTION SET_DELAY_DIRECTION

uint32

[0,1]
0 - Delay the reference input (default)
1 - Delay the microphone input

Select the direction of input delay. i.e. it is applied to either the microphone input path or the reference signal path.

A

GET_DELAY_ESTIMATE

uint32

[0 .. 7200]

Get an estimate of the number of samples of delay on the reference input at a sample rate of 16kHz. This value is valid only when a delay estimation is in progress and is offset by the maximum length of the delay buffer (2400 samples). Add 2400 samples to this value to get the absolute delay estimate.

SET_ADEC_ENABLED GET_ADEC_ENABLED

uint32

[0, 1]
0 - ADEC disabled
1 - ADEC enabled

Enable automatic delay control.

GET_ADEC_MODE

uint32

[0,1]
0 - Normal AEC mode
1 - delay estimation in progress

Get the status of delay estimation.

SET_MANUAL_ADEC _CYCLE_TRIGGER

uint32

Trigger a delay estimation cycle. The default behavior in firmware is to trigger a delay estimation cycle when the far end reference is detected for the first time after device reset. This is done irrespective of whether automatic delay control is enabled or disabled. To disable this initial delay estimation, set SET_MANUAL_ADEC_CYCLE_TRIGGER=0 in the data partition. For all other times, if delay estimation is disabled, the SET_MANUAL_ADEC_CYCLE_TRIGGER can be used to force a delay estimation cycle.

GET_AEC_PEAK_TO _AVERAGE_RATIO

float

Get current AEC filter coefficients peak to average ratio. If this value is above 4, the AEC has a “good” peak to average ratio.

NOTES:

[A] When the ADEC is enabled, this value will be overwritten, therefore the SET commands should not be used. GET commands remain valid.