CROSS-REFERENCE TO RELATED APPLICATIONS
-
The present disclosure claims priority to
Chinese Patent Application No. 2023106412184, filed with the China National Intellectual Property Administration on May 31, 2023 and entitled "NOISE REDUCTION METHOD AND APPARATUS, TERMINAL DEVICE, AND STORAGE MEDIUM", which is incorporated herein by reference in its entirety.
TECHNICAL FIELD
-
The present disclosure relates to the field of active noise reduction technologies, and specifically, to a noise reduction method and apparatus, a terminal device, and a storage medium.
BACKGROUND
-
In active noise reduction technologies, a secondary sound source with a same amplitude and an opposite phase as a primary noise source is emitted, to cancel and attenuate the noise, achieving noise reduction effect in a specified area.
-
In a related technology, this is implemented mainly based on a filtered-x least mean square (filtered-x least mean square, FxLMS) algorithm. In the method, long secondary path estimation is required for signal convolution calculation and filter coefficient updating, resulting in a high computation amount and imposing a high requirement on chip processing power. This reduces an operating speed of an active noise reduction system, leading to poorer noise reduction effect and affecting user experience.
SUMMARY
-
An objective of the present disclosure is to provide a noise reduction method and apparatus, a terminal device, and a storage medium. A target estimation coefficient is obtained. The target estimation coefficient and an original filtered signal are determined based on a target noise frequency. A target filtered signal is obtained by using the original filtered signal and a real part value and an imaginary part value in the target estimation coefficient. A real part value and an imaginary part value of a secondary path estimation frequency domain coefficient at the target noise frequency are selected as a secondary path model coefficient, and are used to modulate a reference signal, namely, the original filtered signal. This method can convert convolution calculation of the reference signal and secondary channel estimation into a simple operation between the reference signal and the real part value and the imaginary part value, corresponding to the target noise frequency, of the target estimation coefficient, such as a product operation. This reduces a calculation amount, improves an operating speed of an active noise reduction system, and improves noise reduction effect.
-
According to a first aspect of embodiments of the present disclosure, a noise reduction method is provided. The method includes:
- obtaining a target estimation coefficient, where the target estimation coefficient is obtained by using a target noise frequency, the target noise frequency is a frequency corresponding to target noise, and the target estimation coefficient includes a real part value and an imaginary part value;
- generating, based on the target noise frequency, an original filtered signal whose frequency is the target noise frequency; and
- obtaining a target filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient, where the target filtered signal is used to control a speaker to output a filtered acoustic signal, to perform noise reduction on the target noise.
-
Optionally, before the obtaining a target estimation coefficient, the method further includes:
- obtaining an original estimation coefficient set, where the original estimation coefficient set is obtained by modeling a secondary path, and the original estimation coefficient set includes estimation coefficients corresponding to a plurality of noise frequencies; and
- performing data transformation on an estimation coefficient corresponding to each noise frequency in the original estimation coefficient set, to obtain a target estimation coefficient set, where each estimation coefficient in the target estimation coefficient set includes a real part value and an imaginary part value; and
- determining the target estimation coefficient based on the target noise frequency includes:
obtaining an estimation coefficient corresponding to the target noise frequency in the target estimation coefficient set, to obtain the target estimation coefficient.
-
Optionally, the original filtered signal includes a sinusoidal reference signal and a phase-shifted signal; and
the generating, based on the target noise frequency, an original filtered signal whose frequency is the target noise frequency includes:
- generating, based on the target noise frequency, a sinusoidal reference signal whose frequency is the target noise frequency; and
- performing phase transformation on the sinusoidal reference signal to obtain the phase-shifted signal; and
- the obtaining a target filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient includes:
- obtaining a reference filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient;
- obtaining a target weight coefficient based on the reference filtered signal, an original error signal, and an original weight coefficient, where the original weight coefficient is a current weight coefficient of a first adaptive filtering model, and the original error signal is a residual noise signal corresponding to current residual noise detected by an error microphone; and
- obtaining the target filtered signal based on the original filtered signal and the target weight coefficient.
-
Optionally, the original filtered signal includes the sinusoidal reference signal and the phase-shifted signal, and the reference filtered signal includes a first sub-reference signal and a second sub-reference signal; and
- obtaining a reference filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient;
- multiplying the real part value in the target estimation coefficient by the sinusoidal reference signal in the original filtered signal, to obtain the first sub-reference signal; and
- multiplying the imaginary part value in the target estimation coefficient by the phase-shifted signal in the original filtered signal, to obtain the second sub-reference signal.
-
Optionally, the original weight coefficient includes a first original weight sub-coefficient, and the target weight coefficient includes a first target weight sub-coefficient;
the obtaining a target weight coefficient based on the reference filtered signal, an original error signal, and an original weight coefficient includes:
- updating the first original weight sub-coefficient based on the first sub-reference signal and the original error signal, to obtain the first target weight sub-coefficient; and
- the obtaining the target filtered signal based on the original filtered signal and the target weight coefficient includes:
- obtaining a first filtered signal based on the sinusoidal reference signal and the first target weight sub-coefficient; and
- obtaining the target filtered signal based on the first filtered signal.
-
Optionally, the original weight coefficient further includes a second original weight sub-coefficient, and the target weight coefficient further includes a second target weight sub-coefficient;
the obtaining a target weight coefficient based on the reference filtered signal, an original error signal, and an original weight coefficient includes:
- updating the second original weight sub-coefficient based on the second sub-reference signal and the original error signal, to obtain the second target weight sub-coefficient; and
- the obtaining the target filtered signal based on the original filtered signal and the target weight coefficient includes:
- obtaining a second filtered signal based on the phase-shifted signal and the second target weight sub-coefficient; and
- obtaining the target filtered signal based on the first filtered signal and the second filtered signal.
-
Optionally, an estimation coefficient corresponding to any noise frequency in the original estimation coefficient set is obtained by using the following steps:
- obtaining a modeling noise signal corresponding to the any noise frequency;
- inputting the modeling noise signal to a second adaptive filtering model to generate a modeling filtered signal;
- synthesizing the modeling noise signal and the modeling filtered signal, to obtain a modeling error signal;
- optimizing a parameter of the second adaptive filtering model based on the modeling error signal, and repeating the step of inputting the modeling noise signal to the second adaptive filtering model to generate the modeling filtered signal, until the modeling error signal meets a preset condition, to obtain a target adaptive filtering model; and
- determining a current estimation coefficient of the target adaptive filtering model as the estimation coefficient corresponding to the any noise frequency.
-
According to a second aspect of embodiments of the present disclosure, a noise reduction apparatus is provided. The apparatus includes:
- a processor, and
- a memory, configured to store instructions executable by the processor.
-
The processor is configured to perform the steps of the noise reduction method provided in the first aspect of the present disclosure.
-
According to a third aspect of embodiments of the present disclosure, a computer-readable storage medium storing a computer program is provided. When the program is executed by a processor, the steps of the noise reduction method provided in the first aspect of the present disclosure are implemented.
-
According to a fourth aspect of embodiments of the present disclosure, a terminal device is provided. The terminal device includes a speaker, an error microphone, a main unit, and the noise reduction apparatus provided in the second aspect of the present disclosure. The noise reduction apparatus is separately communicatively connected to the speaker, the error microphone, and the main unit.
-
According to the foregoing technical solutions, the target estimation coefficient is obtained, where the target estimation coefficient includes the real part value and the imaginary part value; then, the original filtered signal whose frequency is the target noise frequency is generated based on the target noise frequency; and the target filtered signal is obtained based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient; and finally, the target filtered signal is used to control a speaker to output a filtered acoustic signal, to perform noise reduction on the target noise. The real part value and the imaginary part value of the secondary path estimation frequency domain coefficient at the target noise frequency are selected as the secondary path model coefficient, and are used to modulate the reference signal, namely, the original filtered signal. This method can convert the convolution calculation of the reference signal and the secondary channel estimation into the simple operation between the reference signal and the real part value and the imaginary part value, corresponding to the target noise frequency, of the target estimation coefficient, such as the product operation. This reduces the calculation amount, improves the operating speed of the active noise reduction system, and improves the noise reduction effect.
-
Other features and advantages of the present disclosure are described in detail in the following specific implementations.
BRIEF DESCRIPTION OF DRAWINGS
-
The accompanying drawings are intended to provide a further understanding of the present disclosure, constitute a part of this specification, and are used, together with the following specific implementations, to explain the present disclosure, but do not constitute a limitation on the present disclosure. In the accompanying drawings:
- FIG. 1 is a diagram of a terminal device according to an example embodiment;
- FIG. 2 is a flowchart of a noise reduction method according to an example embodiment;
- FIG. 3 is a diagram of a plurality of secondary paths according to an example embodiment;
- FIG. 4 is a diagram of target estimation coefficients corresponding to different frequencies according to an example embodiment;
- FIG. 5 is a flowchart of a method for obtaining a target filtered signal according to an example embodiment;
- FIG. 6 is a block flowchart of a noise reduction method according to an example embodiment;
- FIG. 7 is a flowchart of determining an estimation coefficient corresponding to any noise frequency according to an example embodiment;
- FIG. 8 is an overall block flowchart of a noise reduction method according to an example embodiment; and
- FIG. 9 is a diagram of an electronic device according to an example embodiment.
DESCRIPTION OF EMBODIMENTS
-
The following describes in detail specific implementations of the present disclosure with reference to the accompanying drawings. It should be understood that the specific implementations described herein are merely used to describe and explain the present disclosure, but are not intended to limit the present disclosure.
-
Before a noise reduction method provided in an embodiment of the present disclosure is described, a terminal device provided in an embodiment of the present disclosure is first described. The terminal device may include a speaker, an error microphone, a main unit, and a noise reduction apparatus. The noise reduction apparatus is separately communicatively connected to the speaker, the error microphone, and the main unit. Optionally, terminal devices may be a plurality of types of devices, such as a vehicle, an unmanned aerial vehicle, and a ship. Optionally, FIG. 1 is a diagram of a terminal device according to an example embodiment. For example, the terminal device is a vehicle. As shown in FIG. 1, for example, a noise reduction method may be applied to the vehicle, and may perform noise reduction on noise of an engine 105 of the vehicle. The terminal device may include the engine 105 of the vehicle, a main unit 103 of the vehicle, a speaker 101, an error microphone 102, and a noise reduction controller 104. The noise reduction controller 104 may be separately communicatively connected to the speaker 101, the error microphone 102, and the main unit 103 of the vehicle. For example, the noise reduction controller 104 may be communicatively connected to the main unit 103 of the vehicle via a CAN (Controller Area Network, controller area network) bus. Noise is generated when the engine 105 operates, thereby affecting vehicle use experience of a user in the vehicle. A rotational speed of the engine 105 may be obtained by using the main unit 103 of the vehicle, and a target noise frequency at which the engine generates target noise is determined based on the rotational speed of the engine 105. Then, the main unit 103 of the vehicle sends the target noise frequency to the noise reduction controller 104, and the noise reduction controller 104 may determine a target filtered signal based on the obtained target noise frequency. The target filtered signal is sent to the speaker 101, so that the speaker 101 outputs a filtered acoustic signal based on the target filtered signal, to cancel and attenuate the target noise, achieving noise reduction effect. Residual noise obtained through noise reduction may be further obtained by using the error microphone 102, and the residual noise is transmitted to the noise reduction controller 104 through the error microphone 102. In this case, when the noise reduction controller 104 generates a target filtered signal next time, a more accurate target filtered signal is generated based on both an obtained new target noise frequency and the residual noise, to achieve better noise reduction effect. Optionally, there may be a plurality of speakers and error microphones, so that noise reduction is performed on a target location of the plurality of error microphones by using the plurality of speakers, thereby reducing overall noise in the vehicle.
-
FIG. 2 is a flowchart of a noise reduction method according to an example embodiment. FIG. 3 is a diagram of a plurality of secondary paths according to an example embodiment. FIG. 4 is a diagram of target estimation coefficients corresponding to different frequencies according to an example embodiment. As shown in FIG. 2 to FIG. 4, a method may be applied to a noise reduction apparatus, where the noise reduction apparatus may be a noise reduction controller. The method may include the following steps.
-
In step S201, a target estimation coefficient is obtained, where the target estimation coefficient is obtained by using a target noise frequency, the target noise frequency is a frequency corresponding to target noise, and the target estimation coefficient includes a real part value and an imaginary part value.
-
In this implementation, the target estimation coefficient corresponding to the target noise frequency may be obtained from a predetermined target estimation coefficient set. The target estimation coefficient set is obtained by performing data transformation on an original estimation coefficient set that is obtained in advance by modeling a secondary path. The original estimation coefficient set includes estimation coefficients corresponding to a plurality of noise frequencies, and each noise frequency may correspond to estimation coefficients of a plurality of secondary paths. This data transformation method may be Fourier transformation. Each estimation coefficient in the original target estimation set obtained through transformation is an imaginary number, and each estimation coefficient includes a real part value and an imaginary part value. In this case, the obtained target estimation coefficient also includes a real part value and an imaginary part value. The real part value is a value corresponding to a real part value of the target estimation coefficient, and the imaginary part value is a value corresponding to an imaginary part value of the target estimation coefficient. The target estimation coefficient is an estimation coefficient corresponding to a target secondary path. The target noise may be noise emitted by a target noise source. For example, the target noise source may be an engine, and the target noise is noise generated by the engine. For the engine of the vehicle, a target noise frequency corresponding to target noise may be determined by obtaining a vehicle speed of the vehicle. Alternatively, the target noise may be directly measured, and the target noise may be analyzed to obtain the corresponding target noise frequency.
-
In step S202, an original filtered signal whose frequency is the target noise frequency is generated based on the target noise frequency.
-
In this implementation, the original filtered signal whose frequency is the same as the target noise frequency may be generated based on the target noise frequency by using a sine wave generator.
-
In step S203, a target filtered signal is obtained based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient, where the target filtered signal is used to control a speaker to output a filtered acoustic signal, to perform noise reduction on the target noise.
-
In this implementation, the target estimation coefficient is the estimation coefficient corresponding to the target secondary path, and the target estimation coefficient is an imaginary number, including the real part value and the imaginary part value. Therefore, a weight coefficient of an adaptive filtering model is adjusted based on a product of the original filtered signal and the target estimation coefficient, to obtain the target filtered signal. Convolution calculation of a reference signal and secondary channel estimation is converted into a simple operation between the reference signal and the real part value and the imaginary part value, corresponding to the target noise frequency, of the target estimation coefficient, such as a product operation. This reduces a calculation amount, and improves a generation rate of the target filtered signal.
-
Optionally, after the target filtered signal is obtained, the speaker may be controlled to output a filtered acoustic signal corresponding to the target filtered signal. The filtered acoustic signal can cancel and attenuate the target noise, to perform noise reduction on the target noise. For example, the target filtered signal may be sent to the speaker, so that the speaker outputs the filtered acoustic signal based on the target filtered signal.
-
As shown in FIG. 3, when there are a plurality of speakers, a target speaker corresponding to the target secondary path may be controlled to output a filtered acoustic signal. The target secondary path is a secondary path between the target speaker and a target error microphone, and a location of the target error microphone represents a target location at which noise reduction needs to be performed. One secondary path may be established between one speaker and one error microphone. There are a total of l×m secondary paths Ŝlm in the figure.
-
In a possible implementation, before the obtaining a target estimation coefficient, the method further includes: obtaining an original estimation coefficient set, where the original estimation coefficient set is obtained by modeling a secondary path, and the original estimation coefficient set includes estimation coefficients corresponding to a plurality of noise frequencies; and performing data transformation on an estimation coefficient corresponding to each noise frequency in the original estimation coefficient set, to obtain a target estimation coefficient set, where each estimation coefficient in the target estimation coefficient set includes a real part value and an imaginary part value.
-
In this implementation, the original estimation coefficient set may be obtained in advance by modeling the secondary path, and the original estimation coefficient set includes the estimation coefficients corresponding to the plurality of noise frequencies. For example, if a noise frequency range of the engine of the vehicle is 50 hertz to 200 hertz, an estimation coefficient corresponding to each hertz in the range of 50 hertz to 200 hertz may be established. When there are a plurality of speakers and error microphones, a plurality of secondary paths may be established, and one secondary path may be established between one speaker and one error microphone. Each secondary path corresponds to one estimation coefficient. In this case, each noise frequency may correspond to a plurality of secondary paths, that is, each noise frequency may correspond to a plurality of estimation coefficients.
-
After the original estimation coefficient set is obtained, Fourier transformation may be performed on the estimation coefficient corresponding to each noise frequency in the original estimation coefficient set, to obtain the target estimation coefficient set. The estimation coefficient becomes an imaginary number after Fourier transformation, and each estimation coefficient in the target estimation coefficient set includes a corresponding real part value and imaginary part value.
-
After the target estimation coefficient set is obtained, based on the target noise frequency, an estimation coefficient corresponding to a noise frequency that is the same as the target noise frequency may be searched for in the target estimation coefficient set, to obtain the target estimation coefficient. The target estimation coefficient may be estimation coefficients corresponding to a plurality of secondary paths corresponding to the noise frequency.
-
According to the foregoing method, after the original estimation coefficient set is obtained by modeling the secondary path, Fourier transformation is performed on each estimation coefficient in the original estimation coefficient set, so that each estimation coefficient obtained through transformation includes a real part value and an imaginary part value. In this case, the convolution calculation of the reference signal and the secondary channel estimation is converted into the simple operation between the reference signal and the real part value and the imaginary part value, corresponding to the target noise frequency, of the target estimation coefficient. This can improve a calculation speed.
-
FIG. 5 is a flowchart of a method for obtaining a target filtered signal according to an example embodiment. FIG. 6 is a block flowchart of a noise reduction method according to an example embodiment. As shown in FIG. 5 and FIG. 6, in a possible implementation, before the obtaining a target filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient, an original weight coefficient and an original error signal may be further obtained. The original weight coefficient is a current weight coefficient of a first adaptive filtering model, and the original error signal is a residual noise signal corresponding to current residual noise detected by an error microphone. In this case, the target filtered signal is obtained with reference to the original weight coefficient and the original error signal.
-
Optionally, when there are the plurality of speakers and error microphones, that is, when there are the plurality of secondary paths, a target filtered signal of each secondary path may be calculated, to further determine a target filtered signal corresponding to each speaker. The original weight coefficient may be a current weight coefficient of the first adaptive filtering model in the target secondary path. The original error signal is a residual noise signal corresponding to current residual noise detected by an error microphone in the target secondary path.
-
The obtaining a target filtered signal based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient may include the following steps.
-
In step S501, a reference filtered signal is obtained based on the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient.
-
In this implementation, in an entire process, the target noise frequency continuously changes in real time, target noise of different frequencies is generated, a target noise frequency may be continuously obtained, and an iteration is performed to generate a target filtered signal corresponding to each obtained target noise frequency. In this way, the generated target filtered signal can change with the target noise, thereby achieving better noise reduction effect. The reference filtered signal may be obtained based on a product of the original filtered signal and the real part value and the imaginary part value in the target estimation coefficient. An ordinal number of obtaining the target noise frequency may be denoted by n, that is, n may represent a quantity of iterations.
-
In a possible implementation, to facilitate obtaining the target filtered signal through calculation, the original filtered signal may include a sinusoidal reference signal and a phase-shifted signal.
-
Optionally, a method for generating the original filtered signal whose frequency is the target noise frequency based on the target noise frequency may be: generating, based on the target noise frequency, a sinusoidal reference signal whose frequency is the target noise frequency; and performing phase transformation on the sinusoidal reference signal to obtain the phase-shifted signal.
-
In this implementation, the sinusoidal reference signal whose frequency is the same as the target noise frequency may be generated based on the target noise frequency by using a sine wave generator. Two sinusoidal reference signals, namely, a first sinusoidal reference signal and a second sinusoidal reference signal, may be generated. The first sinusoidal reference signal is retained, and phase transformation is performed on the second sinusoidal reference signal, to obtain the phase-shifted signal. A 90-degree phase shift may be performed on the second sinusoidal reference signal to obtain a phase-shifted signal.
-
An expression of the sinusoidal reference signal may be: x0(n) = A1 sin 2πft.
-
An expression of the phase-shifted signal may be: x1(n) = A2 cos 2πft.
-
x0(n) is a sinusoidal reference signal, x1(n) is the phase-shifted signal, A1 and A2 are both empirical parameters, and may be set based on an actual situation, f is the target noise frequency, and t is time.
-
In a possible implementation, the reference filtered signal includes a first sub-reference signal and a second sub-reference signal. Optionally, the real part value in the target estimation coefficient is multiplied by the sinusoidal reference signal in the original filtered signal, to obtain the first sub-reference signal; and the imaginary part value in the target estimation coefficient is multiplied by the phase-shifted signal in the original filtered signal, to obtain the second sub-reference signal.
-
In this implementation, the reference filtered signal may be obtained based on a product of the original filtered signal and the target estimation coefficient. This reduces a calculation amount.
-
For example, a calculation formula of the first sub-reference signal may be:
-
A calculation formula of the second sub-reference signal may be:
-
x0f(n) is the first sub-reference signal, x1f(n) is the second sub-reference signal, is the real part value in the target estimation coefficient, and is the imaginary part value in the target estimation coefficient.
-
In step S502, a target weight coefficient is obtained based on the reference filtered signal, the original error signal, and the original weight coefficient.
-
In this implementation, the original weight coefficient may include a first original weight sub-coefficient and a second original weight sub-coefficient, and the target weight coefficient may include a first target weight sub-coefficient and a second target weight sub-coefficient. Optionally, the first original weight sub-coefficient may be updated based on the first sub-reference signal and the original error signal, to obtain the first target weight sub-coefficient; the second original weight sub-coefficient is updated based on the second sub-reference signal and the original error signal, to obtain the first target weight sub-coefficient. During each iteration, the target filtered signal is obtained based on a weight coefficient of a previous iteration with reference to the original error signal. The first original weight sub-coefficient in a current iteration is the first target weight sub-coefficient, corresponding to the first sub-reference signal, obtained in the previous iteration. The second original weight sub-coefficient is the second target weight sub-coefficient, corresponding to the second sub-reference signal, obtained in the previous iteration.
-
For example, a calculation formula of the first target weight sub-coefficient may be:
-
A calculation formula of the second target weight sub-coefficient may be:
-
w0(n) is the first original weight sub-coefficient, w0(n + 1) is the first target weight sub-coefficient, µ is a step size, e(n) is the original error signal, x0f(n) is the first sub-reference signal, w1(n) is the first original weight sub-coefficient, w1(n + 1) is the first target weight sub-coefficient, µ is the step size, e(n) is the original error signal, x1f(n) is the first sub-reference signal, and n is the ordinal number of obtaining the target noise frequency.
-
Optionally, when there are the plurality of secondary paths, each secondary path may have a corresponding weight coefficient, so that each secondary path may obtain a corresponding target weight coefficient by using the foregoing method. The original error signal is a residual noise signal detected by an error microphone corresponding to the secondary path.
-
In step S503, the target filtered signal is obtained based on the original filtered signal and the target weight coefficient.
-
In this implementation, the original filtered signal may be adjusted based on the target weight coefficient, to obtain the target filtered signal.
-
For example, a calculation formula of the target filtered signal may be: u(n) is the target filtered signal.
-
Optionally, when there are the plurality of secondary paths, u(n) is a target filtered signal corresponding to one of the secondary paths. According to the foregoing method, target filtered signals corresponding to all secondary paths that correspond to each speaker may be determined, and a final target filtered signal corresponding to each speaker is determined based on the target filtered signals corresponding to all the secondary paths that correspond to each speaker. For any speaker, a final target filtered signal corresponding to the speaker may be any signal in all target filtered signals corresponding to the speaker, or an average signal of all the target filtered signals corresponding to the speaker.
-
In a possible implementation, the original weight coefficient includes a first original weight sub-coefficient, and the target weight coefficient includes a first target weight sub-coefficient.
-
A method for obtaining the target weight coefficient based on the reference filtered signal, the original error signal, and the original weight coefficient may be: updating the first original weight sub-coefficient based on the first sub-reference signal and the original error signal, to obtain the first target weight sub-coefficient.
-
Further, a method for obtaining the target filtered signal based on the original filtered signal and the target weight coefficient may be: obtaining a first filtered signal based on the sinusoidal reference signal and the first target weight sub-coefficient; and obtaining the target filtered signal based on the first filtered signal.
-
FIG. 7 is a flowchart of determining an estimation coefficient corresponding to any noise frequency according to an example embodiment. As shown in FIG. 7, in a possible implementation, obtaining an estimation coefficient corresponding to any noise frequency in the original estimation coefficient set in advance by modeling the secondary path may include the following steps.
-
In step S701, a modeling noise signal corresponding to the any noise frequency is obtained.
-
In this implementation, a corresponding estimation coefficient may be established for each noise frequency. If there are the plurality of speakers and error microphones, the plurality of secondary paths may be established, and a corresponding estimation coefficient may be further established for each secondary path at each noise frequency. A white noise signal of the any noise frequency generated by using a white noise generator to drive the speakers may be used as modeling noise, to obtain the modeling noise signal corresponding to the any noise frequency.
-
In step S702, the modeling noise signal is input to a second adaptive filtering model to generate a modeling filtered signal.
-
In step S703, the modeling noise signal and the modeling filtered signal are synthesized to obtain a modeling error signal.
-
In this implementation, the modeling filtered signal is used to attenuate the modeling noise signal, and the modeling noise signal and the modeling filtered signal are synthesized to obtain the synthesized modeling error signal. The modeling error signal is a sum of the modeling filtered signal and the modeling noise signal.
-
In step S704, a parameter of the second adaptive filtering model is optimized based on the modeling error signal, and the step of inputting the modeling noise signal to the second adaptive filtering model to generate the modeling filtered signal is repeated, until the modeling error signal meets a preset condition, to obtain a target adaptive filtering model.
-
In this implementation, the parameter of the second adaptive filtering model is optimized based on the modeling error signal, and the step S702 is repeated, to re-input the modeling noise signal to the optimized second adaptive filtering model to obtain a new modeling filtered signal. In this way, the modeling filtered signal output by the second adaptive filtering model can be closer to the modeling noise signal, until the modeling error signal meets the preset condition. For example, a value of the error signal may be determined, and the value of the error signal may be a value between 0 and 1. In addition, whether the target adaptive filtering model is obtained may be determined based on a relationship between the value of the error signal and a preset distance. For example, when the value of the error signal is less than or equal to the preset distance, it is determined that the target adaptive filtering model is obtained. The preset distance may be 0 or 0.1. The target adaptive filtering model is obtained by training the second adaptive filtering model by using the modeling noise signal corresponding to the any noise frequency. For example, a target noise signal is used to train the second adaptive filtering model, to obtain a target adaptive filtering model corresponding to the target noise signal, namely, the first adaptive filtering model. The second adaptive filtering model is separately trained by using modeling noise signals of different noise frequencies, to obtain target adaptive filtering models corresponding to the noise signals of different noise frequencies, and estimation coefficients corresponding to the plurality of noise frequencies are further obtained based on the target adaptive filtering models corresponding to the noise signals of the different noise frequencies, to obtain the original estimation coefficient set. For example, the target estimation coefficient may be obtained by using the target adaptive filtering model corresponding to the target noise signal of the target noise frequency.
-
In step S705, a current estimation coefficient of the target adaptive filtering model is determined as the estimation coefficient corresponding to the any noise frequency.
-
In this implementation, a corresponding modeling filtered signal that meets the preset condition may be obtained based on the current estimation coefficient of the target adaptive filtering model. When there are the plurality of secondary paths, according to the method in this embodiment, an estimation coefficient corresponding to one secondary path at the any noise frequency is obtained, and an estimation coefficient corresponding to a secondary path at another frequency may be obtained by using the same method, and the original estimation coefficient set is finally obtained.
-
FIG. 8 is an overall block flowchart of a noise reduction method according to an example embodiment. As shown in FIG. 8, optionally, the noise reduction method may include the following steps.
-
In step S801, a speaker is driven to emit modeling noise based on a modeling noise signal of any frequency.
-
In step S802, an error microphone collects a modeling noise signal played by the speaker.
-
In step S803, a modeling filtered signal is generated by using a second adaptive filtering model.
-
In step S804, the modeling noise signal and the modeling filtered signal are synthesized to obtain a modeling error signal.
-
In step S805, it is determined whether the modeling error signal meets a preset condition, and if the modeling error signal does not meet the preset condition, step S806 is performed, or if the modeling error signal meets the preset condition, step S807 is performed.
-
In step S806, an original weight coefficient is updated to obtain a target weight coefficient.
-
In step S807, a current estimation coefficient of the target adaptive filtering model is determined as the estimation coefficient corresponding to the any noise frequency, and Fourier transformation is performed on the current estimation coefficient.
-
In step S808, an engine is started and a noise reduction system is activated.
-
In step S809, a main unit obtains rotational speed information of the engine, obtains a target noise frequency, and sends the target noise frequency to a sine wave generator.
-
In step S810, the sine wave generator generates a sinusoidal reference signal and a phase-shifted signal.
-
In step S811, the sinusoidal reference signal and the phase-shifted signal are multiplied by a real part value and an imaginary part value in a target estimation coefficient respectively, to obtain a reference filtered signal.
-
In step S812, the reference filtered signal and the original error signal are input to a first adaptive filtering model to obtain a target filtered signal.
-
In step S813, the speaker outputs a filtered acoustic signal based on the target filtered signal, where the filtered acoustic signal is used to perform noise reduction on target noise.
-
In step S814, an error signal is collected by using the error microphone, and step S812 is repeated.
-
FIG. 9 is a diagram of an electronic device according to an example embodiment. For example, the electronic device 900 may be provided as a noise reduction apparatus, where the noise reduction apparatus may be a noise reduction controller. Refer to FIG. 9. The electronic device 900 includes one or more processors 922, and a memory 932 that is configured to store a computer program that can be executed by the processor 922. The computer program stored in the memory 932 may include one or more modules, each corresponding to a group of instructions. In addition, the processor 922 may be configured to execute the computer program, to perform the foregoing noise reduction method.
-
Preferably, the electronic device 900 may further include a power supply component 926 and a communication component 950. The power supply component 926 may be configured to perform power management of the electronic device 900. The communication component 950 may be configured to implement communication of the electronic device 900, for example, wired or wireless communication. Preferably, the electronic device 900 may further include an input/output interface 958. The electronic device 900 may operate based on an operating system stored in the memory 932.
-
In another example embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by the processor, the steps of the foregoing noise reduction method are implemented. For example, the computer-readable storage medium may be the memory 932 including the program instructions, and the program instructions may be executed by the processor 922 of the electronic device 900 to complete the foregoing noise reduction method.
-
In another example embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable apparatus. The computer program includes a code portion that may be used to perform the foregoing noise reduction method when executed by the programmable apparatus.
-
The foregoing describes preferred implementations of the present disclosure in detail with reference to the accompanying drawings. However, the present disclosure is not limited to specific details in the foregoing implementations. Within the technical concept scope of the present disclosure, a plurality of simple variations may be made to the technical solutions of the present disclosure, and all these simple variations fall within the protection scope of the present disclosure.
-
In addition, it should be noted that the specific technical features described in the foregoing specific implementations may be combined in any appropriate manner when there is no contradiction. To avoid unnecessary repetition, various possible combination manners are not separately described in the present disclosure.
-
In addition, different implementations of the present disclosure may be randomly combined, and should also be considered as disclosed in the present disclosure, provided that such combinations do not depart from the idea of the present disclosure.