An echo cancellation method, device, electronic device and storage medium

Through the combination of adaptive filters and auxiliary filters, selecting the appropriate filter based on the residual echo energy for echo cancellation, solving the problem of poor signal quality caused by echo in speakers and microphone devices and improving signal transmission quality.

CN115834778BActive Publication Date: 2025-07-22BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211441512.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2025-07-22
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

In the prior art, when the electronic devices of speakers and microphones transmit sound signals, echoes will cause poor signal quality.

Method used

The echo estimation is performed separately by adaptive filters and auxiliary filters, and the appropriate filter is selected for echo cancellation based on the residual echo energy, ensuring that filters with smaller residual echo energy are used for echo cancellation in the non-dual state.

Benefits of technology

The sound signal quality transmitted to remote devices is improved, and the problems of unclean echo cancellation and serious voice shearing are solved, achieving better echo cancellation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834778B_ABST
    Figure CN115834778B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an echo cancellation method, apparatus, electronic device, and storage medium. The method includes: using an adaptive filter and an auxiliary filter to respectively perform echo estimation on a remote sound signal to obtain a first echo estimation signal and a second echo estimation signal; determining whether it is in a double-talk state or a non-double-talk state according to a first cross-correlation value and a second cross-correlation value between the first echo estimation signal and the second echo estimation signal and a proximal sound signal; when in the non-double-talk state, respectively determining a first residual echo energy and a second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the proximal sound signal; when the first residual echo energy is greater than the second residual echo energy, using the auxiliary filter to cancel the echo signal in the proximal sound signal. Applying the technical solution provided by the embodiment of the present application can solve the problem of poor quality of the sound signal transmitted to the remote device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of voice processing technologies, and in particular, to an echo cancellation method, apparatus, electronic device, and storage medium. Background Art

[0002] For an electronic device having a speaker and a microphone, when the speaker of the electronic device is operating, the sound signal played by the speaker will be collected by the microphone, forming an echo, that is, the echo is the sound signal collected by the microphone after being played by the speaker. The echo will affect the effective sound signal that the microphone needs to transmit, resulting in poor quality of the sound signal transmitted to the remote device. Summary of the Invention

[0003] The purpose of the embodiments of this application is to provide an echo cancellation method, apparatus, electronic device, and storage medium to solve the problem of poor quality of the sound signal transmitted to the remote device. The specific technical solutions are as follows:

[0004] In the first aspect implemented in this application, first, an echo cancellation method is provided, and the method includes:

[0005] Using an adaptive filter and an auxiliary filter, respectively perform echo estimation on the remote sound signal to obtain a first echo estimation signal and a second echo estimation signal;

[0006] When in the non-dual-talk state, respectively determine a first residual echo energy and a second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the proximal sound signal;

[0007] When the first residual echo energy is greater than the second residual echo energy, use the auxiliary filter to cancel the echo signal in the proximal sound signal.

[0008] Optionally, the method further includes:

[0009] When the first residual echo energy is less than or equal to the second residual echo energy, use the adaptive filter to cancel the echo signal in the proximal sound signal.

[0010] Optionally, the method further includes:

[0011] When in the dual-talk state, use the auxiliary filter to cancel the echo signal in the proximal sound signal.

[0012] Optionally, the method further includes:

[0013] Respectively determine a first cross-correlation value and a second cross-correlation value between the first echo estimation signal and the second echo estimation signal and the proximal sound signal;

[0014] When the target cross - correlation value is greater than or equal to a preset correlation threshold, it is determined that the non - double - talk state is in effect. The target cross - correlation value is the first cross - correlation value, the second cross - correlation value, or the cross - correlation value determined based on the first cross - correlation value and the second cross - correlation value;

[0015] When the target cross - correlation value is less than the preset correlation threshold, it is determined that the double - talk state is in effect.

[0016] Optionally, the target cross - correlation value is determined through the following steps:

[0017] Detect the filter currently used to eliminate the echo signal in the proximal sound signal; if the adaptive filter is currently used to eliminate the echo signal in the proximal sound signal, determine the first cross - correlation value as the target cross - correlation value; if the auxiliary filter is currently used to eliminate the echo signal in the proximal sound signal, determine the second cross - correlation value as the target cross - correlation value; or

[0018] Calculate the mean value of the first cross - correlation value and the second cross - correlation value to obtain the target cross - correlation value.

[0019] Optionally, the step of respectively determining the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal includes:

[0020] Respectively determine the first error signal and the second error signal after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal;

[0021] Based on the proximal sound signal, the first error signal, and the second error signal, determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal.

[0022] Optionally, the step of determining the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal based on the proximal sound signal, the first error signal, and the second error signal includes:

[0023] According to the ratio of the proximal sound signal to the first error signal and the ratio of the proximal sound signal to the second error signal, determine the first residual ratio of the adaptive filter to eliminate the echo signal in the proximal sound signal and the second residual ratio of the auxiliary filter to eliminate the echo signal in the proximal sound signal;

[0024] Wherein, the reciprocal of the first residual ratio represents the first residual echo energy after eliminating the first echo estimation signal in the proximal sound signal, and the reciprocal of the second residual ratio represents the second residual echo energy after eliminating the second echo estimation signal in the proximal sound signal.

[0025] Optionally, the optimal adaptive coefficient used by the auxiliary filter to eliminate the echo signal in the proximal sound signal is updated through the following steps:

[0026] Obtain the current adaptive coefficient used by the adaptive filter to eliminate the echo signal in the proximal sound signal currently;

[0027] Respectively determine the third residual echo energy and the fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to eliminate the echo signal in the proximal sound signal;

[0028] If the third residual echo energy is greater than the fourth residual echo energy, update the optimal adaptive coefficient to the current adaptive coefficient;

[0029] If the third residual echo energy is less than or equal to the fourth residual echo energy, keep the optimal adaptive coefficient.

[0030] In the second aspect of the implementation of the present application, an echo cancellation device is further provided, and the device includes:

[0031] An estimation unit, configured to respectively perform echo estimation on the distal sound signal by using an adaptive filter and an auxiliary filter to obtain a first echo estimation signal and a second echo estimation signal;

[0032] A first determination unit, configured to respectively determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal when in a non-dual-talking state;

[0033] A first cancellation unit, configured to use the auxiliary filter to cancel the echo signal in the proximal sound signal when the first residual echo energy is greater than the second residual echo energy.

[0034] Optionally, the device further includes:

[0035] A second cancellation unit, configured to use the adaptive filter to cancel the echo signal in the proximal sound signal when the first residual echo energy is less than or equal to the second residual echo energy.

[0036] Optionally, the device further includes:

[0037] A third cancellation unit, configured to, when in a double-talk state, cancel an echo signal in the near-end voice signal by using the auxiliary filter.

[0038] Optionally, the apparatus further includes:

[0039] A second determination unit, configured to respectively determine a first cross-correlation value and a second cross-correlation value between the first echo estimation signal and the second echo estimation signal and the near-end voice signal;

[0040] A third determination unit, configured to determine that it is in a non-double-talk state when a target cross-correlation value is greater than or equal to a preset correlation threshold, where the target cross-correlation value is the first cross-correlation value, the second cross-correlation value, or a cross-correlation value determined according to the first cross-correlation value and the second cross-correlation value;

[0041] A fourth determination unit, configured to determine that it is in a double-talk state when the target cross-correlation value is less than the preset correlation threshold.

[0042] Optionally, the apparatus further includes a fifth determination unit, configured to determine a target cross-correlation value;

[0043] The fifth determination unit is specifically configured to detect a filter used to cancel an echo signal in the near-end voice signal currently; if the adaptive filter is currently used to cancel an echo signal in the near-end voice signal, determine the first cross-correlation value as the target cross-correlation value; if the auxiliary filter is currently used to cancel an echo signal in the near-end voice signal, determine the second cross-correlation value as the target cross-correlation value; or

[0044] Specifically configured to calculate an average value of the first cross-correlation value and the second cross-correlation value to obtain the target cross-correlation value.

[0045] Optionally, the first determination unit includes:

[0046] A first determination subunit, configured to respectively determine a first error signal and a second error signal after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal;

[0047] A second determination subunit, configured to determine a first residual echo energy and a second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal based on the near-end voice signal, the first error signal, and the second error signal.

[0048] Optionally, the second determination subunit is specifically configured to:

[0049] Determine a first residual ratio of the adaptive filtering for eliminating the echo signal in the near-end voice signal and a second residual ratio of the auxiliary filtering for eliminating the echo signal in the near-end voice signal according to the ratio of the near-end voice signal to the first error signal and the ratio of the near-end voice signal to the second error signal;

[0050] Wherein, the reciprocal of the first residual ratio represents the first residual echo energy after eliminating the first echo estimation signal in the near-end voice signal, and the reciprocal of the second residual ratio represents the second residual echo energy after eliminating the second echo estimation signal in the near-end voice signal.

[0051] Optionally, the apparatus further includes: an updating unit, configured to update the optimal adaptive coefficient used by the auxiliary filter for eliminating the echo signal in the near-end voice signal;

[0052] The updating unit includes:

[0053] An obtaining subunit, configured to obtain the current adaptive coefficient used by the current adaptive filter for eliminating the echo signal in the near-end voice signal;

[0054] A third determining subunit, configured to respectively determine a third residual echo energy and a fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to eliminate the echo signal in the near-end voice signal;

[0055] An updating subunit, configured to update the optimal adaptive coefficient to the current adaptive coefficient if the third residual echo energy is greater than the fourth residual echo energy;

[0056] A maintaining subunit, configured to maintain the optimal adaptive coefficient if the third residual echo energy is less than or equal to the fourth residual echo energy.

[0057] In a third aspect of the implementation of the present application, an electronic device is further provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;

[0058] The memory is configured to store a computer program;

[0059] The processor is configured to implement the echo cancellation method according to any one of the above when executing the program stored on the memory.

[0060] In a fourth aspect of the implementation of the present application, a computer-readable storage medium is further provided, where the computer-readable storage medium stores a computer program, and the computer program implements the echo cancellation method according to any one of the above when executed by a processor.

[0061] In the technical solution provided by the embodiments of the present application, when in the non-dual-talk state, the residual echo energies brought by the adaptive filter and the auxiliary filter are compared, and the filter with the smaller residual echo energy is used to eliminate the echo signal. For example, in the embodiments of the present application, if the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, the auxiliary filter is used to eliminate the echo signal in the proximal sound signal. Compared with the related art, in the dual-talk state, when the residual echo energy brought by the adaptive filter is very large, the auxiliary filter is used to eliminate the echo signal in the proximal sound signal. The technical solution provided by the embodiments of the present application can complete the filter switching at an appropriate time, that is, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, so that the technical solution provided by the embodiments of the present application always uses the filter with better echo cancellation effect to eliminate the echo, solves the problem of poor quality of the sound signal transmitted to the remote device, and improves the quality of the sound signal transmitted to the remote device. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art.

[0063] Figure 1 A schematic diagram of an application example for echo signal cancellation;

[0064] Figure 2 Another schematic diagram of an application example for echo signal cancellation;

[0065] Figure 3 The first flowchart of an echo cancellation method provided by the embodiments of the present application;

[0066] Figure 4 The second flowchart of an echo cancellation method provided by the embodiments of the present application;

[0067] Figure 5 The third flowchart of an echo cancellation method provided by the embodiments of the present application;

[0068] Figure 6 The first flowchart of a dual-end detection method provided by the embodiments of the present application;

[0069] Figure 7 A detailed schematic diagram of some steps in step S32 and step S42;

[0070] Figure 8 The first flowchart of a method for updating the optimal adaptive coefficient provided by the embodiments of the present application;

[0071] Figure 9 The first block diagram of the echo cancellation device provided by the embodiment of the present application;

[0072] Figure 10 The second block diagram of the echo cancellation device provided by the embodiment of the present application;

[0073] Figure 11 The third block diagram of the echo cancellation device provided by the embodiment of the present application;

[0074] Figure 12 A refined schematic diagram of the update unit in the echo cancellation device provided by the embodiment of the present application;

[0075] Figure 13 A schematic diagram of the structure of an electronic device provided by the embodiment of the present application. Detailed implementation manners

[0076] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application.

[0077] For easy understanding, the terms appearing in the embodiments of the present application will be described below.

[0078] Remote voice signal: A voice signal transmitted from a remote device to the local device and played by the local device's speaker.

[0079] Near-end voice signal: A voice signal collected by the local device through a microphone. The near-end voice signal may include a valid voice signal, an echo signal, noise, etc. A microphone is also called a microphone.

[0080] DTD (Double Talk Detection): Detect whether the remote voice signal and the near-end voice signal exist simultaneously. Among them, when the remote voice signal and the near-end voice signal exist simultaneously, it is a double-talk state; when only the remote voice signal or only the near-end voice signal exists, it is a single-talk state. Currently, double-end detection algorithms include energy-based detection algorithms such as the Geigel algorithm and detection algorithms based on signal correlation characteristics.

[0081] Adaptive filter: A filter that continuously updates the adaptive coefficients according to the echo path and cancels the linear echo signal in the near-end voice signal. In the embodiment of the present application, the adaptive filter may be a PBFDAF (Partitioned Block Frequency Domain Adaptive Filter), or other types of adaptive filters, which are not limited herein. An adaptive filter is also called a fast filter, and the update of the adaptive coefficients in the adaptive filter is not affected by the double-end detection result.

[0082] Auxiliary filter: A filter that copies the adaptive coefficients of an adaptive filter and then eliminates the linear echo signal in the near-end sound signal according to the copied adaptive coefficients. In the embodiments of the present application, the auxiliary filter can be a Kalman filter, or can be other types of auxiliary filters, which are not limited herein. The auxiliary filter can also be referred to as a slow filter, and the auxiliary filter is affected by the convergence effect of echo cancellation of the adaptive filter.

[0083] In the related art, the principle model of AEC (Acoustic Echo Canceller) with double-end detection is as Figure 1 shown. Figure 1 For an application example of echo signal cancellation based on PBFDAF filtering + DTD algorithm, where the DTD algorithm uses the following formula to calculate the near-end and far-end energy ratio:

[0084]

[0085] In formula (1), ξ represents the near-end and far-end energy ratio, x(n) is the discrete sequence in the frequency domain of the downlink far-end sound signal, N is the length of the filter, d(n) is the near-end sound signal sampled by the microphone, the near-end sound signal includes an echo signal, and the near-end sound signal has completed NLMS (normalized least mean square) delay alignment. E represents weighted averaging, and max represents taking the maximum value.

[0086] Based on the calculated near-end and far-end energy ratio, the output of the DTD algorithm is:

[0087]

[0088] In formula (2), T is a preset near-end and far-end energy ratio. When ξ is less than T, it indicates that the current is in the single-talk state or non-dual-talk state, and the output of the DTD algorithm is 0; when ξ is greater than or equal to T, it indicates that the current is in the dual-talk state, and the output of the DTD algorithm is 1. In one example, T is taken as 0.5. At this time, the principle of the DTD algorithm is: in the circuit echo, if the echo energy does not exceed half of the original speech signal energy at most, it is in the non-dual-talk state, and the output of the DTD algorithm is 0, otherwise, it is in the dual-talk state, and the output of the DTD algorithm is 1.

[0089] Figure 1In the illustrated echo signal cancellation application example, the DTD algorithm uses the above formulas (1) and (2) to detect whether it is in the double-talk state; and based on whether it is currently in the double-talk state, sets the step size of the PBFDAF, so as to not only maintain the fast convergence of the echo path of the PBFDAF in the single-talk state, but also avoid the problem of filter divergence caused by too large a step size of the PBFDAF in the double-talk scenario.

[0090] Figure 1 In it, the proximal sound signal d(n) collected by the microphone includes the echo signal y(n), the valid sound signal v(n), and the noise s(n). The PBFDAF performs echo estimation on the downlink distal sound signal X(n) based on the filter weight W(n) to obtain the echo estimation signal y'(n). The proximal sound signal d(n) and the echo estimation signal y'(n) are input into the adder. The adder eliminates the echo signal in the proximal sound signal d(n) based on the input proximal sound signal d(n) and the echo estimation signal y'(n), and then outputs the linearly filtered error signal e(n). The NLP (Non Linear Processing) filter eliminates the non-linear noise signal in the error signal e(n) to obtain the uplink proximal sound signal Y(n), and outputs the proximal sound signal Y(n) to the distal end. The adder is Figure 1 the circled plus sign in.

[0091] Figure 1 The illustrated echo signal cancellation application example performs well in the non-double-talk state, but has serious filter divergence in the double-talk state and poor performance in echo signal cancellation, and it is very easy to have problems such as incomplete echo signal cancellation and serious voice clipping. To solve this problem, in the related technology, a dual-filter + DTD algorithm is used to cancel the echo signal in the proximal sound signal. For the echo signal cancellation application example using the dual-filter + DTD algorithm, see Figure 2 as shown, relative to Figure 1 the illustrated echo signal cancellation application example, Figure 2 a Kalman filter is added to the illustrated echo signal cancellation application example.

[0092] In Figure 2In the illustrated application example of echo signal cancellation, the DTD algorithm uses the above formulas (1) and (2) to detect whether it is in the double-talk state; when it is detected that it is not in the double-talk state, the PBFDAF is used to quickly converge the echo path to accurately cancel the echo signal in the proximal sound signal; when it is detected that it is in the double-talk state, the adaptive coefficient of the PBFDAF (which can also be called the control observation coefficient) is adopted, and this adaptive coefficient is assigned to the Kalman filter to converge the gain factor of the Kalman filter, so as to use the Kalman filter to cancel the echo signal in the proximal sound signal based on the filtering weight W(n), and at the same time perform fast filtering following, that is, continuously update the adaptive coefficient of the PBFDAF.

[0093] Figure 2 In the illustrated application example of echo signal cancellation, when it is in the double-talk state, the adaptive coefficient of the PBFDAF is copied to the Kalman filter, so that the Kalman filter uses the adaptive coefficient of the PBFDAF to cancel the linear echo signal in the proximal sound signal. However, when it is in the double-talk state, the convergence effect of the echo path of the PBFDAF is poor, and the PBFDAF cannot accurately cancel the echo signal. Copying the adaptive coefficient of the PBFDAF in this state to the Kalman filter will cause the Kalman filter to be unable to accurately cancel the echo signal, and there may be situations where the echo signal is not completely canceled and the voice is severely clipped, resulting in poor quality of the sound signal transmitted to the remote device.

[0094] To solve the problem of poor quality of the sound signal transmitted to the remote device, the embodiment of the present application provides an echo cancellation method, which can be applied to any electronic device with a speaker and a microphone. The electronic device can be a mobile phone, a tablet computer, a PC (Personal Computer), a wearable electronic device, an electronic watch, etc. For the sake of easy understanding, the following will be explained with the electronic device as the execution subject, which is not restrictive. The technical solution provided by the embodiment of the present application can be applied to scenarios such as calls, conferences, and live connection with microphones.

[0095] In the technical solution provided by the embodiments of the present application, when in the non-dual-talk state, the electronic device compares the residual echo energies brought by the adaptive filter and the auxiliary filter, and uses the filter with the smaller residual echo energy to eliminate the echo signal. For example, in the embodiments of the present application, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, the auxiliary filter is used to eliminate the echo signal in the proximal sound signal. Compared with the related art, in the dual-talk state, when the residual echo energy brought by the adaptive filter is very large, the auxiliary filter is only used to eliminate the echo signal in the proximal sound signal. The technical solution provided by the embodiments of the present application can complete the filter switching at an appropriate time, that is, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, so that the technical solution provided by the embodiments of the present application always uses the filter with better echo cancellation effect to eliminate the echo, solves the problem of poor quality of the sound signal transmitted to the remote device, and improves the quality of the sound signal transmitted to the remote device.

[0096] The following uses specific embodiments to elaborate in detail on the echo cancellation method provided by the embodiments of the present application.

[0097] As Figure 3 shown, the embodiments of the present application provide an echo cancellation method, and the method includes the following steps:

[0098] Step S31: Use the adaptive filter and the auxiliary filter to respectively estimate the echo of the remote sound signal to obtain a first echo estimation signal and a second echo estimation signal.

[0099] Step S32: When in the non-dual-talk state, respectively determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal.

[0100] Step S33: When the first residual echo energy is greater than the second residual echo energy, use the auxiliary filter to eliminate the echo signal in the proximal sound signal.

[0101] In the technical solution provided by the embodiment of the present application, when in the non-dual-talk state, the residual echo energies brought by the adaptive filter and the auxiliary filter are compared, and the filter with the smaller residual echo energy is used to eliminate the echo signal. For example, in the embodiment of the present application, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, the auxiliary filter is used to eliminate the echo signal in the proximal sound signal. Compared with the related art, in the dual-talk state, when the residual echo energy brought by the adaptive filter is very large, the auxiliary filter is only used to eliminate the echo signal in the proximal sound signal. The technical solution provided by the embodiment of the present application can complete the filter switching at an appropriate time, that is, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, so that the technical solution provided by the embodiment of the present application always uses the filter with better echo cancellation effect to eliminate the echo, solves the problem of poor quality of the sound signal transmitted to the remote device, and improves the quality of the sound signal transmitted to the remote device.

[0102] In step S31 above, the electronic device uses the adaptive filter to estimate the echo of the remote sound signal to obtain a first echo estimation signal, and uses the auxiliary filter to estimate the echo of the remote sound signal to obtain a second echo estimation signal.

[0103] In the embodiment of the present application, when using the auxiliary filter to estimate the echo of the remote sound signal to obtain a second echo estimation signal, the adaptive coefficient adopted by the auxiliary filter can be the adaptive coefficient of the current adaptive filter. For example, the adaptive filter uses the adaptive coefficient θ1 to estimate the echo to obtain a first echo estimation signal, then the auxiliary filter reuses the adaptive coefficient θ1 to estimate the echo to obtain a second echo estimation signal.

[0104] In the embodiment of the present application, when using the auxiliary filter to estimate the echo of the remote sound signal to obtain a second echo estimation signal, the adaptive coefficient adopted by the auxiliary filter can also be the optimal adaptive coefficient stored in advance, which is not limited herein. The optimal adaptive coefficient is the adaptive coefficient that minimizes the residual echo energy when the auxiliary filter eliminates the echo signal. The storage and update of the optimal adaptive coefficient will be described in detail later and will not be elaborated here.

[0105] In step S32 above, the electronic device uses a double-talk detection algorithm to detect whether it is in the dual-talk state. The double-talk detection algorithm can be implemented using the above formula (1), that is, based on the near-end and far-end energies to determine whether it is in the dual-talk state.

[0106] In the embodiment of the present application, the double-talk detection algorithm can also determine whether it is in the dual-talk state according to the cross-correlation between the remote sound signal and the proximal sound signal. This double-talk detection algorithm will be described in detail later and will not be elaborated here.

[0107] When it is detected that the device is in the non-dual-talking state, the electronic device determines the residual echo energy brought by the first echo estimation signal in the proximal sound signal, that is, the first residual echo energy, and determines the residual echo energy brought by the second echo estimation signal in the proximal sound signal, that is, the second residual echo energy. Herein, the residual echo energy represents the echo signal energy remaining in the proximal sound signal after the echo estimation signal is eliminated. The more the residual echo energy is, the greater the echo path estimation error is, and the worse the echo signal cancellation effect is; correspondingly, the less the residual echo energy is, the smaller the echo path estimation error is, and the better the echo signal cancellation effect is.

[0108] After the electronic device obtains the first residual echo energy and the second residual echo energy, it compares the first residual echo energy and the second residual echo energy. When the first residual echo energy is greater than the second residual echo energy, it indicates that using the auxiliary filter for echo path estimation is more accurate and the echo signal cancellation effect is better. The electronic device executes step S33 to cancel the echo signal in the proximal sound signal using the auxiliary filter.

[0109] In step S33, when the electronic device cancels the echo signal in the proximal sound signal using the auxiliary filter, the adaptive coefficient adopted by the auxiliary filter can be the adaptive coefficient of the current adaptive filter. For example, if the adaptive filter uses the adaptive coefficient θ1 for echo estimation to obtain the first echo estimation signal, then the auxiliary filter reuses the adaptive coefficient θ1 for echo estimation to cancel the echo signal in the proximal sound signal.

[0110] In the embodiment of the present application, when the electronic device cancels the echo signal in the proximal sound signal using the auxiliary filter, the adaptive coefficient adopted by the auxiliary filter can also be the optimal adaptive coefficient stored in advance, which is not limited herein.

[0111] In some embodiments, as Figure 4 shown, an echo cancellation method is further provided, which may include the following steps:

[0112] Step S41: Use the adaptive filter and the auxiliary filter to perform echo estimation on the distal sound signal respectively to obtain the first echo estimation signal and the second echo estimation signal.

[0113] Step S42: When in the non-dual-talking state, determine the first residual echo energy and the second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the proximal sound signal respectively.

[0114] Step S43: When the first residual echo energy is greater than the second residual echo energy, use the auxiliary filter to cancel the echo signal in the proximal sound signal.

[0115] The above steps S41 - S43 are the same as the above steps S31 - S33.

[0116] Step S44: When the first residual echo energy is less than or equal to the second residual echo energy, an adaptive filter is used to eliminate the echo signal in the proximal sound signal.

[0117] In the embodiment of the present application, when the first residual echo energy is less than or equal to the second residual echo energy, it indicates that using the adaptive filter for echo path estimation is more accurate and the echo signal cancellation effect is better. The electronic device executes step S44 and uses the adaptive filter to eliminate the echo signal in the proximal sound signal.

[0118] In the technical solution provided by the embodiment of the present application, the electronic device determines a filter suitable for echo signal cancellation based on the energy comparison of the proximal and distal sound signals, and can achieve timely filter switching, enabling the electronic device to always use a filter with a better echo signal cancellation effect to eliminate the echo signal, further improving the quality of the sound signal transmitted to the distal device.

[0119] In some embodiments, to solve the problem of poor echo signal cancellation effect caused by frequent filter switching, when the first residual echo energy is greater than the second residual echo energy, the electronic device can detect whether the holding duration of the first residual echo energy being greater than the second residual echo energy is greater than a preset duration; when it is greater than the preset duration, an auxiliary filter is used to eliminate the echo signal in the proximal sound signal; otherwise, an adaptive filter is used to eliminate the echo signal in the proximal sound signal, that is, filter switching is rejected.

[0120] When the first residual echo energy is less than or equal to the second residual echo energy, the electronic device can detect whether the holding duration of the first residual echo energy being less than or equal to the second residual echo energy is greater than a preset duration; when it is greater than the preset duration, an adaptive filter is used to eliminate the echo signal in the proximal sound signal; otherwise, an auxiliary filter is used to eliminate the echo signal in the proximal sound signal, that is, filter switching is rejected.

[0121] In some embodiments, to solve the problem of poor echo signal cancellation effect caused by frequent filter switching, the electronic device can use the distal sound signal to update the adaptive coefficient of the adaptive filter.

[0122] When the first residual echo energy is greater than the second residual echo energy, the electronic device assigns the pre - stored optimal adaptive coefficient to the auxiliary filter, and the auxiliary filter uses the optimal adaptive coefficient to eliminate the echo signal in the proximal sound signal.

[0123] When the first residual echo energy is less than or equal to the second residual echo energy, the electronic device assigns the adaptive coefficients of the current adaptive filter to the auxiliary filter, and the auxiliary filter uses the adaptive coefficients of the current adaptive filter to eliminate the echo signal in the proximal sound signal.

[0124] In some embodiments, as Figure 5 shown, an echo cancellation method is also provided, which may include the following steps:

[0125] Step S51: Using an adaptive filter and an auxiliary filter, respectively perform echo estimation on the distal sound signal to obtain a first echo estimation signal and a second echo estimation signal.

[0126] Step S52: When in the non-dual talk state, respectively determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal.

[0127] Step S53: When the first residual echo energy is greater than the second residual echo energy, use the auxiliary filter to eliminate the echo signal in the proximal sound signal.

[0128] The above steps S51 - S53 are the same as the above steps S31 - S33.

[0129] Step S54: When in the dual talk state, use the auxiliary filter to eliminate the echo signal in the proximal sound signal.

[0130] In the embodiments of the present application, when the electronic device detects that it is in the dual talk state, the electronic device can directly use the auxiliary filter to eliminate the echo signal in the proximal sound signal.

[0131] When in the dual talk state, the adaptive coefficients used by the auxiliary filter can remain unchanged because in the dual talk state, the echo path convergence effect of the adaptive filter is poor, and it is necessary to use the auxiliary filter to eliminate the echo signal. That is, as described in the above step S33, before switching from the non-dual talk state to the dual talk state, the residual echo energy brought by the auxiliary filter is already less than the residual echo energy brought by the adaptive filter, and the electronic device has copied the adaptive coefficients or the optimal adaptive coefficients of the adaptive filter to the auxiliary filter, and the auxiliary filter eliminates the echo signal in the proximal sound signal. Therefore, after switching from the non-dual talk state to the dual talk state, the adaptive coefficients used by the auxiliary filter can remain unchanged.

[0132] For example, at time t1, when in the non-dual talk state, the second residual echo energy brought by the auxiliary filter is less than the first residual echo energy brought by the adaptive filter. At this time, the adaptive coefficient of the adaptive filter is θ1, and the electronic device copies θ1 to the auxiliary filter. The auxiliary filter uses θ1 to eliminate the echo signal in the proximal sound signal. When reaching time t2, it switches from the non-dual talk state to the dual talk state. At this time, the electronic device can keep the adaptive coefficient adopted by the auxiliary filter unchanged, that is, the auxiliary filter uses θ1 to eliminate the echo signal in the proximal sound signal.

[0133] When in the dual talk state, the adaptive coefficient adopted by the auxiliary filter can also be adjusted to the optimal adaptive coefficient stored in advance, that is, the electronic device copies the optimal adaptive coefficient to the auxiliary filter to improve the accuracy of eliminating the echo signal.

[0134] In the technical solution provided by the embodiments of the present application, when in the dual talk state, the electronic device no longer compares the residual echo energy, and directly uses the auxiliary filter that is not affected by the echo signal to eliminate the echo signal, which simplifies the echo signal elimination operation in the dual talk state and improves the echo signal elimination efficiency.

[0135] In some embodiments, the embodiments of the present application also provide a two-end detection method, as Figure 6 shown, which may include the following steps:

[0136] Step S61, respectively determine a first cross-correlation value and a second cross-correlation value between the first echo estimation signal and the second echo estimation signal and the proximal sound signal;

[0137] Step S62, when the target cross-correlation value is greater than or equal to the preset correlation threshold, determine that it is in the non-dual talk state, and the target cross-correlation value is the first cross-correlation value, the second cross-correlation value, or the cross-correlation value determined according to the first cross-correlation value and the second cross-correlation value;

[0138] Step S63, when the target cross-correlation value is less than the preset correlation threshold, determine that it is in the dual talk state.

[0139] In the technical solution provided by the embodiments of the present application, the electronic device determines whether it is in the dual talk state according to the cross-correlation between the distal sound signal and the proximal sound signal, that is, determines whether the distal sound signal and the proximal sound signal are homologous data; subsequently, the electronic device then determines the filter to be used based on the residual echo energy. Compared with only considering the energy to complete the elimination of the echo signal, as described above Figure 1 and Figure 2In the illustrated example of echo signal cancellation, in the embodiments of the present application, the electronic device completes the cancellation of the echo signal from two dimensions: the cross-correlation and the energy between the remote sound signal and the proximal sound signal, improving the accuracy of echo signal cancellation, further improving the quality of the sound signal transmitted to the remote device, and enhancing the echo cancellation effect in complex scenarios.

[0140] In step S61 above, the electronic device determines a first cross-correlation value between the first echo estimation signal and the proximal sound signal, and determines a second cross-correlation value between the second echo estimation signal and the proximal sound signal.

[0141] In the embodiments of the present application, the electronic device can use the following formula (3) to determine the cross-correlation value.

[0142]

[0143] In formula (3), ξ1 represents the cross-correlation value between the proximal sound signal and the echo estimation signal, reflecting the cross-correlation between the proximal sound signal and the remote sound signal, d(n) is the proximal sound signal sampled by the microphone, y'(n) is the echo estimation signal obtained by performing echo estimation on the remote sound signal, e d is the variance iteration value of d(n), e y' is the variance iteration value of y'(n), and E represents weighted averaging.

[0144] In the embodiments of the present application, the electronic device determines the target cross-correlation value using the first cross-correlation value and the second cross-correlation value. In some embodiments, the electronic device can determine the target cross-correlation value in any of the following ways:

[0145] Method 1: Detect the filter used to cancel the echo signal in the proximal sound signal currently; if the adaptive filter is currently used to cancel the echo signal in the proximal sound signal, determine the first cross-correlation value as the target cross-correlation value; if the auxiliary filter is currently used to cancel the echo signal in the proximal sound signal, determine the second cross-correlation value as the target cross-correlation value.

[0146] Method 2: Calculate the mean of the first cross-correlation value and the second cross-correlation value to obtain the target cross-correlation value.

[0147] In the embodiments of the present application, the electronic device can also use other methods to determine the target cross-correlation value. For example, directly calculate the cross-correlation value between the remote sound signal and the proximal sound signal as the target cross-correlation value, which is not limited herein.

[0148] In addition, a relevant threshold, that is, a preset relevant threshold, is preset in the electronic device. The size of the preset relevant threshold can be set according to actual needs. For example, the preset relevant threshold can be 0.4, 0.5, or 0.6, etc.

[0149] After determining the target cross-correlation value, the electronic device compares the target cross-correlation value with a preset correlation threshold to obtain the output of the DTD algorithm, as shown in formula (4):

[0150]

[0151] In formula (4), T1 is the preset correlation threshold. When ξ1 is greater than or equal to T1, it indicates that the main component in the near-end voice signal is the far-end voice signal, and the current is in the non-dual-talk state. Step S62 is executed to determine that it is in the non-dual-talk state, and the output of DTD1 is 0. When ξ1 is less than T1, it indicates that there is a deviation in the echo path estimation, or the proportion of the echo signal in the composition of the near-end voice signal is small, and the proportion of the environment and the sound source in the near-end voice signal in the composition of the near-end voice signal is large. The current is in the strict dual-talk state, and step S63 is executed, and the output of DTD1 is 1.

[0152] When in the non-dual-talk state, using an adaptive filter to cancel the echo signal is likely to cause divergence or overcorrection. In the embodiments of the present application, the electronic device executes the above steps S32-S33, and further determines the filter for canceling the echo signal based on the residual echo energy, improving the accuracy of echo signal cancellation and further improving the quality of the voice signal transmitted to the far-end device.

[0153] In some embodiments, as Figure 7 shown, in the above steps S32 and S42, the steps of respectively determining the first residual echo energy and the second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal may include the following steps:

[0154] Step S71, respectively determine the first error signal and the second error signal after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal.

[0155] In the embodiments of the present application, the electronic device determines the error signal after canceling the first echo estimation signal in the near-end voice signal to obtain the first error signal, and determines the error signal after canceling the second echo estimation signal in the near-end voice signal to obtain the second error signal. The first error signal and the second error signal are error signals after linear filtering. The first error signal is the error signal actually output after linear filtering, and the second error signal is the estimated error signal after linear filtering; or the first error signal is the estimated error signal after linear filtering, and the second error signal is the error signal actually output after linear filtering.

[0156] Step S72: Based on the proximal sound signal, the first error signal, and the second error signal, determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal.

[0157] After obtaining the first error signal and the second error signal, the electronic device determines the residual echo energy after eliminating the first echo estimation signal in the proximal sound signal based on the proximal sound signal and the first error signal, to obtain the first residual echo energy, and determines the residual echo energy after eliminating the second echo estimation signal in the proximal sound signal based on the proximal sound signal and the second error signal, to obtain the second residual echo energy.

[0158] In some embodiments, the electronic device may determine a first residual ratio for adaptively filtering to eliminate the echo signal in the proximal sound signal and a second residual ratio for auxiliary filtering to eliminate the echo signal in the proximal sound signal according to the ratio of the proximal sound signal to the first error signal and the ratio of the proximal sound signal to the second error signal. Among them, the reciprocal of the first residual ratio represents the first residual echo energy after eliminating the first echo estimation signal in the proximal sound signal, and the reciprocal of the second residual ratio represents the second residual echo energy after eliminating the second echo estimation signal in the proximal sound signal.

[0159] For example, the electronic device may use formula (5) to determine the residual ratio:

[0160]

[0161] In formula (5), ξ2 represents the residual ratio, e(n) is the error signal, and d(n) is the proximal sound signal. When e(n) is the first error signal, ξ2 represents the first residual ratio; when e(n) is the second error signal, ξ2 represents the second residual ratio, and E represents weighted averaging. Among them, the larger ξ2 is, the less residual echo energy is included in e(n). Based on this, when the electronic device uses formula (5) to determine the first residual ratio and the second residual ratio, the reciprocal of the first residual ratio can be used to represent the first residual echo energy after eliminating the first echo estimation signal in the proximal sound signal, and the reciprocal of the second residual ratio can be used to represent the second residual echo energy after eliminating the second echo estimation signal in the proximal sound signal.

[0162] In the technical solution provided by the embodiments of the present application, the electronic device can use the proximal sound signal and the error signal to determine the residual ratio, that is, the ratio of the proximal power to the error power, quickly and accurately determine the residual echo energy, and then accurately eliminate the echo signal.

[0163] In the embodiments of the present application, in order to save the computing resources of the electronic device, the electronic device may execute the above steps S71 - S72 to determine the filter required to eliminate the echo signal only when it is in the non-dual talk state; when it is in the dual talk state, the above steps S71 - S72 are no longer executed.

[0164] In the embodiments of the present application, the electronic device may also use other methods to determine the residual echo energy. For example, by using the far-end voice signal, the voice signal similar to the far-end voice signal in the error signal is determined as the residual echo signal, and the residual echo signal is the residual echo energy, which is not limited herein.

[0165] In some embodiments, in order to improve the accuracy of echo signal cancellation and further solve the problems of incomplete echo signal cancellation and serious voice clipping, the embodiments of the present application also provide an update method for the optimal adaptive coefficient, where the optimal adaptive coefficient is the adaptive coefficient used by the auxiliary filter to cancel the echo signal in the proximal voice signal. The above update method for the optimal adaptive coefficient can be referred to as Figure 8 As shown, it may include the following steps:

[0166] Step S81: Obtain the current adaptive coefficient used by the current adaptive filter to cancel the echo signal in the proximal voice signal.

[0167] Step S82: Respectively determine the third residual echo energy and the fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to cancel the echo signal in the proximal voice signal.

[0168] Step S83: If the third residual echo energy is greater than the fourth residual echo energy, update the optimal adaptive coefficient to the current adaptive coefficient;

[0169] Step S84: If the third residual echo energy is less than or equal to the fourth residual echo energy, keep the optimal adaptive coefficient.

[0170] In the technical solution provided by the embodiments of the present application, the electronic device compares the residual echo energy brought by the auxiliary filter using the optimal adaptive coefficient and the current adaptive coefficient, selects the adaptive coefficient corresponding to the smaller residual echo energy, and stores the adaptive coefficient as the optimal adaptive coefficient. Subsequently, when it is necessary to use the auxiliary filter to cancel the echo signal, the electronic device may copy the optimal adaptive coefficient to the auxiliary filter, and use the optimal adaptive coefficient with smaller residual echo energy to cancel the echo signal in the proximal voice signal, improve the accuracy of echo signal cancellation, and further solve the problems of incomplete echo signal cancellation and serious voice clipping.

[0171] In the above step S81, the adaptive filter can be the filter used by the current electronic device to eliminate the echo signal, or it can be a filter other than the one used by the current electronic device to eliminate the echo signal. Whether the current electronic device uses an adaptive filter to eliminate the echo signal or not, the adaptive filter will perform adaptive coefficient update. The electronic device obtains the current adaptive coefficient used by the current adaptive filter to eliminate the echo signal in the proximal sound signal.

[0172] In the above step S82, the electronic device determines the residual echo energy when the auxiliary filter uses the optimal adaptive coefficient to eliminate the echo signal in the proximal sound signal, that is, the third residual echo energy, and determines the residual echo energy when the auxiliary filter uses the current adaptive coefficient to eliminate the echo signal in the proximal sound signal, that is, the fourth residual echo energy.

[0173] The electronic device compares the third residual echo energy and the fourth residual echo energy. If the third residual echo energy is greater than the fourth residual echo energy, it means that the residual echo energy brought by the current adaptive coefficient is less. The electronic device updates the optimal adaptive coefficient, that is, executes step S83, and updates the optimal adaptive coefficient to the current adaptive coefficient, so that the electronic device can copy the adaptive coefficient that makes the residual echo energy smaller to the auxiliary filter, reducing the residual echo energy in the proximal sound signal after echo signal cancellation.

[0174] If the third residual echo energy is less than or equal to the fourth residual echo energy, it means that the residual echo energy brought by the optimal adaptive coefficient is less. The electronic device executes step S84 and keeps the optimal adaptive coefficient, so that the electronic device can copy the adaptive coefficient that makes the residual echo energy smaller to the auxiliary filter, reducing the residual echo energy in the proximal sound signal after echo signal cancellation.

[0175] For example, the optimal adaptive coefficient θ0 is stored in the electronic device. At time t1, in the electronic device, the adaptive filter uses the adaptive coefficient θ1 for echo estimation to eliminate the echo signal in the proximal sound signal; the electronic device determines the residual echo energy Q0 when the auxiliary filter uses θ0 to eliminate the echo signal in the proximal sound signal, and determines the residual echo energy Q1 when the auxiliary filter uses θ1 to eliminate the echo signal in the proximal sound signal; if Q1>Q0, the electronic device updates the stored optimal adaptive coefficient to θ1; if Q1≤Q0, the electronic device keeps the optimal adaptive coefficient as θ0.

[0176] At time t2, in the electronic device, the adaptive coefficient θ1 adopted by the adaptive filter is updated to θ2, that is, the adaptive filter uses the adaptive coefficient θ2 for echo estimation to eliminate the echo signal in the proximal sound signal. It is assumed that at time t1, the electronic device maintains the optimal adaptive coefficient as θ0. The electronic device determines the residual echo energy Q0 when the auxiliary filter uses θ0 to eliminate the echo signal in the proximal sound signal, and determines the residual echo energy Q2 when the auxiliary filter uses θ2 to eliminate the echo signal in the proximal sound signal; if Q2 > Q0, the electronic device updates the stored optimal adaptive coefficient to θ2; if Q2 ≤ Q0, the electronic device maintains the optimal adaptive coefficient as θ0.

[0177] In the technical solution provided by the embodiment of the present application, the electronic device continuously updates the optimal adaptive coefficient, improves the accuracy of echo signal cancellation, and further solves the problems of incomplete echo signal cancellation and serious voice clipping.

[0178] Corresponding to the above echo cancellation method, the embodiment of the present application also provides an echo cancellation device, as Figure 9 shown, including:

[0179] An estimation unit 91, configured to use an adaptive filter and an auxiliary filter to perform echo estimation on the far-end sound signal respectively, and obtain a first echo estimation signal and a second echo estimation signal;

[0180] A first determination unit 92, configured to determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal respectively when in a non-dual-talk state;

[0181] A first cancellation unit 93, configured to use the auxiliary filter to cancel the echo signal in the proximal sound signal when the first residual echo energy is greater than the second residual echo energy.

[0182] In some embodiments, as Figure 10 shown, the above echo cancellation device may further include:

[0183] A second cancellation unit 94, configured to use the adaptive filter to cancel the echo signal in the proximal sound signal when the first residual echo energy is less than or equal to the second residual echo energy.

[0184] In some embodiments, as Figure 11 shown, the above echo cancellation device may further include:

[0185] A third cancellation unit 95, configured to use the auxiliary filter to cancel the echo signal in the proximal sound signal when in a dual-talk state.

[0186] In some embodiments, the above echo cancellation device may further include:

[0187] A second determination unit, configured to respectively determine a first cross-correlation value and a second cross-correlation value between the first echo estimation signal and the second echo estimation signal and the near-end voice signal;

[0188] A third determination unit, configured to determine that it is in a non-dual-talk state when the target cross-correlation value is greater than or equal to a preset correlation threshold, where the target cross-correlation value is the first cross-correlation value, the second cross-correlation value, or a cross-correlation value determined according to the first cross-correlation value and the second cross-correlation value;

[0189] A fourth determination unit, configured to determine that it is in a dual-talk state when the target cross-correlation value is less than the preset correlation threshold.

[0190] In some embodiments, the above echo cancellation device may further include a fifth determination unit, configured to determine the target cross-correlation value;

[0191] The fifth determination unit may specifically be configured to detect a filter used to cancel the echo signal in the current near-end voice signal; if an adaptive filter is currently used to cancel the echo signal in the near-end voice signal, determine the first cross-correlation value as the target cross-correlation value; if an auxiliary filter is currently used to cancel the echo signal in the near-end voice signal, determine the second cross-correlation value as the target cross-correlation value; or

[0192] Specifically configured to calculate the mean value of the first cross-correlation value and the second cross-correlation value to obtain the target cross-correlation value.

[0193] In some embodiments, the first determination unit 92 may include:

[0194] A first determination subunit, configured to respectively determine a first error signal and a second error signal after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal;

[0195] A second determination subunit, configured to determine a first residual echo energy and a second residual echo energy after canceling the first echo estimation signal and the second echo estimation signal in the near-end voice signal based on the near-end voice signal, the first error signal, and the second error signal.

[0196] In some embodiments, the second determination subunit may specifically be configured to:

[0197] According to the ratio of the near-end voice signal to the first error signal and the ratio of the near-end voice signal to the second error signal, determine a first residual ratio for adaptively filtering to cancel the echo signal in the near-end voice signal and a second residual ratio for auxiliary filtering to cancel the echo signal in the near-end voice signal;

[0198] Among them, the reciprocal of the first residual ratio represents the first residual echo energy after eliminating the first echo estimation signal in the proximal sound signal, and the reciprocal of the second residual ratio represents the second residual echo energy after eliminating the second echo estimation signal in the proximal sound signal.

[0199] In some embodiments, the above echo cancellation device may further include: an updating unit configured to update the optimal adaptive coefficient used by the auxiliary filter to cancel the echo signal in the proximal sound signal;

[0200] As Figure 12 shown, the updating unit may include:

[0201] An obtaining subunit 121 configured to obtain the current adaptive coefficient used by the current adaptive filter to cancel the echo signal in the proximal sound signal;

[0202] A third determining subunit 122 configured to respectively determine the third residual echo energy and the fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to cancel the echo signal in the proximal sound signal;

[0203] An updating subunit 123 configured to update the optimal adaptive coefficient to the current adaptive coefficient if the third residual echo energy is greater than the fourth residual echo energy;

[0204] A holding subunit 124 configured to hold the optimal adaptive coefficient if the third residual echo energy is less than or equal to the fourth residual echo energy.

[0205] In the technical solution provided by the embodiments of the present application, when in the non-dual-talking state, the residual echo energies brought by the adaptive filter and the auxiliary filter are compared, and the filter with the smaller residual echo energy is used to cancel the echo signal. For example, in the embodiments of the present application, if the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, the auxiliary filter is used to cancel the echo signal in the proximal sound signal. Compared with the related art, in the dual-talking state, when the residual echo energy brought by the adaptive filter is very large, the auxiliary filter is only used to cancel the echo signal in the proximal sound signal. The technical solution provided by the embodiments of the present application can complete the filter switching at an appropriate time, that is, when the residual echo energy brought by the adaptive filter is greater than the residual echo energy brought by the auxiliary filter, so that the technical solution provided by the embodiments of the present application always uses the filter with better echo cancellation effect to cancel the echo, solves the problem of poor quality of the sound signal transmitted to the remote device, and improves the quality of the sound signal transmitted to the remote device.

[0206] Corresponding to the above echo cancellation method, the embodiments of the present application further provide an electronic device, such as Figure 13As shown, it includes a processor 131, a communication interface 132, a memory 133, and a communication bus 134. Among them, the processor 131, the communication interface 132, and the memory 133 complete mutual communication through the communication bus 134;

[0207] The memory 133 is used to store computer programs;

[0208] When the processor 131 is used to execute the program stored on the memory 133, the above Figures 3 - 8 any one of the echo cancellation method steps is implemented.

[0209] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0210] The communication interface is used for communication between the above electronic device and other devices.

[0211] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0212] The processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0213] In another embodiment provided by the present application, a computer-readable storage medium is also provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above Figures 3 - 8Any of the above-described echo cancellation method steps.

[0214] In another embodiment provided by the present application, there is also provided a computer program product including instructions, which when running on a computer, causes the computer to execute any of the above Figures 3 - 8 echo cancellation method steps.

[0215] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).

[0216] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article, or device including the element.

[0217] Each embodiment in this specification is described in a related manner. For the identical or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, electronic device, storage medium, and computer program product, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the corresponding parts of the method embodiments for the relevant content.

[0218] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. An echo cancellation method, characterized in that, The method includes: Using an adaptive filter and an auxiliary filter to respectively perform echo estimation on a far - end voice signal to obtain a first echo estimation signal and a second echo estimation signal; When in a non - talk - through state, respectively determining a first residual echo energy and a second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the near - end voice signal; When the first residual echo energy is greater than the second residual echo energy, using the auxiliary filter to eliminate the echo signal in the near - end voice signal; The optimal adaptive coefficient used by the auxiliary filter to eliminate the echo signal in the near - end voice signal is updated through the following steps: Obtaining the current adaptive coefficient used by the adaptive filter to eliminate the echo signal in the near - end voice signal; Respectively determining a third residual echo energy and a fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to eliminate the echo signal in the near - end voice signal; If the third residual echo energy is greater than the fourth residual echo energy, updating the optimal adaptive coefficient to the current adaptive coefficient; If the third residual echo energy is less than or equal to the fourth residual echo energy, keeping the optimal adaptive coefficient.

2. The method according to claim 1, wherein The method further includes: When the first residual echo energy is less than or equal to the second residual echo energy, using the adaptive filter to eliminate the echo signal in the near - end voice signal.

3. The method according to claim 1, wherein The method further includes: When in a talk - through state, using the auxiliary filter to eliminate the echo signal in the near - end voice signal.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Respectively determining a first cross - correlation value and a second cross - correlation value between the first echo estimation signal and the second echo estimation signal and the near - end voice signal; When the target cross - correlation value is greater than or equal to a preset correlation threshold, determining that it is in a non - talk - through state, where the target cross - correlation value is the first cross - correlation value, the second cross - correlation value, or a cross - correlation value determined according to the first cross - correlation value and the second cross - correlation value; When the target cross - correlation value is less than the preset correlation threshold, determining that it is in a talk - through state.

5. The method according to claim 4, wherein The target cross - correlation value is determined through the following steps: Detecting the filter currently used to eliminate the echo signal in the near - end voice signal; if the adaptive filter is currently used to eliminate the echo signal in the near - end voice signal, determining the first cross - correlation value as the target cross - correlation value; if the auxiliary filter is currently used to eliminate the echo signal in the near - end voice signal, determining the second cross - correlation value as the target cross - correlation value; Or Calculating the mean value of the first cross - correlation value and the second cross - correlation value to obtain the target cross - correlation value.

6. The method according to any one of claims 1-3, characterized in that, The step of respectively determining the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the near - end voice signal includes: Respectively determining a first error signal and a second error signal after eliminating the first echo estimation signal and the second echo estimation signal in the near - end voice signal; Based on the proximal sound signal, the first error signal, and the second error signal, determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal.

7. The method according to claim 6, wherein The step of determining the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal based on the proximal sound signal, the first error signal, and the second error signal includes: Determine a first residual ratio of the adaptive filter for eliminating the echo signal in the proximal sound signal and a second residual ratio of the auxiliary filter for eliminating the echo signal in the proximal sound signal according to the ratio of the proximal sound signal to the first error signal and the ratio of the proximal sound signal to the second error signal; Wherein, the reciprocal of the first residual ratio represents the first residual echo energy after eliminating the first echo estimation signal in the proximal sound signal, and the reciprocal of the second residual ratio represents the second residual echo energy after eliminating the second echo estimation signal in the proximal sound signal.

8. An echo cancellation device, characterized in that, The apparatus includes: An estimation unit, configured to respectively perform echo estimation on the distal sound signal by using an adaptive filter and an auxiliary filter to obtain a first echo estimation signal and a second echo estimation signal; A first determination unit, configured to respectively determine the first residual echo energy and the second residual echo energy after eliminating the first echo estimation signal and the second echo estimation signal in the proximal sound signal when in a non-dual-talking state; A first elimination unit, configured to, when the first residual echo energy is greater than the second residual echo energy, use the auxiliary filter to eliminate the echo signal in the proximal sound signal; The optimal adaptive coefficient used by the auxiliary filter to eliminate the echo signal in the proximal sound signal is updated through the following steps: Obtain the current adaptive coefficient used by the current adaptive filter to eliminate the echo signal in the proximal sound signal; Respectively determine a third residual echo energy and a fourth residual echo energy when the auxiliary filter uses the optimal adaptive coefficient and the current adaptive coefficient to eliminate the echo signal in the proximal sound signal; If the third residual echo energy is greater than the fourth residual echo energy, update the optimal adaptive coefficient to the current adaptive coefficient; If the third residual echo energy is less than or equal to the fourth residual echo energy, keep the optimal adaptive coefficient.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used for storing a computer program; When the processor is configured to execute the program stored on the memory, it implements the method steps described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, it implements the method steps described in any one of claims 1-7.

Citation Information

Patent Citations

  • Echo elimination system, echo elimination method, readable computer storage medium and terminal

    CN109961798A

  • Echo cancellation method, device and equipment , and readable storage medium

    CN113241085A