CN112769410B - 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 PDFInfo
- Publication number
- CN112769410B CN112769410B CN202011565847.6A CN202011565847A CN112769410B CN 112769410 B CN112769410 B CN 112769410B CN 202011565847 A CN202011565847 A CN 202011565847A CN 112769410 B CN112769410 B CN 112769410B
- Authority
- CN
- China
- Prior art keywords
- frequency
- target
- gain
- frequency band
- sample
- 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.)
- Active
Links
- 238000010276 construction Methods 0.000 title claims abstract description 18
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 230000004044 response Effects 0.000 claims abstract description 112
- 238000013507 mapping Methods 0.000 claims abstract description 83
- 238000005070 sampling Methods 0.000 claims description 94
- 238000000034 method Methods 0.000 claims description 39
- 238000012545 processing Methods 0.000 claims description 23
- 238000010586 diagram Methods 0.000 description 23
- 230000010363 phase shift Effects 0.000 description 11
- 230000008569 process Effects 0.000 description 8
- 230000000694 effects Effects 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000001419 dependent effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000005484 gravity Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03G—CONTROL OF AMPLIFICATION
- H03G5/00—Tone control or bandwidth control in amplifiers
Landscapes
- Tone Control, Compression And Expansion, Limiting Amplitude (AREA)
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 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 plurality of frequency bands; the preset mapping relation represents the mapping relation between at least one of expected gains of the frequency bands 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 compensation by using the target amplitude-frequency response to obtain the target filter. According to the scheme, the operation amount of the acquisition filter can be reduced, and the instantaneity of the acquisition filter is improved.
Description
Technical Field
The present application relates to the field of signal processing technologies, and in particular, to a method for constructing a filter, 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 amplitude-frequency characteristics, and by independently lifting or attenuating signals of each frequency band, different effects such as compensation, modification of sound, and the like can be created. A graphic equalizer (Graphic Equalizer, GEQ) is typically integrated into a common music player such as Windows MEDIA PLAYER to act as a filter to equalize the amplitude-frequency characteristics of the music, thereby achieving different auditory effects.
Currently, GEQ is typically implemented digitally, such as FIR (Finite Impulse Response ), IIR (Infinite Impulse Response, infinite impulse response), and the like. However, in order to improve accuracy, it is generally necessary to increase the order of a digital filter such as FIR or IIR, which results in a large increase in the amount of computation and a large decrease in real-time performance. In view of this, how to reduce the computation load of the acquisition filter and improve the real-time performance of the acquisition filter is a problem to be solved.
Disclosure of Invention
The application mainly solves the technical problem that the application provides a filter construction method, an audio processing method, electronic equipment and a storage device, which can reduce the operation amount of acquiring a filter and promote the instantaneity of acquiring the filter.
In order to solve the above problem, a first aspect of the present application provides a filter construction method, including: 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 plurality of frequency bands; the preset mapping relation represents the mapping relation between at least one of expected gains of the frequency bands 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 compensation by using the target amplitude-frequency response to obtain the 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 target audio; wherein the target filter is obtained using the filter construction method in the first aspect.
In order to solve the above-mentioned problem, a third aspect of the present application provides an electronic device, including a memory and a processor coupled to each other, the memory storing program instructions, the processor being configured to execute the program instructions to implement the filter construction method in the first aspect or to implement the audio processing method in the second aspect.
In order to solve the above-described problem, a fourth aspect of the present application provides a storage device storing program instructions executable by a processor for implementing the filter construction method in the above-described first aspect or implementing the audio processing method in the above-described second aspect.
According to the scheme, the expected gains corresponding to the frequency bands are mapped by using the preset mapping relation to obtain the target gains corresponding to the frequency bands, the preset mapping relation represents the mapping relation between the expected gain of the frequency band, at least one of the frequency bands and the target gain of the target filter, so that the target amplitude-frequency response of the target filter is obtained based on the target gains corresponding to the frequency bands, and then the target filter is obtained by phase compensation through the target amplitude-frequency response.
Drawings
FIG. 1 is a flow chart of an embodiment of a method for constructing a filter according to 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 an embodiment of an IIR filter amplitude-frequency response;
FIG. 5 is a schematic diagram of one embodiment of a minimum phase shift sequence;
FIG. 6 is a schematic diagram of an embodiment of an actual amplitude-frequency response;
FIG. 7 is a schematic diagram of an 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 flow chart of an embodiment for obtaining a preset number;
FIG. 10 is a flow chart of an embodiment of an audio processing method according to the present application;
FIG. 11 is a schematic diagram of an embodiment of audio to be processed;
FIG. 12 is a schematic diagram of an embodiment of target audio after processing by a target filter;
FIG. 13 is a schematic diagram of an embodiment of target audio after cooledit processing;
FIG. 14 is a schematic diagram of a frame of an embodiment of an electronic device of the present application;
FIG. 15 is a schematic diagram of a frame of an embodiment of a storage device of the present application.
Detailed Description
The following describes embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, 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" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a filter construction method according to the present application. Specifically, the method may include the steps of:
Step S11: and mapping the expected gains corresponding to the frequency bands by using a preset mapping relation to obtain target gains corresponding to the frequencies in the frequency bands.
In one implementation scenario, the frequency bands may be specifically set according to actual application needs. For example, in the case where the embodiment of the present disclosure is applied to GEQ, several frequency bands may be specifically set according to the kind of GEQ. As for a ten-segment GEQ, the several frequency bands may include: frequency band 1 with center frequency f c 1 at 31Hz (i.e., 20Hz to 60 Hz), frequency band 2 with center frequency f c 2 at 62Hz (i.e., 60Hz to 100 Hz), frequency band 3 with center frequency f c 3 at 125Hz (i.e., 100Hz to 150 Hz), frequency band 4 with center frequency f c 4 at 250Hz (i.e., 150Hz to 300 Hz), a frequency band, A frequency band 5 having a center frequency f c 5 of 500Hz (i.e., 300Hz to 500 Hz), a frequency band 6 having a center frequency f c 6 of 1kHz (i.e., 1kHz to 2 kHz), a frequency band 7 having a center frequency f c 7 of 2kHz (i.e., 2kHz to 3 kHz), a frequency band 8 having a center frequency f c 8 of 4kHz (i.e., 8kHz to 10 kHz), a frequency band 9 having a center frequency f c 9 of 8kHz (i.e., 8kHz to 10 kHz), a frequency band, The center frequency f c 10 is the frequency band 10 of 16kHz (i.e., 10kHz to 20 kHz). In the case of twenty-segment GEQ, thirty-segment GEQ, etc., the setting manner of the several frequency bands is not described here again.
In one implementation scenario, the desired gains for several frequency bands may be specifically set by the user. For example, a user may enter a specific value of a desired gain through a keyboard; or the user may select a specific value of the desired gain via the mouse. Referring to fig. 2 in combination with the GEQ, fig. 2 is a schematic diagram of one embodiment of the GEQ. Fig. 2 is a schematic diagram of an embodiment of the ten-segment GEQ. As shown in fig. 2, a push rod for setting a desired gain is provided at each center frequency, and a user can control the push rod to be adjusted up or down by dragging a mouse or pressing keys (e.g., +.f, +.v.), thereby setting a corresponding desired gain. In the case of twenty-segment GEQ, thirty-segment GEQ, and the like, the specific setting method of the desired gain can be similarly, and is not exemplified 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 0dB. Further, 10dB, 20dB, etc. may be set, and the present invention is not limited thereto. Or the expected gains corresponding to the frequency bands can be set to be completely different, namely, 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 frequency bands can be set to be not identical, that is, at least two frequency bands have identical expected gains corresponding to the frequency bands, and at least two frequency bands have different expected gains corresponding to the frequency bands. The setting may be specifically performed according to the actual needs of the user, which is not limited herein.
In the embodiment of the disclosure, the preset mapping relationship represents a mapping relationship between at least one of a desired gain of a frequency band and a frequency in the frequency band and a target gain of a target filter. For example, the preset mapping relationship may represent a mapping relationship between a desired gain of the frequency band and a target gain of the target filter; or the preset mapping relationship may also represent the mapping relationship between the expected gain of the frequency band, the frequency in the frequency band and the target gain of the target filter, which is not limited herein.
In an implementation scenario, after the frequency bands are ordered according to the order from small to large, the frequency bands specifically may include a first frequency band located at the first position, a second frequency band located at the last position, and at least one third frequency band located between the first frequency band and the second frequency band, so that in order to improve accuracy of a preset mapping relationship, the corresponding preset mapping relationships of the first frequency band, the second frequency band and the third frequency band may be different. According to the mode, the preset mapping relations corresponding to the first frequency band positioned at the first position, the second frequency band positioned at the last position and the third frequency band positioned between the first frequency band and the second frequency band are set to be different, so that the preset mapping relations suitable for the frequency characteristics of the different frequency bands can be set, and the accuracy of the preset mapping relations can be improved.
In another implementation scenario, in order to further improve accuracy of the preset mapping relationship, the preset mapping relationships corresponding to the frequency bands may be different from each other, that is, each frequency band is correspondingly provided with the preset mapping relationship corresponding to the frequency band, and the preset mapping relationship corresponding to each frequency band may be different from each other.
In an implementation scenario, the preset mapping relationship may be specifically obtained through data fitting. Specifically, the first gain value G1 may be set at the frequency f in several frequency bands by using an audio editing tool such as cooledit, so as 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 any one of the frequency f and the first gain value G1, a corresponding second gain value G2 can be obtained, so that multiple groups of data to be fitted can be obtained through the mode. On this basis, the frequency f and the first gain value G1 can be used as independent variables, and the second gain value G2 can be used as dependent variables to be fitted, so as to obtain the preset mapping relation.
In one implementation scenario, a plurality of sampling frequencies may be selected in 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. Taking the above ten-segment GEQ as an example, several sampling frequencies may be selected in the frequency band 1, for example: 31Hz, 32Hz, 33Hz, 34Hz, … …, 60Hz, etc.; and selecting a plurality of sampling frequencies in a preset frequency band 2, for example: 60Hz, 61Hz, 62Hz, 63Hz, … …, 100Hz, etc., and so on, in the range of, for example, band 3 to band 10, the sampling frequencies are selected and are not illustrated here. On the basis, the sampling frequency selected in the frequency band 1 and the expected gain of the frequency band 1 can be mapped by using a preset mapping relation corresponding to the frequency band 1, so as to obtain target gains corresponding to the sampling frequencies 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 the preset mapping relation corresponding to the frequency band 2 to obtain the target gains respectively corresponding to the sampling frequencies in the frequency band 2, and the like, so as to obtain the target gains respectively corresponding to the sampling frequencies in the frequency band 3 to the frequency band 10. Other situations can be similar and are not exemplified here.
Step S12: and obtaining the target amplitude-frequency response of the target filter based on the target gains corresponding to the frequencies in the frequency bands.
Specifically, the frequency and the target gain corresponding to the frequency can be used as a group of data to be fitted, frequencies in a plurality of frequency bands are used as independent variables, and the target gain corresponding to the frequency is used as a dependent variable, so that the data to be fitted are fitted, and the target amplitude-frequency response of the target filter is obtained.
Still taking ten-segment GEQ as an example, the expected gains corresponding to the frequency bands 1 to 10 may be set to 10dB, and after mapping the expected gains corresponding to the ten-segment frequency bands by using the preset mapping relationship, the target gain corresponding to the frequency in the 10-segment frequency band may be obtained. On the basis, fitting is carried out on the frequency in the 10-band frequency range and the target gain corresponding to the frequency, so that the target amplitude-frequency response of the target filter can be obtained. In one embodiment, referring to fig. 3 in combination, 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 the target amplitude-frequency response of the target filter after ten sections of GEQ frequency bands are all set to 10 dB. As shown in fig. 3, the target amplitude-frequency response substantially coincides with the desired gain.
In contrast, referring to fig. 4 in combination, fig. 4 is a schematic diagram of an embodiment of an IIR filter amplitude-frequency response. The IIR filter is 16-order, and as shown in fig. 4, when the IIR filter is used, the amplitude-frequency response will generate ripple in the high-frequency part (such as about 10kHz in fig. 4), and at most, will generate an error of about 10 dB. Therefore, according to the embodiment of the disclosure, the expected gains corresponding to the frequency bands are mapped through the preset mapping relation, so that the accuracy of the finally obtained target amplitude-frequency response can be remarkably improved.
Step S13: and performing phase compensation by using the target amplitude-frequency response to obtain the target filter.
Specifically, a preset number of sets of discrete data may be selected based on the target amplitude-frequency response, where each set of discrete data includes a frequency and a target gain thereof, so that the preset number of sets of discrete data may be processed by using a preset phase compensation method to obtain the target filter. The preset phase compensation method may include, but is not limited to: minimum phase alignment, linear phase alignment, etc., are not limited herein.
In one implementation scenario, taking the example of phase-filling the target amplitude-frequency response with minimum phase-filling. Real minimum phase shift sequence in time domain and complex cepstrum thereofCan be expressed as even sequence/>And odd sequence/>Sum of complex cepstrum/>Can be represented by even sequence/>Full recovery, or can be performed by odd sequences/>, when n +.0And (5) completely recovering. Furthermore, according to the Fourier transform parity, even sequence/>By discrete Fourier transform (Discrete Fourier Transform, DFT) as real part/>Odd sequence/>After discrete Fourier transform, the imaginary part/>Since 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/>, in the frequency domain, of the frequency response of the target filterTherefore, in order to improve the processing efficiency, the preset number of discrete data groups can be processed by IFFT (INVERT FAST Fourier Transformation, inverse fast Fourier transform) to obtain even sequencesReuse of even sequences/>Recovering to obtain complex cepstrum/>Due to the complex cepstrum/>The minimum phase shift sequence h (n) corresponding to the target filter is a cepstrum sequence, so that the complex cepstrum/>, can be obtained by the following formulaPerforming conversion to obtain a minimum phase shift sequence h (n) corresponding to the target filter:
As shown in the formula (1), the complex cepstrum can be specifically obtained 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 using inverse fast Fourier transform to obtain a minimum phase shift sequence h (n) corresponding to the target filter. It follows that the phase-frequency response of the target filter can be padded by minimum phase-padding based on the target amplitude-frequency response of the known 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.
In yet another implementation scenario, the preset number may be specifically set according to practical application requirements, for example, may be set to 512, 1024, 2048, 4096, etc., which is not limited herein. In addition, in order to further reduce the operation amount on the premise of improving the accuracy of the target filter, the preset number can also be obtained by analyzing a plurality of candidate numbers, and specifically, reference may be made to the following related embodiments, which are not described herein.
In yet another implementation scenario, in selecting the preset number of sets of discrete data, the discrete data may be selected according to a frequency interval step matching the preset number, i.e. one discrete data may be sampled per interval step. The specific acquisition manner of the frequency interval step may refer to the related description in the following disclosed embodiments, which is not repeated herein.
In a specific implementation scenario, after the minimum phase shift sequence H (n) corresponding to the target filter is obtained, the minimum phase shift sequence H (n) may be further converted into a frequency domain by using fourier transform, so that a 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:
In the above formula (2), a (w) represents the actual amplitude-frequency response of the target filter, Representing the actual phase-frequency response of the target filter. Taking the ten-segment GEQ as an example, the minimum phase shift sequence h (n) corresponding to the target filter can be obtained by performing the above-mentioned minimum phase alignment method on 2048 sets of discrete data selected from the target amplitude-frequency response shown in fig. 3. Referring specifically to fig. 5, fig. 5 is a schematic diagram of one embodiment of a minimum phase shift sequence. On this basis, the minimum phase shift sequence h (n) is converted into the frequency domain by fourier transform, and the frequency response of the target filter can be obtained. Based on the above, the actual amplitude-frequency response and the actual phase-frequency response of the target filter corresponding to the ten-segment GEQ can be further obtained by using the formula (2). Referring specifically to fig. 6 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 described above, the desired gain is specifically a gain that can be set by the user, that is, the desired gain indicates a 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 distinction from the above two, the target filter can be obtained after the following phase compensation and the like, and also has an actual gain, that is, a gain that can be achieved by the target filter in an actual case. The closer the target gain is to the expected gain, the more accurate the preset mapping relation is, and the closer the actual gain is to the target gain, the more accurate the phase compensation and other processes are. Referring to fig. 3 and 6, the actual gain substantially coincides with the target gain, so the above-mentioned phase alignment and other processes have higher accuracy, i.e. the steps in the embodiments of the present disclosure are used to obtain the target filter, which can be beneficial to improving the accuracy of the target filter.
According to the scheme, the expected gains corresponding to the frequency bands are mapped by using the preset mapping relation to obtain the target gains corresponding to the frequency bands, the preset mapping relation represents the mapping relation between the expected gain of the frequency band, at least one of the frequency bands and the target gain of the target filter, so that the target amplitude-frequency response of the target filter is obtained based on the target gains corresponding to the frequency bands, and then the target filter is obtained by phase compensation through the target amplitude-frequency response.
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 the first position, a second frequency band located at the last position and at least one third frequency band located between the first frequency band and the second frequency band according to the order from small to large, and preset mapping relations corresponding to the first frequency band, the second frequency band and the third frequency band are different from each other. In this case, embodiments of the present disclosure may specifically include the steps of:
step S81: and respectively selecting a plurality of sampling frequencies in the first frequency band, the second frequency band and the third frequency band.
Taking the ten-segment GEQ as an example, as described above, several sampling frequencies may be selected in the frequency band 1, such as: 31Hz, 32Hz, 33Hz, 34Hz, … …, 60Hz, etc.; and selecting a plurality of sampling frequencies in a preset frequency band 2, for example: 60Hz, 61Hz, 62Hz, 63Hz, … …,100 Hz, etc., and so on, within, for example, frequency bands 3 through 10. Other things can be said and are not exemplified here.
In one implementation scenario, a sampling frequency may be specifically selected every first preset frequency. The first preset frequency can be specifically set according to actual application requirements. For example, in the case where the accuracy requirement of the target filter is high, the first preset frequency may be set smaller, such as may be set to 1Hz, 2Hz, or the like; or in the case where the accuracy requirement of the target filter is relatively relaxed, the first preset frequency may be set to be slightly larger, for example, may be set to 4Hz, 5Hz, or the like, which is not limited herein.
In another implementation scenario, second frequencies corresponding to different frequency bands may be set, and sampling frequencies may be selected in different frequency bands according to the second frequency intervals corresponding to the second frequencies. Specifically, as described above, the frequency bands may be ordered from small to large, and then the frequency band with the first order may be set to a second smaller frequency, and the frequency band with the second order may be set to a second larger frequency. Still taking a ten-segment GEQ as an example, a smaller second frequency (e.g., 1Hz, 2Hz, etc.) may be set for band 1 (i.e., 20Hz to 60 Hz), while a slightly larger second frequency (e.g., 5Hz, 10Hz, etc.) may be set for band 4 (i.e., 150Hz to 300 Hz), and so on, other bands may be similarly used, without further examples.
Step S82: 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.
In one implementation scenario, where the sampling frequency is within the first frequency band, the target gain for the sampling frequency may be set directly to the desired gain for the first frequency band. In the above manner, when the sampling frequency is located in the first frequency band, the target gain of the sampling frequency can be directly set as the desired gain of the first frequency band, which is beneficial to further reducing the computation load of obtaining the target filter. Taking a total of M frequency bands as an example, the target gain of the first frequency band can be expressed as:
G(f)=gG1……(3)
In the above formula (3), gG 1 represents the desired gain of the first frequency band. It should be noted that, in order to facilitate mapping, after the desired gain expressed in dB is obtained, it may be converted into a corresponding value. For convenience of description, the expected gain of the ith frequency band may be denoted as G i, and the converted corresponding value may be denoted as gG i:
For example, in the case where the desired gain corresponding to band 1 is 10dB, it may be converted into the corresponding value 3.1623. Other situations can be similar and are not exemplified here.
Further, after the numerically represented target gain is obtained, it may be reconverted to a dB represented target gain. For example, after the target gain 3.1623 is obtained, it may be converted to 10dB. Other situations can be similar and are not exemplified here.
In another implementation scenario, when the sampling frequency is located in the 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 center frequencies of two adjacent frequency bands, 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 utilized to obtain a first weight of the first gain and a second weight of the second gain, and further the first gain and the second gain are weighted respectively by the first weight and the second weight to obtain a target gain of the sample frequency. According to the mode, the frequency range where the sampling frequency is located is determined, the upper limit value and the lower limit value of the frequency range are respectively the center frequencies of two adjacent frequency bands, so that the expected gain corresponding to the frequency band where the lower limit value is located is used as the first gain, the expected gain corresponding to the frequency band where the upper limit value is located is used as the second gain, the first weight of the first gain and the second weight of the second gain are obtained by utilizing the preset mapping relation corresponding to the third frequency band, and the first gain and the second gain are respectively weighted by utilizing the first weight and the second weight to obtain the target gain of the sampling frequency.
In a specific implementation scenario, for convenience of description, the sampling frequency may be denoted as f, and the frequency range formed by the center frequencies of the two adjacent frequency bands may be denoted asIn this case, the desired gain gG i corresponding to the i-th frequency band may be taken as a first gain, and the desired gain gG i+1 corresponding to the i+1th frequency band may be taken as a second gain. Taking the foregoing ten-segment GEQ as an example, in the case where 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 desired gain corresponding to the frequency band 2 in which the lower limit value 62Hz is located may be used as the first gain, and the desired gain corresponding to the frequency band 3 in which the upper limit value 125Hz is located may be used as the second gain. Other situations can be similar and are not exemplified here.
In another specific implementation scenario, the closer the sampling frequency is to the lower limit value, the greater the first weight and the smaller the second weight. 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 expected gain of the frequency band where the end point of the frequency range close to the sampling frequency is can be relied on, and the accuracy of the target gain can be improved.
In yet another specific implementation scenario, in the case where the sampling frequency is located in the third frequency band, the target gain G (f) may be specifically expressed as:
In the above equation (5), gG i represents a first gain converted from the dB form to the corresponding value, gG i+1 represents a second gain converted from the dB form to the corresponding value, The lower limit of the frequency range is indicated, and f represents the sampling frequency. In addition, in the case of the optical fiber,Representing the first weight,/>Representing the second weight.
In still 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 the 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 to obtain the target gain of the sampling frequency. In the above manner, 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 third weight of the third gain is obtained by using the preset mapping relation corresponding to the second frequency band, so that the third weight is used for carrying out weighting processing on the third gain to obtain the target gain of the sampling frequency, therefore, when the sampling frequency is located in the second frequency band, the target gain of the sampling frequency can be obtained only depending on the expected gain corresponding to the second frequency band, and the complexity of obtaining the target filter can be reduced.
In a specific implementation scenario, the closer the sampling frequency is to the center frequency of the second frequency band, the greater the third weight, whereas the farther the sampling frequency is to the center frequency of the second frequency band, the smaller the third weight. 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 where the sampling frequency is within the second frequency band, the target gain G (f) may be specifically expressed as:
in the above equation (6), gG M represents the third gain converted from the dB form to the corresponding value, Representing a third weight,/>Representing the center frequency of the second frequency band.
Different from the foregoing embodiments, the target gain of the sampling frequency is obtained by selecting a plurality of sampling frequencies in the first frequency band, the second frequency band and the third frequency band respectively and using a preset mapping relationship corresponding to the frequency band where the sampling frequency is located, so that the coverage range of the sampling frequency can be improved, and the accuracy of the target filter can be improved.
Referring to fig. 9, fig. 9 is a flowchart illustrating an embodiment of obtaining a preset number. The method specifically comprises the following steps:
Step S91: and mapping sample gains corresponding to the frequency bands by using a preset mapping relation to obtain sample target gains of frequencies in the frequency bands.
In one implementation scenario, in order 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 frequency bands may be set to be different, which is not limited herein.
Reference may be made specifically to the foregoing descriptions of the disclosed embodiments, and details 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 specifically to the foregoing descriptions of the disclosed embodiments, and details are not repeated herein.
Step S93: and selecting candidate quantity group sample discrete data based on the sample target amplitude-frequency response according to each candidate quantity, processing the candidate quantity group sample discrete data by utilizing a preset phase compensation mode to obtain a sample filter, and obtaining a response difference between the sample actual amplitude-frequency response of the sample filter and the sample target amplitude-frequency response.
In one implementation scenario, the number of candidates may specifically be set to a power of 2, e.g., may be set to include: 512. 1024, 2048, 4096, etc., without limitation.
In another implementation scenario, in selecting the candidate number of sets of sample discrete data, the discrete data may be specifically selected according to a frequency interval matching the candidate number. Specifically, the frequency interval may be expressed as:
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 processed by the target filter, and Representing the cut-off frequency of the audio data. After the frequency interval step is obtained, one sample discrete data may be sampled per interval step.
In yet another implementation scenario, the processing procedures of phase alignment and the like may refer to the related descriptions in the foregoing disclosed embodiments, and are not repeated here.
In yet another implementation scenario, as described above, after the candidate number set of sample discrete data is processed by using the preset phase-fill method, 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 using equation (2) and the related description in the above disclosed embodiment. Further, each set of sample discrete data includes a sample frequency and its sample target gain. Based on the above, the sample actual gain of the sample frequency can be obtained based on the sample actual amplitude-frequency response, so that the difference between the sample target gain and the sample actual gain of each sample frequency is counted, and the response difference is obtained. According to the mode, the sample actual gain of the sample frequency is obtained based on the sample actual amplitude-frequency response, so that the difference between the sample target gain and the sample actual gain of each sample frequency is counted, the response difference is obtained, and the accuracy of the response difference can be improved.
For convenience of description, the actual amplitude-frequency response of the sample obtained by using the ith candidate number may be denoted as |h real|i, and the target amplitude-frequency response of the sample may be denoted as |h ideal |, on the basis of which the response difference corresponding to the ith candidate number may be expressed as:
in the above formula (8, λ 1 and λ 2 each represent a weighting factor, n represents a frequency specific gravity coefficient, LEN represents a candidate number, that is, for the first n pieces of sample discrete data, a difference between a sample target gain and a sample actual gain in the sample discrete data is weighted with λ 1, and for the pieces of sample discrete data from n+1 to LEN/2+1, a difference between a sample target gain and a sample actual gain in the sample discrete data is weighted with λ 2, and a sum of weighted results of the two differences is taken as a response difference corresponding to the candidate number LEN.
In a specific implementation scenario, the weighting factors λ 1 and λ 2 may be adjusted according to the actual application requirements. For example, in the case where the accuracy requirement for the relatively low frequency portion of the target filter is high, the weighting factor λ 1 may be set to be greater than the weighting factor λ 2, for example, the weighting factor λ 1 may be set to 0.7, and the weighting factor λ 2 may be set to 0.3, which is not limited herein; in contrast, in a case where accuracy requirements for a relatively high frequency portion of the target filter are high, the weighting factor λ 2 may be set to be larger than the weighting factor λ 1, for example, the weighting factor λ 1 may be set to 0.3, and the weighting factor λ 2 may be set to 0.7, which is not limited herein.
In another specific implementation scenario, the frequency specific gravity coefficient n may also be adjusted according to practical application requirements. For example, in the case where the target filter has a considerable requirement for the accuracy of the frequency band 1 to the frequency band 3, n may be set to a value capable of covering the frequency band 1 to the frequency band 3, and the other cases may be similar, and are not exemplified here.
Step S94: 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: response differences are minimal. Therefore, the candidate number with the smallest corresponding response difference can be selected from the 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. Taking the total of 4 candidate numbers 512, 1024, 2048, 4096 as an example, the response difference corresponding to the counted candidate number 4096 is the smallest, in this case, the candidate number 4096 may be directly selected as the preset number.
In another implementation scenario, the preset conditions may also include: the minimum of the response differences smaller than the preset threshold, that is, the candidate number having the smallest value among the candidate numbers having the response differences smaller than the preset threshold is selected as the preset number. The preset threshold may be set according to actual application requirements, for example, in a case where the accuracy requirement on the target filter is high, the preset threshold may be set smaller, and in a case where the accuracy requirement on the target filter is relatively loose, the preset threshold may be set slightly larger, which is not limited herein. In the above manner, by setting the preset conditions to include: the minimum response difference is smaller than the preset threshold value, so that the calculation amount for acquiring the target filter can be reduced as much as possible on the premise of improving the accuracy of the target filter. Still taking the total of 4 candidate numbers 512, 1024, 2048, 4096 as an example, the candidate numbers with the statistical response difference smaller than the preset threshold value include: 2048, and 4096, in which case the smallest candidate number thereof, i.e., 2048, may be selected as the preset number. Other situations can be similar and are not exemplified here.
Different from the foregoing embodiment, the sample gains corresponding to the plurality of frequency bands are mapped by using the preset mapping relationship to obtain sample target gains of the frequencies in the plurality of frequency bands, and sample target amplitude-frequency responses of the sample filter are obtained based on the sample target gains of the frequencies in the plurality of frequency bands, so that for each candidate number, based on the sample target amplitude-frequency responses, a candidate number group of sample discrete data is selected, and the candidate number group of sample discrete data is processed by using a preset phase compensation mode, so as to obtain a sample filter, and a response difference between an actual sample amplitude-frequency response of the sample filter and the sample target amplitude-frequency response is obtained, so that a candidate number corresponding to the response difference meeting preset conditions is selected, so that the selection of the candidate number based on the response difference can be facilitated, the accuracy of the preset number can be improved, and the accuracy of the target filter can be facilitated.
Referring to fig. 10, fig. 10 is a 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 the audio to be processed and the expected gains corresponding to 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, meteor, etc.), call data, sound effect data (e.g., running sounds of horses, sea waves, etc.), and the like, are not limited herein. In addition, the several frequency bands and the desired gain may be specifically described with reference to the foregoing embodiments, and are not described herein.
Step S1020: and obtaining the target filter by utilizing the expected gains corresponding to the frequency bands respectively.
In the embodiment of the present disclosure, the target filter is obtained by using the steps in the embodiment of any one of the above-mentioned filter construction methods, and specifically, reference may be made to the foregoing disclosed embodiment, which is not described herein again.
Step S1030: and processing the audio to be processed by using the target filter to obtain target audio.
As described in the foregoing disclosed embodiments, after the minimum phase shift sequence H (n) corresponding to the target filter is obtained, it may be further converted into the frequency domain by 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 a 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 by:
Y(w)=H(w)X(w)……(9)
In the above formula (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) to obtain the target audio.
In order to intuitively represent the processing effect of the embodiments of the present disclosure, please refer to fig. 11 to 13 in combination, fig. 11 is a schematic diagram of an embodiment of audio to be processed, fig. 12 is a schematic diagram of an embodiment of target audio processed by the target filter, and fig. 13 is a schematic diagram of an embodiment of target audio processed by cooledit. In fig. 11 to 13, the abscissa indicates frequency and the ordinate indicates gain. In addition, for convenience of processing, expected gains corresponding to a plurality of frequency bands are all set to 10dB; in order to cover as many frequency bands as possible, the audio to be processed can be set in particular as a swept frequency 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, and referring to fig. 13, the gain of the target audio processed by cooledit is approximately 4dB in each frequency band. It can be seen that the target filter has high accuracy.
Different from the foregoing embodiments, the target filter is obtained by obtaining the audio to be processed and the expected gains corresponding to the frequency bands respectively, and using the expected gains corresponding to the frequency bands respectively, where the target filter is obtained by using the steps in the foregoing embodiments of the method for constructing any filter, so that the target filter is used to process the audio to be processed, so as to obtain the target audio, and further, the real-time performance of audio processing can be improved.
Referring to fig. 14, fig. 14 is a schematic diagram of a frame of an electronic device 1400 according to an embodiment of the 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 adapted to execute the program instructions 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. In particular, electronic device 1400 may include, but is not limited to: desktop computers, notebook computers, cell phones, tablet computers, audio processing workstations, etc., are not limited herein.
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 with signal processing capabilities. Processor 1420 may also be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), a Field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 1420 may be commonly implemented by an integrated circuit chip.
In some disclosed embodiments, the processor 1420 is configured to map expected gains corresponding to a plurality of frequency bands by using a preset mapping relationship, so as to obtain target gains corresponding to frequencies in the plurality of frequency bands; the preset mapping relation represents the mapping relation between at least one of expected gains of the frequency bands 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; the processor 1420 is configured to perform phase alignment using the target amplitude-frequency response to obtain a target filter.
According to the scheme, the expected gains corresponding to the frequency bands are mapped by using the preset mapping relation to obtain the target gains corresponding to the frequency bands, the preset mapping relation represents the mapping relation between the expected gain of the frequency band, at least one of the frequency bands and the target gain of the target filter, so that the target amplitude-frequency response of the target filter is obtained based on the target gains corresponding to the frequency bands, and then the target filter is obtained by phase compensation through the target amplitude-frequency response.
In some disclosed embodiments, the plurality of frequency bands include a first frequency band located at the first position, a second frequency band located at the last position, and at least one third frequency band located between the first frequency band and the second frequency band according to the order from small to large, and the preset mapping relationships corresponding to the first frequency band, the second frequency band, and the third frequency band are different from each other.
Different from the foregoing embodiment, the plurality of frequency bands are arranged to include the first frequency band located at the first position, the second frequency band located at the last position, and at least one third frequency band located between the first frequency band and the second frequency band according to the order from small to large, and the preset mapping relations corresponding to the first frequency band, the second frequency band and the third frequency band are different, so that the expected gains corresponding to different frequency bands can be mapped by using the corresponding preset mapping relations, and the accuracy of the target gain can be improved.
In some disclosed embodiments, the processor 1420 is configured to select a number 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 embodiments, the target gain of the sampling frequency is obtained by selecting a plurality of sampling frequencies in the first frequency band, the second frequency band and the third frequency band respectively and using a preset mapping relationship corresponding to the frequency band where the sampling frequency is located, so that the coverage range of the sampling frequency can be improved, and the accuracy of the target filter can be improved.
In some disclosed embodiments, the processor 1420 is configured to determine a frequency range in which the sampling frequency is located, in the case where the sampling frequency is located within the third frequency band; the upper limit value and the lower limit value of the frequency range are respectively the center frequencies of two adjacent frequency bands; the processor 1420 is configured to use, as a first gain, a desired gain corresponding to a frequency band where the lower limit value is located, and use, as a second gain, a desired gain corresponding to a frequency band where the upper limit value is located; and, 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, so as to obtain a target gain of the sample frequency.
In the above manner, the frequency range in which the sampling frequency is located is determined, and the upper limit value and the lower limit value of the frequency range are the center frequencies of the two adjacent frequency bands, so that 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, 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 the first weight and the second weight are utilized to respectively weight the first gain and the second gain, so that the target gain of the sampling frequency is obtained, and therefore, the target gain of the sampling frequency can be determined together with 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 under the condition that the sampling frequency band is located, and the accuracy of the target gain can be improved.
In some disclosed embodiments, the closer the sampling frequency is to the lower limit value, 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 expected gain of the frequency band where the end point of the frequency range close to the sampling frequency is located can be relied on, and further the accuracy of the target gain can be improved.
In some disclosed embodiments, in the case where the sampling frequency is within the second frequency band, the processor 1420 is configured to use 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 weight the third gain with a third weight to obtain a target gain of the sampling frequency.
Different from the foregoing embodiment, in the case where the sampling frequency is located in the second frequency band, the desired gain corresponding to the second frequency band is used as the third gain, and the third weight of the third gain is obtained by using the preset mapping relation corresponding to the second frequency band, so that the third gain is weighted by using the third weight to obtain the target gain of the sampling frequency, so that the target gain of the sampling frequency can be obtained only depending on the desired gain corresponding to the second frequency band in the case where the sampling frequency is located in the second frequency band, and the complexity of obtaining the target filter can be reduced.
In some disclosed embodiments, the closer the sampling frequency is to the center frequency of the second frequency band, the greater the third weight.
Unlike 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 it is possible to facilitate improvement of the accuracy of the target gain.
In some disclosed embodiments, where the sampling frequency is located in the first frequency band, the target gain for the sampling frequency is a desired gain for the first frequency band.
In contrast to the foregoing embodiment, in the case where the sampling frequency is located 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 advantageous for further reducing the amount of computation for obtaining the target filter.
In some disclosed embodiments, the 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 includes a frequency and a target gain thereof; the processor 1420 is configured to process a predetermined number of sets of discrete data using a predetermined phase-fill method 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 the frequency and the target gain thereof, so that the preset number of sets of discrete data can be processed in a preset phase compensation manner, and the target filter can be obtained, by selecting the preset number of sets of discrete data and performing phase compensation on the preset number of sets of discrete data, the calculation amount for obtaining the target filter can be further reduced, and the instantaneity for obtaining the target filter can be improved.
In some disclosed embodiments, the processor 1420 is configured to map sample gains corresponding to a plurality of frequency bands 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 sample target gains of frequencies within a plurality of frequency bands; the processor 1420 is configured to select a candidate number group of sample discrete data based on a sample target amplitude-frequency response for each candidate number, process the candidate number group of sample discrete data by using a preset phase compensation method, obtain a sample filter, and obtain a response difference between a sample actual amplitude-frequency response and a sample target amplitude-frequency response of the sample filter; the processor 1420 is configured to select a candidate number corresponding to the response difference satisfying a preset condition, to obtain a preset number.
Different from the foregoing embodiment, the sample gains corresponding to the plurality of frequency bands are mapped by using the preset mapping relationship to obtain sample target gains of the frequencies in the plurality of frequency bands, and sample target amplitude-frequency responses of the sample filter are obtained based on the sample target gains of the frequencies in the plurality of frequency bands, so that for each candidate number, based on the sample target amplitude-frequency responses, a candidate number group of sample discrete data is selected, and the candidate number group of sample discrete data is processed by using a preset phase compensation mode, so as to obtain a sample filter, and a response difference between an actual sample amplitude-frequency response of the sample filter and the sample target amplitude-frequency response is obtained, so that a candidate number corresponding to the response difference meeting preset conditions is selected, so that the selection of the candidate number based on the response difference can be facilitated, the accuracy of the preset number can be improved, and the accuracy of the target filter can be facilitated.
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 calculate differences between the sample target gains and the sample actual gains for the respective sample frequencies to obtain response differences.
Different from the foregoing embodiment, the sample actual gain of the sample frequency is obtained based on the sample actual amplitude-frequency response, so that the difference between the sample target gain and the sample actual gain of each sample frequency is counted, and the response difference is obtained, which can be beneficial to improving the accuracy of the response difference.
In some disclosed embodiments, the processor 1420 is configured to obtain desired gains corresponding to the audio to be processed and the several frequency bands, respectively; the processor 1420 is configured to obtain a target filter by using the expected gains corresponding to the frequency bands respectively; the target filter is obtained by utilizing the steps in the embodiment of any filter construction method; the processor 1420 is configured to process the audio to be processed using the target filter to obtain target audio.
Different from the foregoing embodiments, the target filter is obtained by obtaining the audio to be processed and the expected gains corresponding to the frequency bands respectively, and using the expected gains corresponding to the frequency bands respectively, where the target filter is obtained by using the steps in the foregoing embodiments of the method for constructing any filter, so that the target filter is used to process the audio to be processed, so as to obtain the target audio, and further, the real-time performance of audio processing can be improved.
Referring to fig. 15, fig. 15 is a schematic diagram of a frame of a storage device 1500 according to an embodiment of the application. The storage device 1500 stores program instructions 1501 capable of being executed by a processor, the program instructions 1501 being used 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.
According to the scheme, the operation amount of the acquisition filter can be reduced, and the instantaneity of the acquisition filter is improved.
In some embodiments, functions or modules included in an apparatus provided by the embodiments of the present disclosure may be used to perform a method described in the foregoing method embodiments, and specific implementations thereof may refer to descriptions of the foregoing method embodiments, which are not repeated herein for brevity.
The foregoing description of various embodiments is intended to highlight differences between the various embodiments, which may be the same or similar to each other by reference, and is not repeated herein for the sake of brevity.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Claims (12)
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 plurality of frequency bands; the preset mapping relation represents a mapping relation between expected gain of the frequency band, at least one of frequencies in the frequency band and target gain of a target filter;
Obtaining a target amplitude-frequency response of the target filter based on the target gains corresponding to the frequencies in the frequency bands;
performing phase compensation by using the target amplitude-frequency response to obtain the target filter;
The phase compensation is performed by using the target amplitude-frequency response to obtain the target filter, and the method further comprises the following steps:
mapping sample gains corresponding to the frequency bands respectively by utilizing 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 sample target gains of the frequencies in the frequency bands;
Selecting the candidate quantity group of sample discrete data according to the sample target amplitude-frequency response aiming at each candidate quantity, processing the candidate quantity group of sample discrete data by utilizing a preset phase compensation mode to obtain the sample filter, and obtaining the response difference between the sample actual amplitude-frequency response of the sample filter and the sample target amplitude-frequency response;
Selecting the candidate quantity corresponding to the response difference meeting a preset condition to obtain a preset quantity, and selecting the preset quantity group of discrete data; wherein each set of said discrete data comprises said frequency and a target gain thereof;
And processing the preset number of groups of discrete data by using a preset phase compensation mode to obtain the target filter.
2. The method of claim 1, wherein the plurality of frequency bands include a first frequency band located at a first position, a second frequency band located at a last position, and at least one third frequency band located between the first frequency band and the second frequency band in order from small to large, and the preset mapping relationships corresponding to the first frequency band, the second frequency band, and the third frequency band are different from each other.
3. The method of claim 2, wherein mapping the expected gains corresponding to the frequency bands by using the preset mapping relationship to obtain the target gains corresponding to the frequencies in the 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 using a preset mapping relation corresponding to the frequency band where the sampling frequency is located.
4. The method of claim 3, wherein, in the case where the sampling frequency is located in the third frequency band, the 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 includes:
determining the frequency range of the sampling frequency; the upper limit value and the lower limit value of the frequency range are respectively the center frequencies of two adjacent frequency bands;
Taking the expected gain corresponding to the frequency band where the lower limit value is positioned as a first gain, and taking the expected gain corresponding to the frequency band where the upper limit value is positioned as a second gain; and
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 weighting the first gain and the second gain by using the first weight and the second weight to obtain the target gain of the sampling frequency.
5. The method of claim 4, wherein the closer the sampling frequency is to the lower limit value, the greater the first weight and the smaller the second weight.
6. The method of claim 3, wherein, in the case where the sampling frequency is located in the second frequency band, the 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 includes:
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 weighting 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 greater the closer the sampling frequency is to a center frequency of the second frequency band.
8. A method according to claim 3, wherein the target gain of the sampling frequency is a desired gain of the first frequency band if the sampling frequency is located in the first frequency band.
9. The method of claim 1, wherein each set of the sample discrete data includes a sample frequency and a sample target gain thereof; the obtaining a response difference between the actual amplitude-frequency response of the sample filter and the target amplitude-frequency response of the sample comprises:
acquiring a sample actual gain of the sample frequency based on the sample actual 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.
10. 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 using the filter construction method according to any one of claims 1 to 9;
and processing the audio to be processed by using the target filter to obtain target audio.
11. An electronic device comprising a memory and a processor coupled to each other, the memory having stored therein program instructions for executing the program instructions to implement the filter construction method of any one of claims 1 to 9 or to implement the audio processing method of claim 10.
12. A storage device storing program instructions executable by a processor for implementing the filter construction method according to any one of claims 1 to 9 or the audio processing method according to claim 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011565847.6A CN112769410B (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 CN112769410B (en) | 2020-12-25 | 2020-12-25 | Filter construction method, audio processing method, electronic equipment and storage device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112769410A CN112769410A (en) | 2021-05-07 |
CN112769410B true CN112769410B (en) | 2024-06-11 |
Family
ID=75694534
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011565847.6A Active CN112769410B (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) | CN112769410B (en) |
Citations (23)
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 |
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 |
CN108111956A (en) * | 2017-12-26 | 2018-06-01 | 广州励丰文化科技股份有限公司 | A kind of sound equipment adjustment method and device based on amplitude-frequency response |
CN108111443A (en) * | 2016-11-25 | 2018-06-01 | 电信科学技术研究院 | A kind of method and device of definite voice link parametric equalizer tuning parameter |
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 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5321263B2 (en) * | 2009-06-12 | 2013-10-23 | ソニー株式会社 | Signal processing apparatus and signal processing method |
-
2020
- 2020-12-25 CN CN202011565847.6A patent/CN112769410B/en active Active
Patent Citations (23)
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 |
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)
Title |
---|
A pre-distortion based design method for digital audio graphic equalizer;Chen, Z等;《DIGITAL SIGNAL PROCESSING》;20140219;全文 * |
基于频率转移的数字助听器单通道响度补偿算法;李战明;张璇;;电子设计工程;20170305(05);全文 * |
数字助听器中多通道响度补偿方法的研究;张宝琳;张玲华;;信号处理;20130525(05);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112769410A (en) | 2021-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106535039B (en) | Audio signal compensation based on loudness | |
CN106658284B (en) | Addition of virtual bass in the frequency domain | |
Rämö et al. | High-precision parallel graphic equalizer | |
TW201214418A (en) | Monaural noise suppression based on computational auditory scene analysis | |
US20130108062A1 (en) | Device and method for diagnosing audio circuitry | |
US7602925B2 (en) | Audio feedback processing system | |
CN104980337A (en) | Method and device for improving audio processing performance | |
CN104410379A (en) | A volume adjusting method | |
Paatero et al. | Kautz filters and generalized frequency resolution: Theory and audio applications | |
CN101577848A (en) | Supper bass boosting method and system | |
CN107682802B (en) | Method and device for debugging sound effect of audio equipment | |
GB2585086A (en) | Pre-processing for automatic speech recognition | |
CN112769410B (en) | Filter construction method, audio processing method, electronic equipment and storage device | |
JP5774191B2 (en) | Method and apparatus for attenuating dominant frequencies in an audio signal | |
Bank | Logarithmic frequency scale parallel filter design with complex and magnitude-only specifications | |
CN117153174A (en) | Audio dynamic equalization method, electronic device and storage medium | |
US10904662B2 (en) | Frequency-based audio amplification | |
Belloch et al. | Efficient target-response interpolation for a graphic equalizer | |
Dodds | A flexible numerical optimization approach to the design of biquad filter cascades | |
CN106549652A (en) | Filter coefficient update in time-domain filtering | |
CN109754825A (en) | A kind of audio-frequency processing method, device and equipment | |
Lee et al. | Effective bass enhancement using second-order adaptive notch filter | |
CN108806711A (en) | A kind of extracting method and device | |
CN114420153A (en) | Sound quality adjusting method, device, equipment and storage medium | |
Tyril et al. | Digital filters for low-frequency equalization |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |