# US 2021/0345053 A1 · Method and apparatus for detecting echo delay and electronic device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0345053 A1
- Document ID: US20210345053A1
- Status: Published application
- Kind: A1
- Application number: 17/036,845
- Filed: 2020-09-29
- Published: 2021-11-04
- Earliest claimed: 2020-04-30
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Zhengbin Song; Danqing Yang; Junfei Bu
- Web page: https://patentgrep.com/patent/US20210345053A1

## CPC

- H04M 9/082: {using echo cancellers (echo cancellers per se H04B3/23)}
- H04R 29/001: {for loudspeakers (H04R29/007 takes precedence)}
- G06F 3/165: {Management of the audio stream, e.g. setting of volume, audio stream path}
- H04M: TELEPHONIC COMMUNICATION (circuits for controlling other apparatus via a telephone cable and not involving telephone switching apparatus G08)
- H04R: LOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; ELECTRIC HEARING AIDS; PUBLIC ADDRESS SYSTEMS (producing sounds with frequency not determined by supply frequency G10K)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and an apparatus detect an echo delay. If an electronic device plays an audio and a counter is in an on state, an Nth recording data block received after the counter is turned on is acquired, where the Nth recording data block is a currently received recording data block, and N is greater than 1. Matching is performed between the Nth recording data block and a reference data block that is in a buffer, where the recording data block and the reference data block are data blocks with target duration. After the counter is on, the buffer buffers an audio data block played by the electronic device. If the Nth recording data block matches the reference data block in the buffer, a counting value is acquired. The counter performs counting if the recording data block does not match the reference data block. An echo delay is determined based on the target duration and the counting value.

## Claims

### Claim 1

A method for detecting an echo delay, applied to a first electronic device provided with a counter, and comprising:
in a case that the first electronic device plays an audio and the counter is in an on state, acquiring an Nth recording data block received after the counter is turned on, wherein the Nth recording data block is a currently received recording data block, and N is an integer greater than 1;
performing matching between the Nth recording data block and a reference data block that is in a buffer, wherein both the recording data block and the reference data block are data blocks with target duration, and the buffer is configured to, after the counter is turned on, buffer an audio data block played by the first electronic device;
in a case that the Nth recording data block matches the reference data block in the buffer, acquiring a first counting value of the counter, wherein the counter performs counting in a case that the recording data block does not match the reference data block in the buffer; and
determining the echo delay based on the target duration and the first counting value.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the acquiring a first counting value of the counter comprises:
acquiring a target quantity of matching times, wherein the target quantity of matching times comprises a quantity of times that the first electronic device continuously determines that the currently received recording data block matches the reference data block in the buffer; and
acquiring the first counting value of the counter in a case that the target quantity of matching times meets a preset condition.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the acquiring the first counting value of the counter in a case that the target quantity of matching times meets the preset condition comprises:
in a case that the target quantity of matching times is greater than or equal to a preset quantity of times, acquiring the first counting value of the counter, wherein a value of the preset quantity of times is an integer greater than 1.

### Claim 4 (depends on 2)

The method according to claim 2, wherein:
a maximum storage capacity of the buffer is equal to sizes of M reference data blocks, and M is an integer greater than 1; and
acquiring the first counting value of the counter in a case that the target quantity of matching times meets a preset condition comprises, in a case that the target quantity of matching times is M, acquiring the first counting value of the counter.

### Claim 5 (depends on 1)

The method according to claim 1, wherein performing the matching between the Nth recording data block and the reference data block that is in the buffer comprises:
in a case that an (N−1)th recording data block does not match the reference data block in the buffer, performing matching between the Nth recording data block and a first recording data block in the buffer.

### Claim 6 (depends on 1)

The method according to claim 1, wherein subsequent to the performing matching between the Nth recording data block and the reference data block that is in the buffer, the method further comprises:
in a case that the Nth recording data block does not match the reference data block in the buffer, acquiring a second counting value of the counter; and
in a case that a delay determined based on the second counting value and the target duration is greater than or equal to a preset delay threshold, clearing the buffer and resetting the counter.

### Claim 7 (depends on 1)

The method according to claim 1, wherein:
the first electronic device is configured to transmit the played audio to a second electronic device, and the second electronic device is configured to output the audio; and
the Nth recording data block is a recording data block recorded in a case that the second electronic device outputs the audio.

### Claim 8

An apparatus for detecting an echo delay, applied to a first electronic device provided with a counter, and comprising:
a memory;
a processor;
and a computer program stored in the memory and executable by the processor, the processor is configured to execute the computer program to,
in a case that the first electronic device plays an audio and the counter is in an on state, acquire an Nth recording data block received after the counter is turned on, wherein the Nth recording data block is a currently received recording data block, and N is an integer greater than 1,
perform matching between the Nth recording data block and a reference data block that is in a buffer, wherein both the recording data block and the reference data block are data blocks with target duration, and the buffer is configured to: after the counter is turned on, buffer an audio data block played by the first electronic device,
in a case that the Nth recording data block matches the reference data block in the buffer, acquire a first counting value of the counter, wherein the counter performs counting in a case that the recording data block does not match the reference data block in the buffer, and
determine the echo delay based on the target duration and the first counting value.

### Claim 9 (depends on 8)

The apparatus according to claim 8, wherein the processor is further configured to execute the computer program to:
acquire a target quantity of matching times, wherein the target quantity of matching times comprises a quantity of times that the first electronic device continuously determines that the currently received recording data block matches the reference data block in the buffer; and
acquire the first counting value of the counter in a case that the target quantity of matching times meets a preset condition.

### Claim 10 (depends on 9)

The apparatus according to claim 9, wherein the processor is further configured to execute the computer program to:
in a case that the target quantity of matching times is greater than or equal to a preset quantity of times, acquire the first counting value of the counter, wherein a value of the preset quantity of times is an integer greater than 1.

### Claim 11 (depends on 9)

The apparatus according to claim 9, wherein:
a maximum storage capacity of the buffer is equal to sizes of M reference data blocks, and M is an integer greater than 1; and
the processor is further configured to execute the computer program to, in a case that the target quantity of matching times is M, acquire the first counting value of the counter.

### Claim 12 (depends on 8)

The apparatus according to claim 8, wherein the processor is further configured to execute the computer program to:
in a case that an (N−1)th recording data block does not match the reference data block in the buffer, perform matching between the Nth recording data block and a first recording data block in the buffer.

### Claim 13 (depends on 8)

The apparatus according to claim 8, wherein the processor is further configured to execute the computer program to:
in a case that the Nth recording data block does not match the reference data block in the buffer, acquire a second counting value of the counter; and
in a case that a delay determined based on the second counting value and the target duration is greater than or equal to a preset delay threshold, clear the buffer and reset the counter.

### Claim 14 (depends on 8)

The apparatus according to claim 8, wherein:
the first electronic device is configured to transmit the played audio to a second electronic device;
the second electronic device is configured to output the audio; and
the Nth recording data block is a recording data block recorded in a case that the second electronic device outputs the audio.

### Claim 15

A non-transitory computer-readable storage medium storing a computer instruction, wherein the computer instruction is used for causing a computer to:
in a case that the first electronic device plays an audio and the counter is in an on state, acquire an Nth recording data block received after the counter is turned on, wherein the Nth recording data block is a currently received recording data block, and N is an integer greater than 1;
perform matching between the Nth recording data block and a reference data block that is in a buffer, wherein both the recording data block and the reference data block are data blocks with target duration, and the buffer is configured to: after the counter is turned on, buffer an audio data block played by the first electronic device;
in a case that the Nth recording data block matches the reference data block in the buffer, acquire a first counting value of the counter, wherein the counter performs counting in a case that the recording data block does not match the reference data block in the buffer; and
determine the echo delay based on the target duration and the first counting value.

### Claim 16 (depends on 15)

The non-transitory computer-readable storage medium according to claim 15, wherein the computer instruction is used for causing the computer to:
acquire a target quantity of matching times, wherein the target quantity of matching times comprises a quantity of times that the first electronic device continuously determines that the currently received recording data block matches the reference data block in the buffer; and
acquire the first counting value of the counter in a case that the target quantity of matching times meets a preset condition.

### Claim 17 (depends on 16)

The non-transitory computer-readable storage medium according to claim 16, wherein the computer instruction is used for causing the computer to:
in a case that the target quantity of matching times is greater than or equal to a preset quantity of times, acquire the first counting value of the counter, wherein a value of the preset quantity of times is an integer greater than 1.

### Claim 18 (depends on 16)

The non-transitory computer-readable storage medium according to claim 16, wherein:
a maximum storage capacity of the buffer is equal to sizes of M reference data blocks, and M is an integer greater than 1, and
the computer instruction is used for causing the computer to, in a case that the target quantity of matching times is M, acquire the first counting value of the counter.

### Claim 19 (depends on 15)

The non-transitory computer-readable storage medium according to claim 15, wherein the computer instruction is used for causing the computer to:
in a case that an (N−1)th recording data block does not match the reference data block in the buffer, perform matching between the Nth recording data block and a first recording data block in the buffer.

### Claim 20 (depends on 15)

The non-transitory computer-readable storage medium according to claim 15, wherein the computer instruction is used for causing the computer to:
in a case that the Nth recording data block does not match the reference data block in the buffer, acquire a second counting value of the counter; and
in a case that a delay determined based on the second counting value and the target duration is greater than or equal to a preset delay threshold, clear the buffer and reset the counter.
