Echo cancellation method, echo cancellation device, electronic equipment and storage medium
By estimating and eliminating linear echoes in microphone signals in voice calls, and suppressing reverberation echoes through spectrum analysis and suppression parameter processing, the problem of echo affecting speech clarity is solved, achieving high-quality voice calls.
Patent Information
- Application Number
- CN202311101568.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2043-08-29
AI Technical Summary
In voice calls, the echo collected by the microphone will reduce the clarity of the voice and affect the quality of the call.
By estimating the linear echo components in the speaker output signal, the linear echo components in the microphone signal are eliminated, and the residual echo and reverb echo are further suppressed through spectrum analysis and suppression parameter processing.
Effectively eliminates linear echo and reverberation echo, improving the clarity and quality of voice calls and improving the call experience.
Smart Images

Figure CN119541518A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to an echo cancellation method, an echo cancellation device, an electronic device and a storage medium. Background Art
[0002] In daily voice calls, voice clarity is an important indicator. For a call device with a microphone and a speaker, while the microphone collects the voice of the user at the near end, the signal of the other end, that is, the far end, is also collected by the microphone after being played by the speaker, thus forming an echo. If the echo is not processed, after the signal collected by the microphone is transmitted to the far end, the far end user will hear his own echo, which reduces the voice clarity and affects the voice call quality. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides an echo cancellation method, an echo cancellation device, an electronic device and a storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an echo cancellation method, which is applied to a terminal having a speaker and a microphone, and the method includes:
[0005] estimating a linear echo component in a microphone signal collected by the microphone according to a speaker signal output by the speaker to obtain a linear echo signal;
[0006] Eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal;
[0007] estimating a residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determining a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal;
[0008] Estimate the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer;
[0009] determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal;
[0010] The linear echo cancellation signal is processed according to the first suppression parameter and the second suppression parameter, and an echo cancellation signal is output.
[0011] In some embodiments, estimating the linear echo component in the microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain the linear echo signal includes:
[0012] Detecting whether the speaker signal includes a speech component;
[0013] In response to detecting that the loudspeaker signal does not include a speech component, estimating a linear echo component in the microphone signal using a Kalman filter algorithm to obtain the linear echo signal;
[0014] In response to detecting that the loudspeaker signal includes a speech component, the Kalman coefficient is updated, and the linear echo component in the microphone signal is estimated using the Kalman filter algorithm to obtain the linear echo signal.
[0015] In some embodiments, estimating the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal comprises:
[0016] According to the spectrum of the microphone signal and the spectrum of the linear echo signal, a residual echo component in the linear echo cancellation signal is detected by using a spectrum subtraction method.
[0017] In some embodiments, before estimating the reverberation echo component in the linear echo cancellation signal to obtain the reverberation echo signal, the echo cancellation method further includes:
[0018] Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter;
[0019] The step of estimating the reverberation echo according to the linear echo signal of the first N frames to obtain the reverberation echo signal comprises:
[0020] In response to the value of the far-end single-talk flag being greater than or equal to a preset first threshold, determining an echo attenuation coefficient corresponding to each frame in the first N frames according to the linear echo cancellation signal and the linear echo signals of the first N frames;
[0021] Determine the reverberation attenuation coefficient corresponding to each frame in the first N frames according to the echo attenuation coefficient and the far-end single-talk flag;
[0022] The reverberation echo component in the linear echo cancellation signal is estimated according to the reverberation attenuation coefficient and the linear echo signal of the previous N frames to obtain the reverberation echo signal.
[0023] In some embodiments, determining the reverberation attenuation coefficient corresponding to each frame in the first N frames according to the echo attenuation coefficient and the far-end single-talk flag includes:
[0024] For each of the first N frames:
[0025] Determine a smoothing factor according to the far-end single-talk flag, the echo attenuation coefficient corresponding to the frame, and the initial reverberation attenuation coefficient corresponding to the frame;
[0026] The initial reverberation attenuation coefficient is smoothed according to the smoothing factor and the echo attenuation coefficient corresponding to the frame to obtain the reverberation attenuation coefficient corresponding to the frame.
[0027] In some embodiments, before determining the second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, the echo cancellation method further includes:
[0028] Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter;
[0029] In response to the value of the far-end single-talk flag being greater than or equal to a preset second threshold, estimating a nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal, and a nonlinear distortion signal corresponding to the loudspeaker signal to obtain a nonlinear echo signal, wherein the nonlinear distortion signal is obtained by full-wave rectification of the loudspeaker signal;
[0030] The determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal comprises:
[0031] The second suppression parameter is determined according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal.
[0032] In some embodiments, estimating the nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal, and the nonlinear distortion signal corresponding to the speaker signal to obtain the nonlinear echo signal includes:
[0033] Calculating a ratio of the amplitude of the linear echo cancellation signal to the amplitude of the nonlinear distortion signal, and transforming the ratio into a logarithmic domain to obtain a logarithmic domain ratio;
[0034] Determine a smoothing coefficient according to the far-end single-talk flag;
[0035] smoothing the logarithmic domain ratio according to the smoothing coefficient;
[0036] Transforming the smoothed logarithmic domain ratio to the amplitude domain to obtain an amplitude domain ratio;
[0037] The nonlinear echo signal is obtained according to the amplitude domain ratio and the nonlinear distortion signal.
[0038] In some embodiments, determining the second suppression parameter according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal comprises:
[0039] Calculating a posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal, the energy value of the reverberation echo signal and the energy value of the nonlinear echo signal;
[0040] Determine a priori signal-to-return ratio according to the posterior signal-to-return ratio;
[0041] smoothing the a priori signal-to-return ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the a posteriori signal-to-return ratio corresponding to the previous frame;
[0042] The second suppression parameter is determined according to the smoothed priori signal-to-echo ratio.
[0043] In some embodiments, before determining the second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, the echo cancellation method includes:
[0044] Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter;
[0045] Determine a smoothing coefficient according to the far-end single-talk flag;
[0046] The determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal comprises:
[0047] Calculating a posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal and the energy value of the reverberation echo signal;
[0048] Determine a priori signal-to-return ratio according to the posterior signal-to-return ratio;
[0049] smoothing the a priori signal-to-response ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the posterior signal-to-response ratio corresponding to the previous frame;
[0050] The second suppression parameter is determined according to the smoothed priori signal-to-echo ratio.
[0051] According to a second aspect of an embodiment of the present disclosure, there is provided an echo cancellation device, comprising:
[0052] A linear echo estimation module is configured to estimate the linear echo component in the microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain a linear echo signal;
[0053] A linear echo cancellation module, configured to eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal;
[0054] a linear residual echo suppression module, configured to estimate the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determine a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal;
[0055] a reverberation echo estimation module, estimating the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer;
[0056] an echo suppression module, configured to determine a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal;
[0057] The echo cancellation module is configured to process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output an echo cancellation signal.
[0058] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0059] Speakers, microphones, processors, and memory;
[0060] The speaker, the microphone and the memory are all communicatively connected to the processor;
[0061] The memory is used to store executable instructions;
[0062] The processor is configured to run the executable instructions to implement the steps of the echo cancellation method provided in any embodiment of the first aspect of the present disclosure.
[0063] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the echo cancellation method provided in any embodiment of the first aspect of the embodiment of the present disclosure are implemented.
[0064] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: estimating a linear echo component in a microphone signal collected by a microphone according to a speaker signal output by a speaker to obtain a linear echo signal; eliminating the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal; estimating a residual echo component in the linear echo cancellation signal according to a spectrum of the microphone signal and a spectrum of the linear echo signal, and determining a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal; estimating a reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer; determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal; processing the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and outputting an echo cancellation signal. Therefore, on the basis of linear echo cancellation, through the above-mentioned reverberation echo estimation method, fast and accurate reverberation echo estimation can be achieved while occupying fewer computing resources, thereby processing the call signal and improving the call effect.
[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0067] Figure 1 The figure is a flow chart of an echo cancellation method according to an exemplary embodiment.
[0068] Figure 2 The diagram is a schematic diagram of a call scenario according to an exemplary embodiment.
[0069] Figure 3 This is a flow chart of an implementation method of step S110 in the embodiment of the present disclosure.
[0070] Figure 4 This is a flow chart of an implementation method of step S130 in the embodiment of the present disclosure.
[0071] Figure 5 This is a flow chart of an implementation method of step S150 in the embodiment of the present disclosure.
[0072] Figure 6 This is a flow chart of an implementation method of step S152 in the embodiment of the present disclosure.
[0073] Figure 7This is a flow chart of an implementation method of step S160 in the embodiment of the present disclosure.
[0074] Figure 8 The flowchart of another echo cancellation method is shown according to an exemplary embodiment.
[0075] Fig. 9 This is a flow chart of an implementation method of step S241 in the embodiment of the present disclosure.
[0076] Fig.10 This is a flow chart of an implementation method of step S265 in the embodiment of the present disclosure.
[0077] Fig.11 is a flow chart of yet another echo cancellation method according to an exemplary embodiment.
[0078] Fig.12 The figure is a block diagram of an echo cancellation device according to an exemplary embodiment.
[0079] Fig.13 is a block diagram of an electronic device 800 according to an exemplary embodiment. DETAILED DESCRIPTION
[0080] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0081] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.
[0082] Figure 1 FIG. 1 is a flow chart of an echo cancellation method according to an exemplary embodiment. Figure 1 As shown, the method can be applied to a terminal equipped with a speaker and a microphone, and the method includes the following steps.
[0083] Step S110: Estimate the linear echo component in the input microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain a linear echo signal.
[0084] Among them, the speaker signal output by the speaker is a far-end signal, which can also be called a speaker reference (Reference, REF) signal, which can be played through the speaker; the microphone signal is a near-end signal, which can be a signal collected by the microphone.
[0085] The linear echo component in the microphone signal is estimated according to the far-end signal to obtain a linear echo signal.
[0086] Step S120: Eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal.
[0087] In some embodiments, the following formula
[0088] aec_out1 = MIC-echo
[0089] A linear echo cancellation signal aec_out1 is obtained, wherein MIC is a microphone signal and echo is a linear echo signal.
[0090] Step S130: estimate the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determine a first suppression parameter.
[0091] The first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal.
[0092] When eliminating the estimated linear echo component, the residual linear echo may be caused by errors in the linear echo estimation process. The residual echo component can be detected according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and the first suppression parameter is determined accordingly.
[0093] In some embodiments, the determined first suppression parameter includes a suppression value corresponding to each frequency point. For example, for the two possible values of the suppression value, 0 and 1, a value of 1 indicates that the frequency point is not suppressed, and a value of 0 indicates that the frequency point is completely suppressed.
[0094] Step S150: Estimate the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal.
[0095] Wherein, N is a positive integer.
[0096] Among them, the first N frames are the first N frames of the current frame, and the reverberation echo estimation is performed on the current frame according to the linear echo signals of the first N frames to obtain the reverberation echo signal of the current frame. It can be understood that the first N frames include N frames, and the above-mentioned loudspeaker signal, microphone signal, first suppression parameter and other signals and parameters can all be described as the loudspeaker signal of the current frame, the microphone signal of the current frame, the first suppression parameter of the current frame, and so on. Except for the signals and parameters that are clearly defined as the first N frames or the previous frame, the signals and parameters in the embodiments of the present disclosure are all understood to be the signals and parameters of the current frame.
[0097] In some embodiments, N is the number of frames in which the speaker signal reaches the microphone after being reflected by the longest path in the current environment after being played; in some embodiments, N is a preset value calculated based on prior experience and / or an algorithm model; in some embodiments, before performing reverberation echo estimation based on the linear echo signal of the first N frames, it also includes: analyzing the microphone signal or the linear echo signal to determine the value of N.
[0098] Step S160: determine a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal.
[0099] The second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal.
[0100] In some embodiments, the second suppression parameter is determined by a Wiener filtering algorithm according to the linear echo cancellation signal and the reverberation echo signal.
[0101] Step S170: Process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output an echo cancellation signal.
[0102] The linear echo cancellation signal is processed according to the first suppression parameter and the second suppression parameter to eliminate the residual linear echo and reverberation echo in the linear echo cancellation signal, and the echo cancellation signal is output.
[0103] In some embodiments, the following formula is used:
[0104] aec_out=aec_out1*H(w)*H2
[0105] The echo cancellation signal aec_out is obtained, wherein aec_out1 is a linear echo cancellation signal, H(w) is a first suppression parameter, and H2 is a second suppression parameter.
[0106] Figure 2 FIG. 1 is a schematic diagram showing a call scenario according to an exemplary embodiment. Figure 2As shown, the remote device K and the near-end device L communicate with each other by phone. The voice signal A of the first user of the remote device K is collected and processed by the microphone of the remote device K, transmitted to the near-end device L, and played through the speaker of the near-end device L. The arrow in the figure indicates the direction of signal propagation.
[0107] For example, Figure 2 As shown, the near-end device L is a wearable device with few computing resources such as a smart watch, and conducts a duplex voice call with the far-end device K in an environment with strong reverberation such as an elevator and a conference room. Because the near-end device L is in a strong reverberation environment, the microphone of the near-end device L collects signals including the second user's voice signal B, the echo A1 of the voice signal A transmitted from the speaker of the near-end device L to its microphone, and the reverberation echo A2 collected after a part of the voice signal A is reflected over a shorter path, as well as the late reverberation echo A3 of the voice signal A after being reflected over a longer path. For example, obstacles are represented by black rectangles in the figure.
[0108] In the related art, an adaptive filtering algorithm is often used to process the microphone collected signal of the near-end device L. For example, when the sampling rate is 16000, the frame shift is 256, and the adaptive filter order is 256, Figure 2 As shown, it can remove the direct echo A1 and the reverberation echo A2 within 16ms, but the late reverberation echo A3 exceeding 16ms will be transmitted to the remote device K together with the voice signal B, and the remote first user can hear his own voice content due to the existence of the reverberation echo A3.
[0109] An embodiment of the present disclosure provides an echo cancellation method, which includes: estimating a linear echo component in a microphone signal collected by a microphone according to a speaker signal output by a speaker to obtain a linear echo signal; eliminating the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal; estimating a residual echo component in the linear echo cancellation signal according to a spectrum of the microphone signal and a spectrum of the linear echo signal, and determining a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal; estimating a reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer; determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal; processing the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and outputting the echo cancellation signal. Therefore, compared with the related technology, the solution provided by the embodiment of the present disclosure, on the basis of linear echo cancellation, realizes fast and accurate reverberation echo estimation through the above-mentioned reverberation echo estimation method, thereby processing the call signal and improving the call effect. Moreover, the reverberation echo estimation method not only has high real-time performance, but also has low computational complexity.
[0110] Figure 3 FIG. 1 is a flow chart of an implementation method of step S110 in the embodiment of the present disclosure. Figure 3 As shown, step S110, estimating the linear echo component in the microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain a linear echo signal, includes the following steps.
[0111] Step S111: Detect whether the speaker signal includes a speech component.
[0112] In some embodiments, voice activity detection (VAD) is performed on the speaker signal to detect whether the speaker signal includes a speech component.
[0113] Exemplarily, in response to detecting that the speaker signal does not include a speech component, the attribute value VAD is set to 0 in the detection result, and in response to detecting that the speaker signal includes a speech component, the attribute value VAD is set to 1 in the detection result.
[0114] Among them, voice activity detection is a technology used in voice processing, which is used to detect whether a voice signal exists.
[0115] Step S112: In response to detecting that the loudspeaker signal does not include a speech component, a Kalman filter algorithm is used to estimate a linear echo component in the microphone signal to obtain a linear echo signal.
[0116] Step S113: in response to detecting that the loudspeaker signal includes a speech component, the Kalman coefficient is updated, and a linear echo component in the microphone signal is estimated using a Kalman filter algorithm to obtain a linear echo signal.
[0117] In which, in response to detecting that the speaker signal includes a speech component, the Kalman coefficient is updated, the echo path is estimated, and then filtering is performed to perform a linear echo estimation on the microphone signal. In response to detecting that the speaker signal does not include a speech component, filtering is directly performed to perform a linear echo estimation on the microphone signal.
[0118] Among them, the Kalman filter algorithm is an algorithm that uses the linear system state equation to optimally estimate the system state through the system input and output observation data. Since the observation data includes the influence of noise and interference in the system, the optimal estimation can also be regarded as a filtering process.
[0119] Therefore, linear echo estimation is achieved through the Kalman filter algorithm.
[0120] Figure 4 FIG. 1 is a flow chart of an implementation method of step S130 in the embodiment of the present disclosure. Figure 4 As shown, in step S130, the residual echo component in the linear echo cancellation signal is estimated according to the spectrum of the microphone signal and the spectrum of the linear echo signal, including the following steps.
[0121] Step S131 : Detect the residual echo component in the linear echo cancellation signal by using spectral subtraction according to the spectrum of the microphone signal and the spectrum of the linear echo signal.
[0122] The purpose of spectral subtraction is to use the spectrum of the noisy signal to subtract the spectrum of the noise signal to obtain a pure signal, which can also be achieved by subtracting the amplitude spectrum and the power spectrum; and correspondingly, the spectral subtraction method can also be used to detect the residual echo component in the linear echo cancellation signal, and thereby determine the first suppression parameter.
[0123] In some embodiments, the following formula is used:
[0124]
[0125] The first suppression parameter H(w) is obtained, wherein D(w) is the frequency domain signal corresponding to the linear echo signal, and Y(w) is the frequency domain signal corresponding to the microphone signal.
[0126] Thus, the estimation of the linear residual echo is achieved by spectral subtraction.
[0127] Figure 51 is a flow chart of an implementation method of step S150 in the embodiment of the present disclosure. In step S150, before estimating the reverberation echo component in the linear echo cancellation signal and obtaining the reverberation echo signal, the echo cancellation method further includes: calculating a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter; Figure 5 As shown, step S150, performing reverberation echo estimation on the linear echo signal of the first N frames to obtain a reverberation echo signal includes the following steps.
[0128] Step S151: in response to the value of the far-end single-talk flag being greater than or equal to a preset first threshold, determining an echo attenuation coefficient corresponding to each frame in the first N frames according to a linear echo cancellation signal and linear echo signals of the first N frames.
[0129] The echo attenuation coefficient corresponding to each frame in the previous N frames is determined according to the linear echo cancellation signal of the current frame and the linear echo signals of the previous N frames.
[0130] Among them, in the far-end single-talk voice state, the microphone signal is obtained by superimposing the far-end signal of the current frame and the far-end signal of the previous N frames of the current frame after reflection attenuation and the signal collected by the microphone, so the echo attenuation of the previous N frames needs to be considered.
[0131] In some embodiments, the following formula is used:
[0132]
[0133] Get the echo attenuation coefficient tmp corresponding to the jth frame before the current frame j , where aec_out1 is the linear echo cancellation signal, echo_last j is the linear echo signal of the jth frame before the current frame. Among them, the echo attenuation coefficient tmp j Indicates the degree to which the echo of the jth frame before the current frame decays to the current frame.
[0134] In some embodiments, the first threshold may be 0.9.
[0135] Among them, the remote single-talk flag represents the probability that the call status is the remote single-talk, and the value of the remote single-talk flag is greater than or equal to the preset first threshold, which indicates that the call status is detected as the remote single-talk; in some embodiments, the larger the value of the remote single-talk flag is, the greater the probability that the call status is the remote single-talk; in some embodiments, the value range of the remote single-talk flag is 0 to 1.
[0136] In some embodiments, the following formula is used:
[0137]
[0138] Get the remote single talk flag pure_echo_flag, where energy ref represents the energy of a frame of the loudspeaker signal REF in the time domain, thr is the corresponding energy threshold, Hw i is the first suppression parameter corresponding to the frequency point i, i∈[m,n]. For example, m is 5 and n is 100.
[0139] Step S152: Determine the reverberation attenuation coefficient corresponding to each frame in the first N frames according to the echo attenuation coefficient and the far-end single-talk flag.
[0140] The reverberation attenuation coefficient corresponding to each of the first N frames is determined according to the far-end single-talk flag and the echo attenuation coefficient corresponding to each of the first N frames. Thus, the reverberation attenuation coefficient is determined based on the call state while taking the echo attenuation into consideration. For example, the reverberation attenuation coefficient is estimated according to the echo attenuation coefficient in the far-end single-talk state, and the reverberation attenuation coefficient is kept unchanged in the near-end single-talk state and the near-end and far-end dual-talk state, so as to avoid interference of the near-end voice on the echo estimation.
[0141] Figure 6 FIG. 1 is a flow chart of an implementation method of step S152 in the embodiment of the present disclosure. Figure 6 As shown, in step S152, in the step of determining the reverberation attenuation coefficient corresponding to each of the first N frames according to the echo attenuation coefficient and the far-end single-talk flag, for each of the first N frames, the following steps are performed.
[0142] Step S1521: determine a smoothing factor according to the far-end single-talk flag, the echo attenuation coefficient corresponding to the frame, and the initial reverberation attenuation coefficient corresponding to the frame.
[0143] Step S1522: smooth the initial reverberation attenuation coefficient according to the smoothing factor and the echo attenuation coefficient corresponding to the frame to obtain the reverberation attenuation coefficient corresponding to the frame.
[0144] The initial reverberation attenuation coefficient is a reverberation attenuation coefficient previously determined for the frame or an initial value of the reverberation attenuation coefficient.
[0145] In some embodiments, the following formula is used:
[0146] w_s j =w_s j *b+tmp j *(1-b)
[0147]
[0148] Get the reverberation attenuation coefficient w_s corresponding to the jth frame before the current frame j , where b is the smoothing factor, tmpj is the echo attenuation coefficient corresponding to the jth frame before the current frame, and pure_echo_flag is the far-end single-talk flag.
[0149] Thus, for each frame in the first N frames, the corresponding reverberation attenuation coefficient is determined.
[0150] Step S153: Estimate the reverberation echo component in the linear echo cancellation signal according to the reverberation attenuation coefficient and the linear echo signal of the previous N frames to obtain a reverberation echo signal.
[0151] The reverberation echo is estimated according to the reverberation attenuation coefficient corresponding to each frame in the first N frames and the linear echo signal of the first N frames to obtain the reverberation echo signal.
[0152] In some embodiments, the following formula is used:
[0153]
[0154] Get the reverberation echo signal reverb_echo, where w_s j is the reverberation attenuation coefficient corresponding to the jth frame before the current frame, echo_last j The linear echo signal of the jth frame before the current frame.
[0155] Therefore, through the above-mentioned method, a fast and accurate estimation of the reverberation echo is achieved based on the characteristics of the reverberation echo.
[0156] Figure 7 is a flow chart of an implementation method of step S160 in the embodiment of the present disclosure. In step S160, before determining the second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, the echo cancellation method further includes: calculating a far-end single-talk flag according to the speaker signal and the first suppression parameter, and determining a smoothing coefficient according to the far-end single-talk flag; Figure 7 As shown, step S160, determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, includes the following steps.
[0157] Step S161: Calculate the posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal and the energy value of the reverberation echo signal.
[0158] Among them, the optional implementation methods and related terminology explanations of the far-end single-talk flag and the smoothing coefficient can be found in the optional implementation methods of the relevant steps and other related parts in the embodiments involved in the relevant steps, and will not be repeated here.
[0159] In some embodiments, the following formula is used:
[0160]
[0161] The posterior signal-to-return ratio postSNR is calculated, where aec_out1 is the linear echo cancellation signal and reverb_echo is the reverberation echo signal.
[0162] Step S162: determine the a priori signal-to-response ratio according to the a posteriori signal-to-response ratio.
[0163] In some embodiments, the following formula is used:
[0164] priorSNR=max(postSNR,0)
[0165] Determine the prior signal-to-response ratio priorSNR, where postSNR is the posterior signal-to-response ratio and max() means taking the maximum value of the two values.
[0166] Step S163, smoothing the a priori signal-to-response ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the a posteriori signal-to-response ratio corresponding to the previous frame.
[0167] In some embodiments, the following formula is used:
[0168] SNR′=priorSNR*(1-α)+α*H2_last 2 *SNR_last
[0169] The smoothed prior signal-to-response ratio SNR′ is obtained, wherein priorSNR is the prior signal-to-response ratio, α is the smoothing coefficient, H2_last is the second suppression parameter corresponding to the previous frame of the current frame, and SNR_last is the posterior signal-to-response ratio corresponding to the previous frame of the current frame.
[0170] Step S164: determine a second suppression parameter according to the smoothed priori signal-to-response ratio.
[0171] In some embodiments, the following formula is used:
[0172]
[0173] Determine the second suppression parameter H2, where SNR′ is the smoothed priori signal-to-response ratio.
[0174] Figure 8 FIG. 1 is a flow chart of another echo cancellation method according to an exemplary embodiment. Figure 8 As shown, the method includes the following steps.
[0175] Step S210: perform linear echo estimation on the input microphone signal according to the speaker signal output by the speaker to obtain a linear echo signal.
[0176] Step S220: Perform linear echo cancellation on the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal.
[0177] Step S230: Detect whether there is a residual echo according to the frequency spectrum of the microphone signal and the frequency spectrum of the linear echo signal, and determine a first suppression parameter according to the detection result.
[0178] Step S240: Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter.
[0179] Among them, the optional implementation methods and related terminology explanations of the remote single-talk flag can be found in the optional implementation methods of the aforementioned related steps and other related parts in the embodiments involved in the related steps, and will not be repeated here.
[0180] Step S241: in response to the value of the far-end single-talk flag being greater than or equal to a preset second threshold, estimate a nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal and a nonlinear distortion signal corresponding to the loudspeaker signal to obtain a nonlinear echo signal.
[0181] The nonlinear distortion signal is obtained by full-wave rectification of the loudspeaker signal.
[0182] The absolute value of the loudspeaker signal in the time domain is taken and then transformed into the frequency domain to obtain a nonlinear distortion signal.
[0183] Among them, due to reasons such as the structure of the device, it will cause signal distortion, and the echo caused by the corresponding signal component is a nonlinear echo. The embodiment of the present disclosure introduces a nonlinear signal in the form of a nonlinear distortion signal, so that the nonlinear echo can be removed later.
[0184] In some embodiments, the second threshold may be 0.7.
[0185] Step S250: perform reverberation echo estimation according to the linear echo signals of the previous N frames to obtain a reverberation echo signal.
[0186] Step S265: determine a second suppression parameter according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal.
[0187] The second suppression parameter is used to suppress the reverberation echo component and the nonlinear echo component in the linear echo cancellation signal.
[0188] After the nonlinear distortion is introduced, the second suppression parameter is determined according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal to suppress the nonlinear echo and the reverberation echo.
[0189] Step S270: Process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output an echo cancellation signal.
[0190] Therefore, by introducing a nonlinear distortion signal to perform nonlinear echo estimation, and based on the above reverberation echo estimation, it is possible to process the nonlinear echo and reverberation echo in the microphone signal on the basis of linear echo cancellation.
[0191] Fig. 9 FIG. 2 is a flow chart of an implementation method of step S241 in the embodiment of the present disclosure. Fig. 9 As shown, in step S241, the step of estimating the nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal and the nonlinear distortion signal corresponding to the loudspeaker signal to obtain the nonlinear echo signal includes the following steps.
[0192] Step S2411: Calculate the ratio of the amplitude of the linear echo cancellation signal to the amplitude of the nonlinear distortion signal, and transform the ratio into a logarithmic domain to obtain a logarithmic domain ratio.
[0193] In some embodiments, the following formula is used:
[0194]
[0195] Determine the logarithmic domain ratio Hn corresponding to frequency point i i , where aec_out1 is the linear echo cancellation signal, ref_abs is the nonlinear distortion signal in the frequency domain, and abs() represents the amplitude of the corresponding frequency domain signal.
[0196] Step S2412: Determine a smoothing coefficient according to the far-end single-talk flag.
[0197] In some embodiments, the larger the value of the far-end single-talk flag is, the higher the probability that the call state is the far-end single-talk, and the smaller the smoothing coefficient is.
[0198] Step S2413: smooth the logarithmic domain ratio according to the smoothing coefficient.
[0199] In some embodiments, the following formula is used:
[0200] Hn_s=α*Hn_s+(1-α)*Hn
[0201]
[0202] The smoothed logarithmic domain ratio Hn_s is obtained, where α is the smoothing coefficient, Hn is the logarithmic domain ratio, and pure_echo_flag is the far-end single talk flag.
[0203] Step S2414: transform the smoothed logarithmic domain ratio to the amplitude domain to obtain an amplitude domain ratio.
[0204] In some embodiments, the following formula is used:
[0205]
[0206] The amplitude domain ratio map_gain is obtained, where Hn_s is the logarithmic domain ratio after smoothing.
[0207] Step S2415: Obtain a nonlinear echo signal according to the amplitude domain ratio and the nonlinear distortion signal.
[0208] In some embodiments, the following formula is used:
[0209] map_echo = map_gain * ref_abs
[0210] A nonlinear echo signal map_echo is obtained, where map_gain is the amplitude domain ratio and ref_abs is the nonlinear distortion signal.
[0211] Fig.10 FIG. 2 is a flow chart of an implementation method of step S265 in the embodiment of the present disclosure. Fig.10 As shown, step S265, determining the second suppression parameter according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal, includes the following steps.
[0212] Step S2651: Calculate the posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal, the energy value of the reverberation echo signal and the energy value of the nonlinear echo signal.
[0213] In some embodiments, the following formula is used:
[0214]
[0215] The posterior signal-to-return ratio postSNR is calculated, where aec_out1 is the linear echo cancellation signal, reverb_echo is the reverberation echo signal, and map_echo is the nonlinear echo signal.
[0216] Step S2652: determine the a priori signal-to-response ratio based on the posterior signal-to-response ratio.
[0217] In some embodiments, the following formula is used:
[0218] priorSNR=max(postSNR,0)
[0219] Determine the prior signal-to-response ratio priorSNR, where postSNR is the posterior signal-to-response ratio and max() means taking the maximum value of the two values.
[0220] Step S2653: smooth the a priori signal-to-response ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the a priori signal-to-response ratio corresponding to the previous frame.
[0221] In some embodiments, the following formula is used:
[0222] SNR′=priorSNR*(1-α)+α*H2_last 2 *SNR_last
[0223] The smoothed prior signal-to-response ratio SNR′ is obtained, wherein priorSNR is the prior signal-to-response ratio, α is the smoothing coefficient, H2_last is the second suppression parameter corresponding to the previous frame of the current frame, and SNR_last is the posterior signal-to-response ratio corresponding to the previous frame of the current frame.
[0224] Step S2654: determine a second suppression parameter according to the smoothed priori signal-to-response ratio.
[0225] In some embodiments, the following formula is used:
[0226]
[0227] Determine the second suppression parameter H2, where SNR′ is the smoothed priori signal-to-response ratio.
[0228] Therefore, by processing the linear echo cancellation signal based on the determined second suppression parameter, the nonlinear echo and the reverberation echo can be suppressed at the same time.
[0229] The echo cancellation method provided by the present disclosure is described below in combination with practical applications.
[0230] Fig.11 FIG. 1 is a flow chart of another echo cancellation method according to an exemplary embodiment. Fig.11 As shown, the method includes the following steps.
[0231] Step S310: Detect whether the speaker signal includes a speech component.
[0232] The speaker signal is subjected to voice activity detection to detect whether the speaker signal includes a voice component.
[0233] In step S310, in response to detecting that the speaker signal does not include a speech component, step S311 is executed, and in response to detecting that the speaker signal includes a speech component, step S312 is executed.
[0234] Step S311: Use the Kalman filter algorithm to estimate the linear echo component in the microphone signal to obtain a linear echo signal.
[0235] Step S312: Update the Kalman coefficient and use the Kalman filter algorithm to estimate the linear echo component in the microphone signal to obtain a linear echo signal.
[0236] Step S320: Eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal.
[0237] Among them, through the following formula
[0238] aec_out1 = MIC-echo
[0239] A linear echo cancellation signal aec_out1 is obtained, wherein MIC is a microphone signal and echo is a linear echo signal.
[0240] Step S330: Determine a first suppression parameter corresponding to the residual echo component by using spectral subtraction according to the spectrum of the microphone signal and the spectrum of the linear echo signal.
[0241] Among them, through the following formula:
[0242]
[0243] The first suppression parameter H(w) is obtained, wherein D(w) is the frequency domain signal corresponding to the linear echo signal, and Y(w) is the frequency domain signal corresponding to the microphone signal.
[0244] Step S340: Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter.
[0245] Among them, through the following formula:
[0246]
[0247] Get the remote single talk flag pure_echo_flag, where energy ref represents the energy of a frame of the loudspeaker signal REF in the time domain, thr is the corresponding energy threshold, Hw i is the first suppression parameter corresponding to frequency point i, i∈[m,n], where m is 5 and n is 100.
[0248] Step S341: In response to the value of the far-end single-talk flag being greater than or equal to a preset second threshold, the ratio of the amplitude of the linear echo cancellation signal to the amplitude of the nonlinear distortion signal is calculated, and the ratio is transformed into a logarithmic domain to obtain a logarithmic domain ratio.
[0249] The value of the second threshold is 0.7.
[0250] Among them, through the following formula:
[0251]
[0252] Determine the logarithmic domain ratio Hn corresponding to frequency point i i , where ref_abs is the nonlinear distortion signal in the frequency domain, and abs() represents the amplitude of the corresponding frequency domain signal.
[0253] Step S342: determine a smoothing coefficient according to the far-end single-talk flag, and smooth the logarithmic domain ratio according to the smoothing coefficient.
[0254] In some embodiments, the following formula is used:
[0255] Hn_s=α*Hn_s+(1-α)*Hn
[0256]
[0257] The smoothed logarithmic domain ratio Hn_s is obtained, where α is the smoothing coefficient.
[0258] Step S343: transform the smoothed logarithmic domain ratio into the amplitude domain to obtain the amplitude domain ratio.
[0259] Among them, through the following formula:
[0260]
[0261] Get the amplitude domain ratio map_gain.
[0262] Step S344: Obtain a nonlinear echo signal according to the amplitude domain ratio and the nonlinear distortion signal.
[0263] Among them, through the following formula:
[0264] map_echo = map_gain * ref_abs
[0265] Get the nonlinear echo signal map_echo.
[0266] Step S350: in response to the value of the far-end single-talk flag being greater than or equal to a preset first threshold, determining an echo attenuation coefficient corresponding to each frame in the first N frames according to the linear echo cancellation signal and the linear echo signals of the first N frames.
[0267] The first threshold value is 0.9.
[0268] Among them, through the following formula:
[0269]
[0270] Get the echo attenuation coefficient tmp corresponding to the jth frame before the current frame j , where echo_last j is the linear echo signal of the jth frame before the current frame.
[0271] Step S351: determine a smoothing factor according to the far-end single-talk flag, the echo attenuation coefficient corresponding to the frame, and the initial reverberation attenuation coefficient corresponding to the frame, and smooth the initial reverberation attenuation coefficient according to the smoothing factor and the echo attenuation coefficient corresponding to the frame to obtain the reverberation attenuation coefficient corresponding to the frame.
[0272] Among them, through the following formula:
[0273] w_s j =w_s j *b+tmp j *(1-b)
[0274]
[0275] Get the reverberation attenuation coefficient w_s corresponding to the jth frame before the current frame j , where b is the smoothing factor.
[0276] Step S352: Estimate the reverberation echo component in the linear echo cancellation signal according to the reverberation attenuation coefficient and the linear echo signal of the previous N frames to obtain a reverberation echo signal.
[0277] Among them, through the following formula:
[0278]
[0279] Get the reverberation echo signal reverb_echo.
[0280] Step S360: Calculate the posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal, the energy value of the reverberation echo signal and the energy value of the nonlinear echo signal.
[0281] Among them, through the following formula:
[0282]
[0283] The posterior signal-to-return ratio (postSNR) is calculated.
[0284] Step S361, determine the a priori signal-to-response ratio according to the a posteriori signal-to-response ratio.
[0285] In some embodiments, the following formula is used:
[0286] priorSNR=max(postSNR,0)
[0287] Determine the prior signal-to-return ratio priorSNR, where max() means taking the maximum value of two values.
[0288] Step S362: smooth the a priori signal-to-response ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the a priori signal-to-response ratio corresponding to the previous frame.
[0289] Among them, through the following formula:
[0290] SNR′=priorSNR*(1-α)+α*H2_last 2 *SNR_last
[0291] The smoothed a priori signal-to-response ratio SNR′ is obtained, wherein H2_last is the second suppression parameter corresponding to the previous frame of the current frame, and SNR_last is the a posteriori signal-to-response ratio corresponding to the previous frame of the current frame.
[0292] Step S363: determine a second suppression parameter according to the smoothed priori signal-to-response ratio.
[0293] In some embodiments, the following formula is used:
[0294]
[0295] A second suppression parameter H2 is determined.
[0296] Step S370: Process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output the echo cancellation signal.
[0297] Among them, through the following formula:
[0298] aec_out=aec_out1*H(w)*H2
[0299] The echo cancellation signal aec_out is obtained.
[0300] In this way, the microphone signal is processed, the linear echo, nonlinear echo and reverberation echo therein are eliminated, and the quality of the voice signal is improved.
[0301] Fig.12 FIG. 1 is a block diagram of an echo cancellation device according to an exemplary embodiment. Fig.12 As shown, the echo cancellation device 70 includes: a linear echo estimation module 71, a linear echo cancellation module 72, a linear residual echo suppression module 73, a reverberation echo estimation module 74, an echo suppression module 75 and an echo cancellation module 76.
[0302] The linear echo estimation module 71 is configured to estimate the linear echo component in the input microphone signal collected by the microphone according to the speaker signal output by the speaker, so as to obtain a linear echo signal.
[0303] The linear echo cancellation module 72 eliminates the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal.
[0304] The linear residual echo suppression module 73 is configured to estimate the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determine a first suppression parameter.
[0305] The reverberation echo estimation module 74 estimates the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain the reverberation echo signal, wherein N is a positive integer.
[0306] The echo suppression module 75 is configured to determine a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal.
[0307] The echo cancellation module 76 is configured to process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output the echo cancellation signal.
[0308] In some embodiments, the linear echo estimation module 71 is configured to detect whether the speaker signal includes a speech component; in response to detecting that the speaker signal does not include a speech component, estimate the linear echo component in the microphone signal using a Kalman filter algorithm to obtain a linear echo signal; in response to detecting that the speaker signal includes a speech component, update the Kalman coefficient, and estimate the linear echo component in the microphone signal using a Kalman filter algorithm to obtain a linear echo signal.
[0309] In some embodiments, the linear residual echo suppression module 73 is configured to detect the residual echo component in the linear echo cancellation signal by using spectrum subtraction according to the spectrum of the microphone signal and the spectrum of the linear echo signal.
[0310] In some embodiments, the echo cancellation device further includes: a computing module.
[0311] The calculation module is configured to calculate the far-end single-talk flag according to the loudspeaker signal and the first suppression parameter.
[0312] The reverberation echo estimation module 74 is configured to, in response to the value of the far-end single-talk flag being greater than or equal to a preset first threshold, determine an echo attenuation coefficient corresponding to each of the first N frames according to the linear echo cancellation signal and the linear echo signals of the first N frames; determine a reverberation attenuation coefficient corresponding to each of the first N frames according to the echo attenuation coefficient and the far-end single-talk flag; and estimate a reverberation echo component in the linear echo cancellation signal according to the reverberation attenuation coefficient and the linear echo signals of the first N frames to obtain a reverberation echo signal.
[0313] In some embodiments, the reverberation echo estimation module 74 is configured to, for each frame in the first N frames: determine a smoothing factor according to the far-end single-talk flag, the echo attenuation coefficient corresponding to the frame, and the initial reverberation attenuation coefficient corresponding to the frame; and smooth the initial reverberation attenuation coefficient according to the smoothing factor and the echo attenuation coefficient corresponding to the frame to obtain the reverberation attenuation coefficient corresponding to the frame.
[0314] In some embodiments, the echo cancellation device further includes: a calculation module and a nonlinear echo estimation module.
[0315] The calculation module is configured to calculate the far-end single-talk flag according to the loudspeaker signal and the first suppression parameter.
[0316] The nonlinear echo estimation module is configured to estimate the nonlinear echo component in the linear echo cancellation signal according to the nonlinear distortion signal corresponding to the far-end single-talk flag, the linear echo cancellation signal and the loudspeaker signal in response to the value of the far-end single-talk flag being greater than or equal to a preset second threshold, so as to obtain a nonlinear echo signal, wherein the nonlinear distortion signal is obtained by full-wave rectification of the loudspeaker signal.
[0317] The echo suppression module 75 is configured to determine a second suppression parameter according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal.
[0318] In some embodiments, the nonlinear echo estimation module is configured to calculate the ratio of the amplitudes of the linear echo cancellation signal and the nonlinear distortion signal, and transform the ratio into a logarithmic domain to obtain a logarithmic domain ratio; determine a smoothing coefficient according to a far-end single-talk flag; smooth the logarithmic domain ratio according to the smoothing coefficient; transform the smoothed logarithmic domain ratio into an amplitude domain to obtain an amplitude domain ratio; and obtain a nonlinear echo signal according to the amplitude domain ratio and the nonlinear distortion signal.
[0319] In some embodiments, the echo suppression module 75 is configured to calculate a posterior signal-to-return ratio based on the energy value of the linear echo cancellation signal, the energy value of the reverberation echo signal, and the energy value of the nonlinear echo signal; determine a priori signal-to-return ratio based on the posterior signal-to-return ratio; smooth the priori signal-to-return ratio based on the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the posterior signal-to-return ratio corresponding to the previous frame; and determine the second suppression parameter based on the smoothed priori signal-to-return ratio.
[0320] In some embodiments, the echo cancellation device further includes: a computing module.
[0321] The calculation module is configured to calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter; and determine a smoothing coefficient according to the far-end single-talk flag.
[0322] The echo suppression module 75 is configured to calculate a posterior signal-to-return ratio based on the energy value of the linear echo cancellation signal and the energy value of the reverberation echo signal; determine a priori signal-to-return ratio based on the posterior signal-to-return ratio; smooth the priori signal-to-return ratio based on the smoothing coefficient, the second suppression parameter corresponding to the previous frame and the posterior signal-to-return ratio corresponding to the previous frame; and determine the second suppression parameter based on the smoothed priori signal-to-return ratio.
[0323] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0324] The present disclosure also provides a computer-readable storage medium on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the echo cancellation method provided by the present disclosure are implemented.
[0325] Fig.13 1 is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be a wearable device, a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0326] Reference Fig.13 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output interface 812 , a sensor component 814 , and a communication component 816 .
[0327] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned echo cancellation method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0328] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0329] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0330] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0331] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0332] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0333] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0334] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0335] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-mentioned echo cancellation method.
[0336] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the electronic device 800 to perform the above-mentioned echo cancellation method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0337] In addition to being an independent electronic device, the above-mentioned device can also be a part of an independent electronic device. For example, in one embodiment, the device can be an integrated circuit (IC) or a chip, wherein the integrated circuit can be one IC or a collection of multiple ICs; the chip can include but is not limited to the following types: GPU (Graphics Processing Unit), CPU (Central Processing Unit), FPGA (Field Programmable Gate Array), DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), SOC (System on Chip, SoC), etc. The above-mentioned integrated circuit or chip can be used to execute executable instructions (or codes) to implement the above-mentioned echo cancellation method. The executable instructions can be stored in the integrated circuit or chip, or can be obtained from other devices or equipment, for example, the integrated circuit or chip includes a processor, a memory, and an interface for communicating with other devices. The executable instruction may be stored in the memory, and when the executable instruction is executed by the processor, the above-mentioned echo cancellation method is implemented; alternatively, the integrated circuit or chip may receive the executable instruction through the interface and transmit it to the processor for execution, so as to implement the above-mentioned echo cancellation method.
[0338] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device. The computer program has a code portion for executing the above echo cancellation method when executed by the programmable device.
[0339] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0340] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An echo cancellation method, characterized in that: Applied to a terminal having a speaker and a microphone, the method comprises: estimating a linear echo component in a microphone signal collected by the microphone according to a speaker signal output by the speaker to obtain a linear echo signal; Eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal; estimating a residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determining a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal; Estimate the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer; determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal; The linear echo cancellation signal is processed according to the first suppression parameter and the second suppression parameter, and an echo cancellation signal is output.
2. The echo cancellation method according to claim 1, characterized in that: The estimating the linear echo component in the microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain the linear echo signal includes: Detecting whether the speaker signal includes a speech component; In response to detecting that the loudspeaker signal does not include a speech component, estimating a linear echo component in the microphone signal using a Kalman filter algorithm to obtain the linear echo signal; In response to detecting that the loudspeaker signal includes a speech component, the Kalman coefficient is updated, and the linear echo component in the microphone signal is estimated using the Kalman filter algorithm to obtain the linear echo signal.
3. The echo cancellation method according to claim 1, characterized in that: The estimating the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal comprises: According to the spectrum of the microphone signal and the spectrum of the linear echo signal, a residual echo component in the linear echo cancellation signal is detected by using a spectrum subtraction method.
4. The echo cancellation method according to claim 1, characterized in that: Before estimating the reverberation echo component in the linear echo cancellation signal to obtain the reverberation echo signal, the echo cancellation method further includes: Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter; The step of performing reverberation echo estimation according to the linear echo signal of the first N frames to obtain a reverberation echo signal comprises: In response to the value of the far-end single-talk flag being greater than or equal to a preset first threshold, determining an echo attenuation coefficient corresponding to each frame in the first N frames according to the linear echo cancellation signal and the linear echo signals of the first N frames; Determine the reverberation attenuation coefficient corresponding to each frame in the first N frames according to the echo attenuation coefficient and the far-end single-talk flag; The reverberation echo component in the linear echo cancellation signal is estimated according to the reverberation attenuation coefficient and the linear echo signal of the previous N frames to obtain the reverberation echo signal.
5. The echo cancellation method according to claim 4, characterized in that: The step of determining the reverberation attenuation coefficient corresponding to each frame in the first N frames according to the echo attenuation coefficient and the far-end single-talk flag includes: For each of the first N frames: Determine a smoothing factor according to the far-end single-talk flag, the echo attenuation coefficient corresponding to the frame, and the initial reverberation attenuation coefficient corresponding to the frame; The initial reverberation attenuation coefficient is smoothed according to the smoothing factor and the echo attenuation coefficient corresponding to the frame to obtain the reverberation attenuation coefficient corresponding to the frame.
6. The echo cancellation method according to claim 1, characterized in that: Before determining the second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, the echo cancellation method further includes: Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter; In response to the value of the far-end single-talk flag being greater than or equal to a preset second threshold, estimating a nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal, and a nonlinear distortion signal corresponding to the loudspeaker signal to obtain a nonlinear echo signal, wherein the nonlinear distortion signal is obtained by full-wave rectification of the loudspeaker signal; The determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal comprises: The second suppression parameter is determined according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component and the nonlinear echo component in the linear echo cancellation signal.
7. The echo cancellation method according to claim 6, characterized in that: The estimating the nonlinear echo component in the linear echo cancellation signal according to the far-end single-talk flag, the linear echo cancellation signal and the nonlinear distortion signal corresponding to the loudspeaker signal to obtain the nonlinear echo signal includes: Calculating a ratio of the amplitude of the linear echo cancellation signal to the amplitude of the nonlinear distortion signal, and transforming the ratio into a logarithmic domain to obtain a logarithmic domain ratio; Determine a smoothing coefficient according to the far-end single-talk flag; smoothing the logarithmic domain ratio according to the smoothing coefficient; Transforming the smoothed logarithmic domain ratio to the amplitude domain to obtain an amplitude domain ratio; The nonlinear echo signal is obtained according to the amplitude domain ratio and the nonlinear distortion signal.
8. The echo cancellation method according to claim 7, characterized in that: The determining the second suppression parameter according to the linear echo cancellation signal, the nonlinear echo signal and the reverberation echo signal comprises: Calculating a posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal, the energy value of the reverberation echo signal and the energy value of the nonlinear echo signal; Determine a priori signal-to-return ratio according to the posterior signal-to-return ratio; smoothing the a priori signal-to-return ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the a posteriori signal-to-return ratio corresponding to the previous frame; The second suppression parameter is determined according to the smoothed priori signal-to-echo ratio.
9. The echo cancellation method according to claim 1, characterized in that: Before determining the second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, the echo cancellation method includes: Calculate a far-end single-talk flag according to the loudspeaker signal and the first suppression parameter; Determine a smoothing coefficient according to the far-end single-talk flag; The determining a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal comprises: Calculating a posterior signal-to-echo ratio according to the energy value of the linear echo cancellation signal and the energy value of the reverberation echo signal; Determine a priori signal-to-return ratio according to the posterior signal-to-return ratio; smoothing the a priori signal-to-response ratio according to the smoothing coefficient, the second suppression parameter corresponding to the previous frame, and the posterior signal-to-response ratio corresponding to the previous frame; The second suppression parameter is determined according to the smoothed priori signal-to-echo ratio.
10. An echo cancellation device, characterized in that: include: A linear echo estimation module is configured to estimate the linear echo component in the microphone signal collected by the microphone according to the speaker signal output by the speaker to obtain a linear echo signal; A linear echo cancellation module, configured to eliminate the linear echo component in the microphone signal according to the linear echo signal to obtain a linear echo cancellation signal; a linear residual echo suppression module, configured to estimate the residual echo component in the linear echo cancellation signal according to the spectrum of the microphone signal and the spectrum of the linear echo signal, and determine a first suppression parameter, wherein the first suppression parameter is used to suppress the residual echo component in the linear echo cancellation signal; a reverberation echo estimation module, estimating the reverberation echo component in the linear echo cancellation signal according to the linear echo signal of the previous N frames to obtain a reverberation echo signal, wherein N is a positive integer; an echo suppression module, configured to determine a second suppression parameter according to the linear echo cancellation signal and the reverberation echo signal, wherein the second suppression parameter is used to suppress the reverberation echo component in the linear echo cancellation signal; The echo cancellation module is configured to process the linear echo cancellation signal according to the first suppression parameter and the second suppression parameter, and output an echo cancellation signal.
11. An electronic device, characterized in that: include: Speakers, microphones, processors, and memory; The speaker, the microphone and the memory are all communicatively connected to the processor; The memory is used to store processor executable instructions; The processor is configured to run the executable instructions to implement the steps of the echo cancellation method according to any one of claims 1 to 9.
12. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the echo cancellation method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Voice enhancement method and device based on microphone array
CN108447496A
Reverberation inhibiting system and method
CN109712637A
Processing method and device for audio signals, medium and audio interaction device
CN110491403A
Echo cancellation method and device and storage medium
CN115883736A
Echo elimination method, echo elimination device, and echo elimination program
JP2011254420A