CN112769410A - Filter construction method, audio processing method, electronic equipment and storage device - Google Patents

Filter construction method, audio processing method, electronic equipment and storage device Download PDF

Info

Publication number
CN112769410A
CN112769410A CN202011565847.6A CN202011565847A CN112769410A CN 112769410 A CN112769410 A CN 112769410A CN 202011565847 A CN202011565847 A CN 202011565847A CN 112769410 A CN112769410 A CN 112769410A
Authority
CN
China
Prior art keywords
frequency
target
gain
sample
filter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011565847.6A
Other languages
Chinese (zh)
Inventor
高素云
付中华
王海坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Xunfei Super Brain Information Technology Co ltd
Original Assignee
Xi'an Xunfei Super Brain Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xi'an Xunfei Super Brain Information Technology Co ltd filed Critical Xi'an Xunfei Super Brain Information Technology Co ltd
Priority to CN202011565847.6A priority Critical patent/CN112769410A/en
Publication of CN112769410A publication Critical patent/CN112769410A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03GCONTROL OF AMPLIFICATION
    • H03G5/00Tone control or bandwidth control in amplifiers

Abstract

The application discloses a filter construction method, an audio processing method, electronic equipment and a storage device, wherein the filter construction method comprises the following steps: mapping the expected gains corresponding to the frequency bands respectively by using a preset mapping relation to obtain target gains corresponding to frequencies in the frequency bands; the preset mapping relation represents a mapping relation between at least one of the expected gain of the frequency band and the frequency in the frequency band and the target gain of the target filter; obtaining a target amplitude-frequency response of a target filter based on target gains corresponding to frequencies in a plurality of frequency bands; and performing phase alignment by using the target amplitude-frequency response to obtain a target filter. By the scheme, the calculation amount of the filter can be reduced, and the real-time performance of the filter is improved.

Description

Filter construction method, audio processing method, electronic equipment and storage device
Technical Field
The present application relates to the field of signal processing technologies, and in particular, to a filter construction method, an audio processing method, an electronic device, and a storage device.
Background
The signal processing technology has wide application in various fields such as communication, sound effect and the like. Here, an Equalizer (Equalizer) is used as a filter for equalizing the amplitude-frequency characteristics, and by independently boosting or attenuating signals of respective frequency bands, different effects such as compensation, sound modification, and the like can be created. In a common music Player such as Windows Media Player, a Graphic Equalizer (GEQ) is usually integrated as a filter to equalize the amplitude-frequency characteristics of music, thereby realizing different auditory effects.
Currently, GEQ is usually implemented in a digital manner, such as FIR (Finite Impulse Response), IIR (Infinite Impulse Response), and the like. However, in order to improve accuracy, the order of the digital filter such as FIR, IIR, etc. is usually required to be increased, which results in a great increase in the amount of operations and a great decrease in real-time performance. In view of the above, how to reduce the computation amount of the acquisition filter and improve the real-time performance of the acquisition filter is an urgent problem to be solved.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a filter construction method, an audio processing method, an electronic device and a storage device, which can reduce the calculation amount for obtaining the filter and improve the real-time property for obtaining the filter.
In order to solve the above problem, a first aspect of the present application provides a filter construction method, including: mapping the expected gains corresponding to the frequency bands respectively by using a preset mapping relation to obtain target gains corresponding to frequencies in the frequency bands; the preset mapping relation represents a mapping relation between at least one of the expected gain of the frequency band and the frequency in the frequency band and the target gain of the target filter; obtaining a target amplitude-frequency response of a target filter based on target gains corresponding to frequencies in a plurality of frequency bands; and performing phase alignment by using the target amplitude-frequency response to obtain a target filter.
In order to solve the above problem, a second aspect of the present application provides an audio processing method, including: acquiring expected gains corresponding to the audio to be processed and a plurality of frequency bands respectively; processing the audio to be processed by using a target filter matched with the expected gain to obtain a target audio; wherein the target filter is obtained by using the filter construction method in the first aspect.
In order to solve the above problem, a third aspect of the present application provides an electronic device, which includes a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is configured to execute the program instructions to implement the filter construction method in the first aspect or implement the audio processing method in the second aspect.
In order to solve the above problem, a fourth aspect of the present application provides a storage device storing program instructions executable by a processor, the program instructions being for implementing the filter construction method in the above first aspect or implementing the audio processing method in the above second aspect.
In the scheme, the expected gains corresponding to a plurality of frequency bands are mapped by utilizing the preset mapping relation to obtain the target gains corresponding to the frequencies in the frequency bands, and the predetermined mapping relationship represents a mapping relationship between at least one of a desired gain of a band, a frequency within the band, and a target gain of the target filter, thereby obtaining the target amplitude-frequency response of the target filter based on the target gain corresponding to the frequency in a plurality of frequency bands, further, phase compensation is performed by using the target amplitude-frequency response to obtain a target filter, so that target gains corresponding to frequencies in a plurality of frequency bands are obtained based on a preset mapping relation, then obtaining the target amplitude-frequency response on the basis, and carrying out phase compensation on the target amplitude-frequency response, the target filter can be quickly obtained only by simple mathematical function processing, so that the operation amount of the obtained filter can be reduced, and the real-time performance of the obtained filter is improved.
Drawings
FIG. 1 is a schematic flow chart diagram of an embodiment of a filter construction method of the present application;
FIG. 2 is a schematic diagram of an embodiment of a GEQ;
FIG. 3 is a schematic diagram of one embodiment of a target amplitude-frequency response;
FIG. 4 is a schematic diagram of one embodiment of an IIR filter amplitude frequency response;
FIG. 5 is a schematic diagram of an embodiment of a minimum phase shift sequence;
FIG. 6 is a schematic diagram of one embodiment of an actual amplitude-frequency response;
FIG. 7 is a schematic diagram of one embodiment of an actual phase frequency response;
FIG. 8 is a flowchart illustrating an embodiment of step S11 in FIG. 1;
FIG. 9 is a flowchart illustrating an embodiment of obtaining a predetermined number;
FIG. 10 is a schematic flowchart of an embodiment of an audio processing method of the present application;
FIG. 11 is a schematic diagram of an embodiment of pending audio;
FIG. 12 is a schematic diagram of an embodiment of target audio after being processed by a target filter;
FIG. 13 is a diagram of one embodiment of target audio after cooledit processing;
FIG. 14 is a block diagram of an embodiment of an electronic device of the present application;
FIG. 15 is a block diagram of an embodiment of a memory device according to the present application.
Detailed Description
The following describes in detail the embodiments of the present application with reference to the drawings attached hereto.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, interfaces, techniques, etc. in order to provide a thorough understanding of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the term "plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a filter construction method according to an embodiment of the present application. Specifically, the method may include the steps of:
step S11: and mapping the expected gains corresponding to the plurality of frequency bands respectively by using a preset mapping relation to obtain target gains corresponding to the frequencies in the plurality of frequency bands.
In an implementation scenario, the plurality of frequency bands may specifically be required according to practical applicationsA setup is to be made. For example, in the case where the embodiment of the present disclosure is applied to the GEQ, the several frequency bands may be specifically set according to the kind of the GEQ. As for ten-segment GEQ, the several frequency segments may include: center frequency fc 1Frequency band 1 (i.e., 20Hz to 60Hz) of 31Hz, center frequency fc 2 Frequency band 2 of 62Hz (i.e. 60Hz to 100Hz), center frequency fc 3Frequency band 3 (i.e. 100Hz to 150Hz) of 125Hz, center frequency fc 4Frequency band 4 (i.e. 150Hz to 300Hz) of 250Hz, center frequency fc 5 A frequency band 5 of 500Hz (i.e. 300Hz to 500Hz), a center frequency fc 6Frequency band 6 (i.e. 1kHz to 2kHz) of 1kHz, center frequency fc 7Frequency band 7 of 2kHz (i.e. 2kHz to 3kHz), center frequency fc 8Frequency band 8 (i.e. 8kHz to 10kHz) of 4kHz, center frequency fc 9Frequency band 9 (i.e. 8kHz to 10kHz) of 8kHz, center frequency fc 10 A frequency band 10 of 16kHz (i.e., 10kHz to 20 kHz). Under the conditions of twenty sections of GEQ, thirty sections of GEQ, and the like, the setting modes of the plurality of frequency bands are not described herein again.
In one implementation scenario, the desired gains corresponding to the frequency bands may be specifically set by a user. For example, the user may enter a specific numerical value of the desired gain via a keyboard; alternatively, the user may select a specific value of the desired gain by using a mouse. Still taking GEQ as an example, please refer to fig. 2 in combination, and fig. 2 is a schematic diagram of an embodiment of GEQ. Fig. 2 is a schematic diagram of an embodiment of the ten-stage GEQ. As shown in fig. 2, a push rod for setting a desired gain is provided below each center frequency, and a user may control the push rod to be adjusted up or down by dragging with a mouse or by using keyboard keys (e.g., ↓) so as to set the corresponding desired gain. In the case of twenty-segment GEQ, thirty-segment GEQ, and the like, the specific setting method of the desired gain may be analogized, and no one example is given here.
In one implementation scenario, the desired gains for several frequency bands may be set to be the same. For example, as shown in FIG. 2, the desired gains for several frequency bands may each be set to 0 dB. In addition, the values may be set to 10dB, 20dB, and the like, which is not limited herein. Or, the expected gains corresponding to the frequency bands may also be set to be completely different, that is, the expected gain corresponding to any frequency band is different from the expected gains corresponding to other frequency bands; or, the expected gains corresponding to the several frequency bands may also be set to be not completely the same, that is, there are at least two frequency bands whose corresponding expected gains are the same, and there are at least two frequency bands whose corresponding expected gains are different. The setting may be specifically performed according to the actual needs of the user, and is not limited herein.
In the embodiment of the present disclosure, the preset mapping relationship represents a mapping relationship between at least one of a desired gain of a frequency band and an in-band frequency and a target gain of a target filter. For example, the preset mapping relationship may represent a mapping relationship between a desired gain of a frequency band and a target gain of a target filter; alternatively, the preset mapping relationship may also represent a mapping relationship between the desired gain of the frequency band, the frequency within the frequency band, and the target gain of the target filter, which is not limited herein.
In an implementation scenario, the plurality of frequency bands may specifically include a first frequency band located at a head, a second frequency band located at a tail, and at least one third frequency band located between the first frequency band and the second frequency band after being sorted in a descending order. In the above manner, the preset mapping relations respectively corresponding to the first frequency band located at the head, the second frequency band located at the tail and the third frequency band located therebetween are set to be different from each other, so that the setting of the preset mapping relations adapted to the frequency characteristics of the different frequency bands can be facilitated, and the accuracy of the preset mapping relations can be improved.
In another implementation scenario, in order to further improve the accuracy of the preset mapping relationship, the preset mapping relationships corresponding to the frequency bands may be different, that is, each frequency band is correspondingly provided with the corresponding preset mapping relationship, and the preset mapping relationships corresponding to each frequency band may be different.
In an implementation scenario, the preset mapping relationship may be obtained by data fitting. Specifically, an audio editing tool such as cooledit may be used to set the first gain value G1 at the frequency f in several frequency bands to obtain the second gain value G2 output by the audio editing tool, so that the frequency f, the first gain value G1, and the second gain value G2 may be used as a set of data to be fitted. By analogy, by changing the frequency f or any one of the first gain values G1, the corresponding second gain value G2 can be obtained, so that a plurality of sets of data to be fitted can be obtained by the above method. On this basis, the frequency f and the first gain value G1 may be used as independent variables, and the second gain value G2 may be used as dependent variables for fitting, so as to obtain the preset mapping relationship.
In an implementation scenario, a plurality of sampling frequencies may be selected from a plurality of frequency bands, and a target gain of the sampling frequency may be obtained by using a preset mapping relationship corresponding to the frequency band in which the sampling frequency is located. Still taking the above ten-segment GEQ as an example, several sampling frequencies can be selected in the frequency band 1, such as: 31Hz, 32Hz, 33Hz, 34Hz, … …, 60Hz, etc.; and selecting a plurality of sampling frequencies in the preset frequency band 2, such as: 60Hz, 61Hz, 62Hz, 63Hz, … …, 100Hz, etc., and so on, the sampling frequency is selected, for example, in the frequency band 3 to the frequency band 10, which is not illustrated here. On this basis, the sampling frequency selected in the frequency band 1 and the expected gain of the frequency band 1 can be mapped respectively by using the preset mapping relation corresponding to the frequency band 1, so as to obtain target gains corresponding to the sampling frequency in the frequency band 1 respectively; and mapping the sampling frequency selected in the frequency band 2 and the expected gain of the frequency band 2 by using a preset mapping relation corresponding to the frequency band 2 to obtain target gains corresponding to the sampling frequency in the frequency band 2 respectively, and so on, so as to obtain the target gains corresponding to the sampling frequencies in the frequency bands 3 to 10 respectively. Other cases may be analogized, and no one example is given here.
Step S12: and obtaining the target amplitude-frequency response of the target filter based on the target gain corresponding to the frequency in the plurality of frequency bands.
Specifically, the target gains corresponding to the frequencies and the frequencies may be used as a group of data to be fitted, the frequencies in a plurality of frequency bands are used as independent variables, and the target gains corresponding to the frequencies are used as dependent variables, so that the data to be fitted are fitted to obtain a target amplitude-frequency response of the target filter.
Still taking ten segments of GEQ as an example, the expected gains corresponding to the frequency bands 1 to 10 may all be set to 10dB, and after mapping the expected gains corresponding to the ten segments of frequency bands by using the preset mapping relationship, the target gain corresponding to the frequency in the 10 segments of frequency bands may be obtained. On the basis, the target gain corresponding to the frequency and the frequency in the 10-segment frequency band is fitted, so that the target amplitude-frequency response of the target filter can be obtained. In one specific implementation scenario, please refer to fig. 3 in combination, and fig. 3 is a schematic diagram of an embodiment of a target amplitude-frequency response. Specifically, the target amplitude-frequency response shown in fig. 3 is a target amplitude-frequency response of the target filter after ten segments of GEQ frequency bands are all set to 10 dB. As shown in fig. 3, the target amplitude-frequency response substantially matches the desired gain.
In contrast, referring to fig. 4, fig. 4 is a schematic diagram of an embodiment of the IIR filter amplitude-frequency response. The IIR filter is 16 th order, and as shown in fig. 4, when the IIR filter is designed, the amplitude-frequency response thereof generates ripples in a high frequency part (for example, about 10kHz in fig. 4), and an error of about 10dB at the highest is generated. Therefore, the expected gains corresponding to the plurality of frequency bands are mapped through the preset mapping relation, and the accuracy of the finally obtained target amplitude-frequency response can be obviously improved.
Step S13: and performing phase alignment by using the target amplitude-frequency response to obtain a target filter.
Specifically, a preset number of groups of discrete data can be selected based on the target amplitude-frequency response, and each group of discrete data includes frequency and target gain thereof, so that the preset number of groups of discrete data can be processed in a preset phase compensation mode to obtain the target filter. The preset phase compensation method may include, but is not limited to: minimum phase alignment, linear phase alignment, etc., and are not limited herein.
In one implementation scenario, the phase alignment of the target amplitude-frequency response with the minimum phase alignment is taken as an example. Real minimum phase shift sequence and its complex cepstrum in time domain
Figure BDA0002861721770000061
Can be expressed as even sequences
Figure BDA0002861721770000062
And odd sequence
Figure BDA0002861721770000063
Sum, and complex cepstrum
Figure BDA0002861721770000064
Can be composed of even sequences
Figure BDA0002861721770000065
Complete recovery, or, when n ≠ 0, by odd sequences
Figure BDA0002861721770000066
And (4) completely recovering. In addition, even sequences are based on Fourier transform parity virtuality, even sequence
Figure BDA0002861721770000071
By Discrete Fourier Transform (DFT) to the real part
Figure BDA0002861721770000072
Singular sequence
Figure BDA0002861721770000073
After discrete Fourier transform, as imaginary part
Figure BDA0002861721770000074
The target amplitude-frequency response obtained in step S12 and the predetermined number of sets of discrete data can be regarded as the real part of the frequency response of the target filter in the frequency domain
Figure BDA0002861721770000075
Therefore, in order to improve the processing efficiency, the predetermined number of discrete data sets may be processed by IFFT (inverse Fast Fourier transform)Obtaining even sequences
Figure BDA0002861721770000076
Reuse of even sequences
Figure BDA0002861721770000077
Recovering to obtain complex cepstrum
Figure BDA0002861721770000078
Due to the complex cepstrum
Figure BDA0002861721770000079
The minimum phase shift sequence h (n) corresponding to the target filter is a reciprocal spectrum sequence, so that the complex cepstrum can be obtained by the following formula
Figure BDA00028617217700000710
Converting to obtain the minimum phase shift sequence h (n) corresponding to the target filter:
Figure BDA00028617217700000711
as shown in the above formula (1), the complex cepstrum may be specifically processed first
Figure BDA00028617217700000712
And performing fast Fourier transform to convert the complex cepstrum into a frequency domain, and converting the complex cepstrum converted into the frequency domain into an expression form of an index e, so that the complex cepstrum can be converted into a time domain by utilizing inverse fast Fourier transform, and a minimum phase shift sequence h (n) corresponding to the target filter is obtained. It can be seen that the phase-frequency response of the target filter can be compensated by minimum phase compensation on the basis of the target amplitude-frequency response of the target filter.
In another implementation scenario, the preset phase compensation mode may also be a linear phase compensation mode, and the specific process is not described herein again.
In another implementation scenario, the preset number may be specifically set according to the actual application requirement, for example, the preset number may be set to 512, 1024, 2048, 4096, and the like, which is not limited herein. In addition, in order to further reduce the computation amount on the premise of improving the accuracy of the target filter, the preset number may also be obtained by analyzing a plurality of candidate numbers, which may be referred to in the following embodiments and will not be described herein again.
In another implementation scenario, in the process of selecting the preset number of discrete data sets, the discrete data may be selected according to a frequency interval step matching the preset number, that is, one discrete data may be sampled per interval step. The specific manner of acquiring the frequency interval step may refer to the related description in the following disclosed embodiments, and is not repeated herein.
In a specific implementation scenario, after obtaining the minimum phase shift sequence h (n) corresponding to the target filter, the minimum phase shift sequence h (n) may be further converted into a frequency domain by using fourier transform, so that the frequency response of the target filter may be obtained, which may be denoted as h (w) for convenience of description. The frequency response h (w) can be expressed as:
Figure BDA0002861721770000081
in the above formula (2), a (w) represents the actual amplitude-frequency response of the target filter,
Figure BDA0002861721770000082
representing the actual phase-frequency response of the target filter. Still taking the above ten sections of GEQ as an example, the 2048 sets of discrete data selected from the target amplitude-frequency response shown in fig. 3 are subjected to the minimum phase alignment to obtain the minimum phase shift sequence h (n) corresponding to the target filter. Referring specifically to fig. 5, fig. 5 is a schematic diagram of an embodiment of a minimum phase shift sequence. On the basis, the minimum phase shift sequence h (n) is converted into a frequency domain by utilizing Fourier transform, and the frequency response of the target filter can be obtained. On the basis, the actual amplitude-frequency response and the actual phase-frequency response of the target filter corresponding to the ten sections of GEQ can be further obtained by using the formula (2). Can be combined with the figure6 and 7, fig. 6 is a schematic diagram of an embodiment of an actual amplitude-frequency response, and fig. 7 is a schematic diagram of an embodiment of an actual phase-frequency response. It should be noted that, as mentioned above, the desired gain may be specifically set by the user, that is, the desired gain represents the gain that the user desires the target filter to achieve; and the target gain represents the gain that the target filter can achieve under ideal conditions; in contrast to the above-described two methods, after the target filter is obtained by the following processing such as phase compensation, the target filter also has an actual gain, that is, a gain that the target filter can achieve in an actual case. The closer the target gain is to the desired gain, the more accurate the preset mapping relationship is represented, and the closer the actual gain is to the target gain, the more accurate the phase compensation and other processes are represented. Referring to fig. 3 and fig. 6, the actual gain is substantially identical to the target gain, so the above-mentioned processing such as phase alignment has higher precision, that is, the steps in the embodiment of the present disclosure are used to obtain the target filter, which is beneficial to improving the accuracy of the target filter.
In the scheme, the expected gains corresponding to a plurality of frequency bands are mapped by utilizing the preset mapping relation to obtain the target gains corresponding to the frequencies in the frequency bands, and the predetermined mapping relationship represents a mapping relationship between at least one of a desired gain of a band, a frequency within the band, and a target gain of the target filter, thereby obtaining the target amplitude-frequency response of the target filter based on the target gain corresponding to the frequency in a plurality of frequency bands, further, phase compensation is performed by using the target amplitude-frequency response to obtain a target filter, so that target gains corresponding to frequencies in a plurality of frequency bands are obtained based on a preset mapping relation, then obtaining the target amplitude-frequency response on the basis, and carrying out phase compensation on the target amplitude-frequency response, the target filter can be quickly obtained only by simple mathematical function processing, so that the operation amount of the obtained filter can be reduced, and the real-time performance of the obtained filter is improved.
Referring to fig. 8, fig. 8 is a flowchart illustrating an embodiment of step S11 in fig. 1. In the embodiment of the disclosure, the plurality of frequency bands include a first frequency band located at a head, a second frequency band located at a tail, and at least one third frequency band located between the first frequency band and the second frequency band, which are ordered from small to large, and preset mapping relationships corresponding to the first frequency band, the second frequency band, and the third frequency band are different. In this case, the embodiment of the present disclosure may specifically include the following steps:
step S81: and selecting a plurality of sampling frequencies in the first frequency band, the second frequency band and the third frequency band respectively.
Still taking the aforementioned ten-segment GEQ as an example, as mentioned above, several sampling frequencies can be selected in the frequency band 1, such as: 31Hz, 32Hz, 33Hz, 34Hz, … …, 60Hz, etc.; and selecting a plurality of sampling frequencies in the preset frequency band 2, such as: 60Hz, 61Hz, 62Hz, 63Hz, … …, 100Hz, etc., and so on, the sampling frequency is chosen, for example, in band 3 to band 10. Others may be so, and no one example is given here.
In an implementation scenario, a sampling frequency may be selected every other first preset frequency. The first preset frequency can be specifically set according to the actual application requirement. For example, in the case that the accuracy requirement of the target filter is high, the first preset frequency may be set to be small, such as 1Hz, 2Hz, and the like; alternatively, in the case that the accuracy requirement of the target filter is relatively loose, the first preset frequency may be set slightly larger, such as 4Hz, 5Hz, etc., without limitation.
In another implementation scenario, second frequencies respectively corresponding to different frequency bands may also be set, and sampling frequencies are selected in the different frequency bands according to the second frequency intervals corresponding to the different frequency bands. Specifically, as described above, the plurality of frequency bands may be sorted from small to large, and then the frequency band in the front of the sorting may be set to have a smaller second frequency, and the frequency band in the back of the sorting may be set to have a larger second frequency. Still taking ten-segment GEQ as an example, a smaller second frequency (e.g., 1Hz, 2Hz, etc.) may be set for frequency segment 1 (i.e., 20Hz to 60Hz), a slightly larger second frequency (e.g., 5Hz, 10Hz, etc.) may be set for frequency segment 4 (i.e., 150Hz to 300Hz), and so on, are not given here.
Step S82: and obtaining the target gain of the sampling frequency by using a preset mapping relation corresponding to the frequency band where the sampling frequency is located.
In one implementation scenario, where the sampling frequency is within the first frequency band, the target gain for the sampling frequency may be directly set to the desired gain for the first frequency band. In this way, when the sampling frequency is within the first frequency band, the target gain of the sampling frequency can be directly set to the desired gain of the first frequency band, which can be beneficial to further reducing the computation load for obtaining the target filter. Taking the total M frequency bands in the order from small to large as an example, the target gain of the first frequency band can be represented as:
G(f)=gG1……(3)
in the above formula (3), gG1Representing the desired gain for the first frequency band. It should be noted that, for the convenience of mapping, after the desired gain expressed in dB is obtained, it may be converted into a corresponding numerical value. For convenience of description, the desired gain of the ith frequency band may be denoted as GiAnd the corresponding value after conversion is recorded as gGi
Figure BDA0002861721770000101
For example, in the case where the desired gain for band 1 is 10dB, it may be converted to a corresponding value 3.1623. Other cases may be analogized, and no one example is given here.
Further, after the target gain expressed by a numerical value is obtained, it may be converted into the target gain expressed by dB again. For example, after the target gain 3.1623 is obtained, it may be converted to 10 dB. Other cases may be analogized, and no one example is given here.
In another implementation scenario, when the sampling frequency is in a third frequency band, a frequency range in which the sampling frequency is located may be determined, and an upper limit value and a lower limit value of the frequency range are central frequencies of two adjacent frequency bands, respectively, so that an expected gain corresponding to the frequency band in which the lower limit value is located is used as a first gain, an expected gain corresponding to the frequency band in which the upper limit value is located is used as a second gain, a preset mapping relation corresponding to the third frequency band is used to obtain a first weight of the first gain and a second weight of the second gain, and the first weight and the second weight are used to perform weighting processing on the first gain and the second gain, respectively, so as to obtain a target gain of the sampling frequency. In the above manner, by determining the frequency range in which the sampling frequency is located, and the upper limit value and the lower limit value of the frequency range are respectively the center frequencies of two adjacent frequency bands, the expected gain corresponding to the frequency band in which the lower limit value is located is used as the first gain, the expected gain corresponding to the frequency band in which the upper limit value is located is used as the second gain, and the preset mapping relation corresponding to the third frequency band is utilized to obtain the first weight of the first gain and the second weight of the second gain, and then the first weight and the second weight are utilized to respectively perform weighting processing on the first gain and the second gain to obtain the target gain of the sampling frequency, so that the target gain of the sampling frequency can be determined by combining the expected gain of the frequency band in which the upper limit value and the expected gain of the frequency band in which the lower limit value is located in the frequency range in which the sampling frequency is located under the condition that the sampling frequency is located in, it is possible to contribute to improvement of the accuracy of the target gain.
In a specific implementation scenario, for convenience of description, the sampling frequency may be denoted as f, and a frequency range formed by center frequencies of the two adjacent frequency bands may be denoted as
Figure BDA0002861721770000111
In this case, the desired gain gG corresponding to the ith frequency band may be setiAs the first gain, and the expected gain gG corresponding to the i +1 th frequency bandi+1As a second gain. Still taking the above ten-segment GEQ as an example, when the sampling frequency is 110Hz, the frequency range in which the GEQ is located may be determined to be 62Hz to 125Hz, so that the expected gain corresponding to the frequency band 2 in which the lower limit value is 62Hz may be used as the first gain, and the expected gain corresponding to the frequency band 3 in which the upper limit value is 125Hz may be used as the second gain. Other cases may be analogized, and no one example is given here.
In another specific implementation scenario, the closer the sampling frequency is to the lower limit value, the larger the first weight value is, and the smaller the second weight value is. In the above manner, the closer the sampling frequency is to the lower limit value, the larger the first weight is set, and the smaller the second weight is set, so that the more the expected gain of the frequency band where the frequency range endpoint closer to the sampling frequency is located can be depended on, and the accuracy of the target gain can be improved.
In a further specific implementation scenario, in the case that the sampling frequency is located in the third frequency band, the target gain g (f) may specifically be represented as:
Figure BDA0002861721770000112
in the above formula (5), gGiRepresenting a first gain, gG, converted from dB form to a corresponding valuei+1Representing a second gain converted from dB form to a corresponding value,
Figure BDA0002861721770000113
representing the lower limit of the frequency range and f the sampling frequency. In addition to this, the present invention is,
Figure BDA0002861721770000114
a first weight value is represented, which is,
Figure BDA0002861721770000115
representing the second weight.
In another implementation scenario, when the sampling frequency is located in the second frequency band, the expected gain corresponding to the second frequency band may be used as a third gain, and a third weight of the third gain is obtained by using a preset mapping relationship corresponding to the second frequency band, so that the third gain is weighted by using the third weight, and a target gain of the sampling frequency is obtained. In the above manner, when the sampling frequency is in the second frequency band, the expected gain corresponding to the second frequency band is used as the third gain, and the preset mapping relation corresponding to the second frequency band is used to obtain the third weight of the third gain, so that the third gain is weighted by the third weight to obtain the target gain of the sampling frequency.
In a specific implementation scenario, the closer the sampling frequency is to the center frequency of the second frequency band, the larger the third weight is, and conversely, the farther the sampling frequency is from the center frequency of the second frequency band, the smaller the third weight is. In the above manner, the closer the sampling frequency is to the center frequency of the second frequency band, the larger the third weight is set, so that the accuracy of the target gain can be improved.
In another specific implementation scenario, in the case that the sampling frequency is located in the second frequency band, the target gain g (f) may specifically be represented as:
Figure BDA0002861721770000121
in the above formula (6), gGMRepresenting a third gain converted from dB form to a corresponding value,
Figure BDA0002861721770000122
a third weight value is represented which is,
Figure BDA0002861721770000123
representing the center frequency of the second frequency band.
Different from the foregoing embodiment, by selecting a plurality of sampling frequencies in the first frequency band, the second frequency band, and the third frequency band, and using the preset mapping relationship corresponding to the frequency band where the sampling frequency is located, the target gain of the sampling frequency is obtained, the coverage of the sampling frequency can be improved, and thus the accuracy of the target filter can be improved.
Referring to fig. 9, fig. 9 is a flowchart illustrating an embodiment of obtaining the predetermined number. The method specifically comprises the following steps:
step S91: and mapping the sample gains corresponding to the frequency bands respectively by using a preset mapping relation to obtain the sample target gains of the frequencies in the frequency bands.
In one implementation scenario, to reduce the computational complexity, the sample gains corresponding to several frequency bands may be set to be the same. In addition, the sample gains corresponding to the dry bands may be set differently, and are not limited herein.
Reference may be made to the related description in the foregoing embodiments, which are not repeated herein.
Step S92: and obtaining a sample target amplitude-frequency response of the sample filter based on the sample target gains of the frequencies in the frequency bands.
Reference may be made to the related description in the foregoing embodiments, which are not repeated herein.
Step S93: and aiming at each candidate quantity, selecting a candidate quantity group of sample discrete data based on the sample target amplitude-frequency response, processing the candidate quantity group of sample discrete data by utilizing a preset phase completion mode to obtain a sample filter, and acquiring the response difference between the sample actual amplitude-frequency response and the sample target amplitude-frequency response of the sample filter.
In an implementation scenario, the number of candidates may be specifically set to the power of 2, and may be set to include: 512. 1024, 2048, 4096, etc., without limitation.
In another implementation scenario, in the process of selecting discrete data of the sample of the selected candidate number group, the discrete data may be specifically selected according to a frequency interval matching the candidate number. Specifically, the frequency interval may be expressed as:
Figure BDA0002861721770000131
in the above formula (7), step represents the frequency interval, LEN represents the number of candidates, Fs represents the sampling rate of audio data to be subsequently processed by the target filter, and
Figure BDA0002861721770000132
representing the cut-off frequency of the audio data. After the frequency interval step is obtained, one sample of discrete data may be sampled per interval step.
In another implementation scenario, the processing procedures such as phase alignment may refer to the related descriptions in the foregoing disclosed embodiments, and are not described herein again.
In yet another implementation scenario, as described above, after processing the discrete data of the sample of the candidate number group by using the preset phase alignment manner, the sample frequency response of the sample filter may be obtained, so that the actual amplitude-frequency response of the sample filter may be obtained by using the formula (2) and the related description in the above disclosed embodiment. Further, each set of sample discrete data includes the sample frequency and its sample target gain. On the basis, the actual gain of the sample frequency can be obtained based on the actual amplitude-frequency response of the sample, so that the difference between the target gain of the sample and the actual gain of the sample of each sample frequency is counted to obtain the response difference. In the above manner, the actual sample gain of the sample frequency is obtained based on the actual sample amplitude-frequency response, so that the difference between the target sample gain and the actual sample gain of each sample frequency is counted to obtain the response difference, which is favorable for improving the accuracy of the response difference.
For convenience of description, the actual amplitude-frequency response of the samples of the sample filter obtained by using the ith candidate number can be recorded as | Hreal|iAnd the sample target amplitude-frequency response is recorded as | HidealOn this basis, the response difference corresponding to the ith candidate number can be expressed as:
Figure BDA0002861721770000141
in the above formula (8,. lambda.)1And λ2Each representing a weighting factor, n representing a frequency weight coefficient, LEN representing the number of candidates, i.e. for the first n sample discrete data, using λ1Weighting the difference between the target gain and the actual gain of the sample in the discrete data of the sample, and using lambda for the discrete data of the sample from n +1 to LEN/2+12And weighting the difference between the sample target gain and the sample actual gain in the sample discrete data, and taking the sum of the weighted results of the two differences as the response difference corresponding to the candidate quantity LEN.
In a specific implementation scenario, the weighting factor λ is1And λ2Can be adjusted according to the actual application requirements. For example, in the case where the accuracy of the relatively low frequency part of the target filter is required to be high, the weighting factor λ1May be set to be greater than the weighting factor lambda2If a weighting factor lambda can be set1Is 0.7, a weighting factor lambda20.3, which is not limited herein; conversely, in the case of a high accuracy requirement for the relatively high frequency part of the target filter, the weighting factor λ2May be set to be greater than the weighting factor lambda1If a weighting factor lambda can be set1Is 0.3, a weighting factor lambda2Is 0.7, and is not limited herein.
In another specific implementation scenario, the frequency weighting factor n may also be adjusted according to the actual application requirement. For example, in a case where the accuracy requirement of the target filter is equivalent to the accuracy requirement of the band 1 to the band 3, n may be set to a value capable of covering the band 1 to the band 3, and the other cases may be similar to each other, which is not illustrated here.
Step S94: and selecting the candidate quantity corresponding to the response difference meeting the preset condition to obtain the preset quantity.
In one implementation scenario, the preset conditions may include: the difference in response is minimal. Therefore, the candidate number with the minimum response difference can be selected from the plurality of candidate numbers as the preset number, so that the accuracy of the preset number can be improved as much as possible, and the accuracy of the target filter can be improved. Still taking the total of 4 candidate numbers 512, 1024, 2048, 4096 as described above as an example, the response difference corresponding to the counted candidate number 4096 is the smallest, in which case the candidate number 4096 may be directly selected as the preset number.
In another implementation scenario, the preset conditions may also include: among the candidate numbers having a response difference smaller than the preset threshold value, that is, among the candidate numbers having a response difference smaller than the preset threshold value, the candidate number having the smallest value is selected as the preset number. The preset threshold may be set according to actual application requirements, for example, in a case that the precision requirement of the target filter is high, the preset threshold may be set to be smaller, and in a case that the precision requirement of the target filter is relatively loose, the preset threshold may be set to be slightly larger, which is not limited herein. In the above manner, by setting the preset condition to include: the minimum response difference is smaller than the preset threshold value, so that the calculation amount for obtaining the target filter can be reduced as much as possible on the premise of improving the accuracy of the target filter. Still taking the aforementioned 4 candidate numbers of 512, 1024, 2048, 4096 as an example, the candidate numbers with statistical response differences smaller than the preset threshold include: 2048 and 4096, in which case the smallest number of candidates, namely 2048, may be selected as the preset number. Other cases may be analogized, and no one example is given here.
Different from the embodiment, the sample target gains of the frequencies in the frequency bands are obtained by respectively mapping the sample gains corresponding to the frequency bands by using a preset mapping relation, the sample target amplitude-frequency response of the sample filter is obtained based on the sample target gain of the frequencies in the frequency bands, so that for each candidate number, based on the sample target amplitude-frequency response, the sample discrete data of the candidate number group is selected, the sample discrete data of the candidate number group is processed by using a preset phase alignment mode to obtain the sample filter, the response difference between the sample actual amplitude-frequency response and the sample target amplitude-frequency response of the sample filter is obtained, the candidate number corresponding to the response difference meeting the preset condition is further selected to obtain the preset number, and therefore, the candidate number can be selected based on the response difference, and the accuracy of the preset number can be improved, and then can be favorable to improving the accuracy of the target filter.
Referring to fig. 10, fig. 10 is a schematic flowchart illustrating an embodiment of an audio processing method according to the present application. The method specifically comprises the following steps:
step S1010: and acquiring expected gains corresponding to the audio to be processed and the frequency bands respectively.
In one implementation scenario, the audio to be processed may be specifically set according to the actual application needs. For example, the audio to be processed may include, but is not limited to: music data (e.g., symphony, pop music, etc.), call data, sound effect data (e.g., running sound of horse, wave sound, etc.), etc., without limitation. In addition, the frequency bands and the desired gain may specifically refer to the related descriptions in the foregoing embodiments, and are not described herein again.
Step S1020: and obtaining the target filter by utilizing the expected gains corresponding to the plurality of frequency bands respectively.
In the embodiment of the present disclosure, the target filter is obtained by using the steps in any of the above embodiments of the filter construction method, and specific reference may be made to the foregoing embodiments, which are not described herein again.
Step S1030: and processing the audio to be processed by using the target filter to obtain the target audio.
As described in the foregoing disclosure, after the minimum phase shift sequence h (n) corresponding to the target filter is obtained, it may be further converted into a frequency domain by using fourier transform, so that the frequency response of the target filter may be obtained, which may be denoted as h (w) for convenience of description. For convenience of processing, the audio data to be processed may also be mapped to the frequency domain through fourier transform (e.g., FFT), so as to obtain first frequency domain data of the audio to be processed, and for convenience of description, the first frequency domain data may be denoted as x (w), so that the audio to be processed may be processed by using the target filter according to the following formula:
Y(w)=H(w)X(w)……(9)
in the above equation (9), y (w) represents second frequency domain data of the target audio in the frequency domain. On this basis, the second frequency domain data may be converted to the time domain using an inverse fourier transform (e.g., IFFT), thereby obtaining the target audio.
To visually illustrate the processing effect of the embodiment of the disclosure, please refer to fig. 11 to 13, in which fig. 11 is a schematic diagram of an embodiment of the audio to be processed, fig. 12 is a schematic diagram of an embodiment of the target audio processed by the target filter, and fig. 13 is a schematic diagram of an embodiment of the target audio processed by the coolbit. In fig. 11 to 13, the abscissa represents frequency and the ordinate represents gain. In addition, for convenience of processing, the expected gains corresponding to the frequency bands are all set to be 10 dB; in order to cover as many frequency bands as possible, the audio to be processed may specifically be set as a frequency sweep signal. Referring to fig. 11, the gain of the audio to be processed is approximately-6 dB in each frequency band, referring to fig. 12, the gain of the target audio processed by the target filter is approximately 4dB in each frequency band, referring to fig. 13, the gain of the target audio processed by the coolbit is approximately 4dB in each frequency band. Therefore, the target filter has high accuracy.
Different from the foregoing embodiment, the target filter is obtained by obtaining the audio to be processed and the expected gains corresponding to the frequency bands, and using the expected gains corresponding to the frequency bands, and the target filter is obtained by using the steps in any of the filter construction method embodiments, so that the target filter is used to process the audio to be processed to obtain the target audio, which is further beneficial to improving the real-time performance of audio processing.
Referring to fig. 14, fig. 14 is a schematic block diagram of an embodiment of an electronic device 1400 according to the present application. The electronic device 1400 comprises a memory 1410 and a processor 1420 coupled to each other, the memory 1410 having stored therein program instructions, the processor 1420 being configured to execute the program instructions to implement the steps in any of the filter construction method embodiments described above, or to implement the steps in any of the audio processing method embodiments described above. Specifically, electronic device 1400 may include, but is not limited to: desktop computers, notebook computers, cell phones, tablet computers, audio processing workstations, and the like, without limitation.
In particular, the processor 1420 is configured to control itself and the memory 1410 to implement steps in any of the filter construction method embodiments described above, or to implement steps in any of the audio processing method embodiments described above. Processor 1420 may also be referred to as a CPU (Central Processing Unit). Processor 1420 may be an integrated circuit chip having signal processing capabilities. The Processor 1420 may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Additionally, processor 1420 may be commonly implemented by integrated circuit chips.
In some disclosed embodiments, the processor 1420 is configured to map the expected gains corresponding to the multiple frequency bands respectively by using a preset mapping relationship, so as to obtain target gains corresponding to frequencies within the multiple frequency bands; the preset mapping relation represents a mapping relation between at least one of the expected gain of the frequency band and the frequency in the frequency band and the target gain of the target filter; the processor 1420 is configured to obtain a target amplitude-frequency response of the target filter based on target gains corresponding to frequencies in a plurality of frequency bands; processor 1420 is configured to perform phase alignment using the target amplitude-frequency response to obtain a target filter.
In the scheme, the expected gains corresponding to a plurality of frequency bands are mapped by utilizing the preset mapping relation to obtain the target gains corresponding to the frequencies in the frequency bands, and the predetermined mapping relationship represents a mapping relationship between at least one of a desired gain of a band, a frequency within the band, and a target gain of the target filter, thereby obtaining the target amplitude-frequency response of the target filter based on the target gain corresponding to the frequency in a plurality of frequency bands, further, phase compensation is performed by using the target amplitude-frequency response to obtain a target filter, so that target gains corresponding to frequencies in a plurality of frequency bands are obtained based on a preset mapping relation, then obtaining the target amplitude-frequency response on the basis, and carrying out phase compensation on the target amplitude-frequency response, the target filter can be quickly obtained only by simple mathematical function processing, so that the operation amount of the obtained filter can be reduced, and the real-time performance of the obtained filter is improved.
In some disclosed embodiments, the plurality of frequency bands include a first frequency band located at a head, a second frequency band located at a tail, and at least one third frequency band located between the first frequency band and the second frequency band, which are ordered from small to large, and the first frequency band, the second frequency band, and the third frequency band have different preset mapping relationships.
Different from the foregoing embodiment, the plurality of frequency bands are arranged in a descending order to include a first frequency band located at a head position, a second frequency band located at a tail position, and at least one third frequency band located between the first frequency band and the second frequency band, and preset mapping relationships corresponding to the first frequency band, the second frequency band, and the third frequency band are different from each other, so that expected gains corresponding to different frequency bands can be mapped by using the corresponding preset mapping relationships, and the accuracy of the target gain can be improved.
In some disclosed embodiments, the processor 1420 is configured to select a plurality of sampling frequencies within the first frequency band, the second frequency band, and the third frequency band, respectively; the processor 1420 is configured to obtain a target gain of the sampling frequency by using a preset mapping relationship corresponding to a frequency band where the sampling frequency is located.
Different from the foregoing embodiment, by selecting a plurality of sampling frequencies in the first frequency band, the second frequency band, and the third frequency band, and using the preset mapping relationship corresponding to the frequency band where the sampling frequency is located, the target gain of the sampling frequency is obtained, the coverage of the sampling frequency can be improved, and thus the accuracy of the target filter can be improved.
In some disclosed embodiments, where the sampling frequency is within the third frequency band, the processor 1420 is configured to determine a frequency range within which the sampling frequency is located; the upper limit value and the lower limit value of the frequency range are respectively the central frequencies of two adjacent frequency bands; the processor 1420 is configured to use the expected gain corresponding to the frequency band where the lower limit value is located as a first gain, and use the expected gain corresponding to the frequency band where the upper limit value is located as a second gain; the processor 1420 is configured to obtain a first weight of the first gain and a second weight of the second gain by using a preset mapping relationship corresponding to the third frequency band; the processor 1420 is configured to perform weighting processing on the first gain and the second gain by using the first weight and the second weight, respectively, to obtain a target gain of the sample frequency.
Different from the foregoing embodiment, in the above manner, by determining the frequency range in which the sampling frequency is located, and the upper limit value and the lower limit value of the frequency range are respectively the center frequencies of two adjacent frequency bands, the expected gain corresponding to the frequency band in which the lower limit value is located is taken as the first gain, the expected gain corresponding to the frequency band in which the upper limit value is located is taken as the second gain, and the preset mapping relationship corresponding to the third frequency band is utilized to obtain the first weight of the first gain and the second weight of the second gain, and further the first weight and the second weight are utilized to respectively perform weighting processing on the first gain and the second gain to obtain the target gain of the sampling frequency, so that the target gain of the sampling frequency can be determined by combining the expected gain of the frequency band in which the upper limit value of the frequency range in which the sampling frequency is located and the expected gain of the frequency band in which the lower limit value is located under the condition that the sampling frequency is located in, it is possible to contribute to improvement of the accuracy of the target gain.
In some disclosed embodiments, the closer the sampling frequency is to the lower limit, the greater the first weight, and the smaller the second weight.
Different from the foregoing embodiment, the closer the sampling frequency is to the lower limit value, the larger the first weight is set, and the smaller the second weight is set, so that the more the expected gain of the frequency band where the frequency range endpoint closer to the sampling frequency is located can be depended on, and the accuracy of the target gain can be improved.
In some disclosed embodiments, where the sampling frequency is within the second frequency band, the processor 1420 is configured to apply a desired gain corresponding to the second frequency band as the third gain; the processor 1420 is configured to obtain a third weight of a third gain by using a preset mapping relationship corresponding to the second frequency band; the processor 1420 is configured to perform a weighting process on the third gain by using the third weight to obtain a target gain of the sampling frequency.
Different from the foregoing embodiment, when the sampling frequency is located in the second frequency band, the expected gain corresponding to the second frequency band is used as the third gain, and the preset mapping relationship corresponding to the second frequency band is used to obtain the third weight of the third gain, so that the third gain is weighted by the third weight to obtain the target gain of the sampling frequency.
In some disclosed embodiments, the closer the sampling frequency is to the center frequency of the second frequency band, the greater the third weight.
Different from the foregoing embodiment, the closer the sampling frequency is to the center frequency of the second frequency band, the larger the third weight is set, so that the accuracy of the target gain can be improved.
In some disclosed embodiments, where the sampling frequency is located in a first frequency band, the target gain for the sampling frequency is a desired gain for the first frequency band.
Unlike the foregoing embodiment, in the case where the sampling frequency is within the first frequency band, by directly setting the target gain of the sampling frequency to the desired gain of the first frequency band, it is possible to further reduce the amount of computation for obtaining the target filter.
In some disclosed embodiments, processor 1420 is configured to select a predetermined number of sets of discrete data based on the target amplitude-frequency response; wherein each set of discrete data comprises a frequency and its target gain; the processor 1420 is configured to process a preset number of sets of discrete data in a preset phase alignment manner to obtain a target filter.
Different from the foregoing embodiment, based on the target amplitude-frequency response, a preset number of sets of discrete data are selected, and each set of discrete data includes a frequency and a target gain, so that the preset number of sets of discrete data can be processed in a preset phase compensation manner to obtain the target filter.
In some disclosed embodiments, the processor 1420 is configured to map sample gains corresponding to a plurality of frequency bands respectively by using a preset mapping relationship, so as to obtain sample target gains of frequencies in the plurality of frequency bands; the processor 1420 is configured to obtain a sample target amplitude-frequency response of the sample filter based on the sample target gain of the frequency in the plurality of frequency bands; the processor 1420 is configured to select a candidate number group of sample discrete data based on the sample target amplitude-frequency response for each candidate number, process the candidate number group of sample discrete data in a preset phase alignment manner to obtain a sample filter, and obtain a response difference between a sample actual amplitude-frequency response of the sample filter and the sample target amplitude-frequency response; the processor 1420 is configured to select a candidate number corresponding to the response difference satisfying a preset condition, so as to obtain a preset number.
Different from the embodiment, the sample target gains of the frequencies in the frequency bands are obtained by respectively mapping the sample gains corresponding to the frequency bands by using a preset mapping relation, the sample target amplitude-frequency response of the sample filter is obtained based on the sample target gain of the frequencies in the frequency bands, so that for each candidate number, based on the sample target amplitude-frequency response, the sample discrete data of the candidate number group is selected, the sample discrete data of the candidate number group is processed by using a preset phase alignment mode to obtain the sample filter, the response difference between the sample actual amplitude-frequency response and the sample target amplitude-frequency response of the sample filter is obtained, the candidate number corresponding to the response difference meeting the preset condition is further selected to obtain the preset number, and therefore, the candidate number can be selected based on the response difference, and the accuracy of the preset number can be improved, and then can be favorable to improving the accuracy of the target filter.
In some disclosed embodiments, each set of sample discrete data includes a sample frequency and its sample target gain, and the processor 1420 is configured to obtain a sample actual gain for the sample frequency based on the sample actual amplitude-frequency response; the processor 1420 is configured to count a difference between the sample target gain and the sample actual gain for each sample frequency to obtain a response difference.
Different from the embodiment, the actual gain of the sample frequency is obtained based on the actual amplitude-frequency response of the sample, so that the difference between the target gain of the sample and the actual gain of the sample of each sample frequency is counted to obtain the response difference, and the accuracy of the response difference can be improved.
In some disclosed embodiments, the processor 1420 is configured to obtain desired gains corresponding to the audio to be processed and the frequency bands, respectively; the processor 1420 is configured to obtain a target filter by using the expected gains corresponding to the frequency bands; wherein the standard filter is obtained by utilizing the steps in any one of the filter construction method embodiments; the processor 1420 is configured to process the audio to be processed by using the target filter, so as to obtain a target audio.
Different from the foregoing embodiment, the target filter is obtained by obtaining the audio to be processed and the expected gains corresponding to the frequency bands, and using the expected gains corresponding to the frequency bands, and the target filter is obtained by using the steps in any of the filter construction method embodiments, so that the target filter is used to process the audio to be processed to obtain the target audio, which is further beneficial to improving the real-time performance of audio processing.
Referring to fig. 15, fig. 15 is a schematic diagram of a memory device 1500 according to an embodiment of the present application. The storage 1500 stores program instructions 1501 that can be executed by a processor, the program instructions 1501 being used to implement steps in any of the above-described filter construction method embodiments, or to implement steps in any of the above-described audio processing method embodiments.
By the scheme, the calculation amount of the filter can be reduced, and the real-time performance of the filter is improved.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
The foregoing description of the various embodiments is intended to highlight various differences between the embodiments, and the same or similar parts may be referred to each other, and for brevity, will not be described again herein.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some interfaces, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (14)

1. A method of constructing a filter, comprising:
mapping expected gains corresponding to a plurality of frequency bands respectively by using a preset mapping relation to obtain target gains corresponding to frequencies in the frequency bands; wherein the preset mapping relationship represents a mapping relationship between at least one of the expected gain of the frequency band and the frequency in the frequency band and a target gain of a target filter;
obtaining a target amplitude-frequency response of the target filter based on target gains corresponding to the frequencies in the frequency bands;
and carrying out phase alignment by using the target amplitude-frequency response to obtain the target filter.
2. The method according to claim 1, wherein the plurality of bands are sorted from small to large to include a first band located at a head, a second band located at a tail, and at least one third band located between the first band and the second band, and preset mapping relationships corresponding to the first band, the second band, and the third band are different from each other.
3. The method of claim 2, wherein the mapping the expected gains corresponding to the plurality of frequency bands respectively by using a preset mapping relationship to obtain target gains corresponding to frequencies within the plurality of frequency bands comprises:
selecting a plurality of sampling frequencies in the first frequency band, the second frequency band and the third frequency band respectively;
and obtaining the target gain of the sampling frequency by utilizing a preset mapping relation corresponding to the frequency band where the sampling frequency is located.
4. The method according to claim 3, wherein obtaining the target gain of the sampling frequency by using a preset mapping relationship corresponding to the frequency band in which the sampling frequency is located when the sampling frequency is located in the third frequency band comprises:
determining a frequency range in which the sampling frequency is located; the upper limit value and the lower limit value of the frequency range are respectively the central frequencies of two adjacent frequency bands;
taking the expected gain corresponding to the frequency band where the lower limit value is located as a first gain, and taking the expected gain corresponding to the frequency band where the upper limit value is located as a second gain; and the number of the first and second groups,
obtaining a first weight of the first gain and a second weight of the second gain by using a preset mapping relation corresponding to the third frequency band;
and respectively carrying out weighting processing on the first gain and the second gain by using the first weight and the second weight to obtain the target gain of the sample frequency.
5. The method of claim 4, wherein the closer the sampling frequency is to the lower limit, the larger the first weight and the smaller the second weight.
6. The method according to claim 3, wherein obtaining the target gain of the sampling frequency by using a preset mapping relationship corresponding to the frequency band in which the sampling frequency is located when the sampling frequency is located in the second frequency band comprises:
taking the expected gain corresponding to the second frequency band as a third gain;
obtaining a third weight of the third gain by using a preset mapping relation corresponding to the second frequency band;
and carrying out weighting processing on the third gain by using the third weight to obtain the target gain of the sampling frequency.
7. The method of claim 6, wherein the third weight is larger as the sampling frequency is closer to a center frequency of the second frequency band.
8. The method of claim 3, wherein the target gain of the sampling frequency is a desired gain of the first frequency band when the sampling frequency is in the first frequency band.
9. The method of claim 1, wherein said phase aligning with said target amplitude-frequency response to obtain said target filter comprises:
selecting a preset number of groups of discrete data based on the target amplitude-frequency response; wherein each set of the discrete data comprises the frequency and its target gain;
and processing the discrete data of the preset quantity group by using a preset phase supplementing mode to obtain the target filter.
10. The method of claim 9, wherein the step of obtaining the preset number comprises:
mapping sample gains corresponding to the frequency bands respectively by using the preset mapping relation to obtain sample target gains of the frequencies in the frequency bands;
obtaining a sample target amplitude-frequency response of a sample filter based on the sample target gains of the frequencies in the frequency bands;
for each candidate quantity, based on the sample target amplitude-frequency response, selecting the sample discrete data of the candidate quantity group, processing the sample discrete data of the candidate quantity group by using the preset phase completion mode to obtain the sample filter, and acquiring the response difference between the sample actual amplitude-frequency response of the sample filter and the sample target amplitude-frequency response;
and selecting the candidate quantity corresponding to the response difference meeting the preset condition to obtain the preset quantity.
11. The method of claim 10, wherein each set of the sample discrete data comprises a sample frequency and a sample target gain thereof; the obtaining of the response difference between the sample actual amplitude-frequency response of the sample filter and the sample target amplitude-frequency response includes:
acquiring the actual sample gain of the sample frequency based on the actual sample amplitude-frequency response;
and counting the difference between the sample target gain and the sample actual gain of each sample frequency to obtain the response difference.
12. An audio processing method, comprising:
acquiring expected gains corresponding to the audio to be processed and a plurality of frequency bands respectively;
obtaining a target filter by utilizing the expected gains corresponding to the frequency bands respectively; wherein the target filter is obtained by the filter construction method according to any one of claims 1 to 11;
and processing the audio to be processed by using the target filter to obtain a target audio.
13. An electronic device comprising a memory and a processor coupled to each other, the memory having stored therein program instructions, the processor being configured to execute the program instructions to implement the filter construction method of any one of claims 1 to 11 or to implement the audio processing method of claim 12.
14. A storage device storing program instructions executable by a processor to implement the filter construction method of any one of claims 1 to 11 or to implement the audio processing method of claim 12.
CN202011565847.6A 2020-12-25 2020-12-25 Filter construction method, audio processing method, electronic equipment and storage device Pending CN112769410A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011565847.6A CN112769410A (en) 2020-12-25 2020-12-25 Filter construction method, audio processing method, electronic equipment and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011565847.6A CN112769410A (en) 2020-12-25 2020-12-25 Filter construction method, audio processing method, electronic equipment and storage device

Publications (1)

Publication Number Publication Date
CN112769410A true CN112769410A (en) 2021-05-07

Family

ID=75694534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011565847.6A Pending CN112769410A (en) 2020-12-25 2020-12-25 Filter construction method, audio processing method, electronic equipment and storage device

Country Status (1)

Country Link
CN (1) CN112769410A (en)

Citations (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101783656A (en) * 2010-03-17 2010-07-21 北京爱德发科技有限公司 Loudness control method, module and device of stereo system
US20100316226A1 (en) * 2009-06-12 2010-12-16 Sony Corporation Signal processing apparatus and signal processing method
EP2472215A1 (en) * 2010-12-29 2012-07-04 Thales Method and device for the neutralisation of a target
US8779847B1 (en) * 2011-07-13 2014-07-15 Marvell International Ltd. Systems and methods for finite impulse response adaptation for gain and phase control
CN104966524A (en) * 2014-12-31 2015-10-07 腾讯科技(深圳)有限公司 Audio processing method and audio processing system
CN106063293A (en) * 2014-02-25 2016-10-26 阿嘉米斯 Method and system for automatic acoustic equalisation
CN106160882A (en) * 2016-07-13 2016-11-23 北京交通大学 A kind of multiband wireless channel measurement calibration steps and system
CN106549652A (en) * 2015-09-18 2017-03-29 杜比实验室特许公司 Filter coefficient update in time-domain filtering
WO2017113607A1 (en) * 2015-12-31 2017-07-06 深圳Tcl数字技术有限公司 Audio signal frequency response compensation method and apparatus
WO2017214086A1 (en) * 2016-06-07 2017-12-14 Dolby Laboratories Licensing Corporation Audio equalization system and method
CN107945784A (en) * 2017-12-14 2018-04-20 成都必盛科技有限公司 A kind of automatic calibrating method and device of active noise reduction audio frequency apparatus
CN108011615A (en) * 2017-12-25 2018-05-08 北京怡和嘉业医疗科技股份有限公司 A kind of method and apparatus of signal processing
CN108111443A (en) * 2016-11-25 2018-06-01 电信科学技术研究院 A kind of method and device of definite voice link parametric equalizer tuning parameter
CN108111956A (en) * 2017-12-26 2018-06-01 广州励丰文化科技股份有限公司 A kind of sound equipment adjustment method and device based on amplitude-frequency response
CN108200526A (en) * 2017-12-29 2018-06-22 广州励丰文化科技股份有限公司 A kind of sound equipment adjustment method and device based on confidence level curve
CN108599732A (en) * 2018-05-11 2018-09-28 四川斐讯信息技术有限公司 A kind of method for controlling volume and system
CN108923784A (en) * 2018-06-12 2018-11-30 电子科技大学 A kind of the amplitude-frequency response estimation error and bearing calibration of TIADC acquisition system
CN110536216A (en) * 2019-09-05 2019-12-03 长沙市回音科技有限公司 A kind of balance parameters matching process, device, terminal device and storage medium based on interpolation processing
TWI683534B (en) * 2019-09-19 2020-01-21 宏碁股份有限公司 Adjusting system and adjusting method thereof for equalization processing
CN111081214A (en) * 2019-12-12 2020-04-28 西安讯飞超脑信息科技有限公司 Active noise reduction method and optimization method of feedback filter of active noise reduction device
CN111181516A (en) * 2019-12-27 2020-05-19 中山大学花都产业科技研究院 Tone equalization method
WO2020175175A2 (en) * 2019-02-25 2020-09-03 Clarion Co., Ltd. Phase control device, acoustic device and phase control method
CN111933161A (en) * 2020-07-16 2020-11-13 腾讯音乐娱乐科技(深圳)有限公司 Method for generating filter parameter of equalizer, audio signal filtering method and equalizer
WO2020238000A1 (en) * 2019-05-24 2020-12-03 腾讯音乐娱乐科技(深圳)有限公司 Audio processing method, device, terminal, and computer-readable storage medium

Patent Citations (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100316226A1 (en) * 2009-06-12 2010-12-16 Sony Corporation Signal processing apparatus and signal processing method
CN101783656A (en) * 2010-03-17 2010-07-21 北京爱德发科技有限公司 Loudness control method, module and device of stereo system
EP2472215A1 (en) * 2010-12-29 2012-07-04 Thales Method and device for the neutralisation of a target
US8779847B1 (en) * 2011-07-13 2014-07-15 Marvell International Ltd. Systems and methods for finite impulse response adaptation for gain and phase control
CN106063293A (en) * 2014-02-25 2016-10-26 阿嘉米斯 Method and system for automatic acoustic equalisation
CN104966524A (en) * 2014-12-31 2015-10-07 腾讯科技(深圳)有限公司 Audio processing method and audio processing system
CN106549652A (en) * 2015-09-18 2017-03-29 杜比实验室特许公司 Filter coefficient update in time-domain filtering
WO2017113607A1 (en) * 2015-12-31 2017-07-06 深圳Tcl数字技术有限公司 Audio signal frequency response compensation method and apparatus
WO2017214086A1 (en) * 2016-06-07 2017-12-14 Dolby Laboratories Licensing Corporation Audio equalization system and method
CN106160882A (en) * 2016-07-13 2016-11-23 北京交通大学 A kind of multiband wireless channel measurement calibration steps and system
CN108111443A (en) * 2016-11-25 2018-06-01 电信科学技术研究院 A kind of method and device of definite voice link parametric equalizer tuning parameter
CN107945784A (en) * 2017-12-14 2018-04-20 成都必盛科技有限公司 A kind of automatic calibrating method and device of active noise reduction audio frequency apparatus
CN108011615A (en) * 2017-12-25 2018-05-08 北京怡和嘉业医疗科技股份有限公司 A kind of method and apparatus of signal processing
CN108111956A (en) * 2017-12-26 2018-06-01 广州励丰文化科技股份有限公司 A kind of sound equipment adjustment method and device based on amplitude-frequency response
CN108200526A (en) * 2017-12-29 2018-06-22 广州励丰文化科技股份有限公司 A kind of sound equipment adjustment method and device based on confidence level curve
CN108599732A (en) * 2018-05-11 2018-09-28 四川斐讯信息技术有限公司 A kind of method for controlling volume and system
CN108923784A (en) * 2018-06-12 2018-11-30 电子科技大学 A kind of the amplitude-frequency response estimation error and bearing calibration of TIADC acquisition system
WO2020175175A2 (en) * 2019-02-25 2020-09-03 Clarion Co., Ltd. Phase control device, acoustic device and phase control method
WO2020238000A1 (en) * 2019-05-24 2020-12-03 腾讯音乐娱乐科技(深圳)有限公司 Audio processing method, device, terminal, and computer-readable storage medium
CN110536216A (en) * 2019-09-05 2019-12-03 长沙市回音科技有限公司 A kind of balance parameters matching process, device, terminal device and storage medium based on interpolation processing
TWI683534B (en) * 2019-09-19 2020-01-21 宏碁股份有限公司 Adjusting system and adjusting method thereof for equalization processing
CN111081214A (en) * 2019-12-12 2020-04-28 西安讯飞超脑信息科技有限公司 Active noise reduction method and optimization method of feedback filter of active noise reduction device
CN111181516A (en) * 2019-12-27 2020-05-19 中山大学花都产业科技研究院 Tone equalization method
CN111933161A (en) * 2020-07-16 2020-11-13 腾讯音乐娱乐科技(深圳)有限公司 Method for generating filter parameter of equalizer, audio signal filtering method and equalizer

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHEN, Z等: "A pre-distortion based design method for digital audio graphic equalizer", 《DIGITAL SIGNAL PROCESSING》, 19 February 2014 (2014-02-19) *
张宝琳;张玲华;: "数字助听器中多通道响度补偿方法的研究", 信号处理, no. 05, 25 May 2013 (2013-05-25) *
李战明;张璇;: "基于频率转移的数字助听器单通道响度补偿算法", 电子设计工程, no. 05, 5 March 2017 (2017-03-05) *

Similar Documents

Publication Publication Date Title
US11314805B2 (en) Method and apparatus for retrieving audio file, server, and computer-readable storage medium
US8428276B2 (en) Frequency-warped audio equalizer
EP2279509B1 (en) Method and apparatus for maintaining speech audibility in multi-channel audio with minimal impact on surround experience
EP2545552B1 (en) Method and system for scaling ducking of speech-relevant channels in multi-channel audio
Välimäki et al. Accurate cascade graphic equalizer
CN104980337A (en) Method and device for improving audio processing performance
EP3869775B1 (en) Double-talk state detection method and device, and electronic device
Tiwari et al. A technique with low memory and computational requirements for dynamic tracking of quantiles
JP5774191B2 (en) Method and apparatus for attenuating dominant frequencies in an audio signal
CN112769410A (en) Filter construction method, audio processing method, electronic equipment and storage device
Horváth et al. Optimizing the numerical noise of parallel second-order filters in fixed-point arithmetic
Belloch et al. Efficient target-response interpolation for a graphic equalizer
CN109754825B (en) Audio processing method, device, equipment and computer readable storage medium
CN104240697A (en) Audio data feature extraction method and device
CN112820310A (en) Incoming wave direction estimation method and device
CN113205824B (en) Sound signal processing method, device, storage medium, chip and related equipment
CN101788974A (en) Variable point FFT/IFFT operation method, device and system
CN112997511B (en) Generating harmonics in an audio system
CN110097888B (en) Human voice enhancement method, device and equipment
Bharitkar et al. Perceptual multiple location equalization with clustering
CN106549652A (en) Filter coefficient update in time-domain filtering
CN112489669A (en) Audio signal processing method, device, equipment and medium
CN112348657A (en) Method and device for determining target credit user, computer equipment and storage medium
Vinod et al. Low-power differential coefficients-based FIR filters using hardware-optimised multipliers
EP4152321A1 (en) Apparatus and method for narrowband direction-of-arrival estimation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination