An adaptive sound equalization calibration method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]1.算法效率不足:部分音响自校准算法复杂度较高,依赖大规模运算,导致在资源受限的嵌入式平台上运行效率低下,校准耗时较长使得用户体验下降
[0067]1.低资源占用:算法采用轻量级多项式拟合和迭代峰值抑制逻辑,能够在资源受限的嵌入式平台(如ARM Cortex-M4)上高效运行。单次校准过程耗时5秒,计算开销极低,适用于实时应用。
Smart Images

Figure CN120711339B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of self-calibration technology, and in particular to an adaptive audio equalization calibration method. Background Technology
[0002] Audio self-calibration technology is a method that automatically optimizes the frequency response of an audio system through algorithms to improve sound quality in different acoustic environments. This technology uses microphones to collect ambient sound field data, analyzes the characteristics of the frequency response, and generates equalization filter parameters to correct fluctuations in the frequency response, thereby improving the consistency of audio output. Currently, this technology is widely used in professional recording studios, consumer audio systems, and smart home devices.
[0003] The self-calibration process typically involves: exciting the audio equipment with a specific test signal (such as a sweep signal or noise signal), collecting environmental response data, and calculating the target frequency response curve based on this data. The algorithm then designs filters to adjust the frequency response to approximate the target curve. To meet diverse application needs, calibration must balance high-precision measurement with adaptation to complex scenarios. For example, professional recording studios require precise calibration in a fixed location, while home environments need to adapt to varying listening areas.
[0004] The existing technology has the following problems:
[0005] 1. Insufficient algorithm efficiency: Some audio self-calibration algorithms are highly complex and rely on large-scale computation, resulting in low efficiency on resource-constrained embedded platforms. The long calibration time degrades the user experience.
[0006] 2. Limited flexibility of test signals: Existing technologies mostly use a single test signal mode, which makes it difficult to simultaneously meet the needs of high-precision measurement at fixed locations and dynamic area adaptation, thus limiting the applicability to multiple scenarios.
[0007] 3. Limitations of target frequency response generation: Some algorithms rely on preset templates or external reference data (such as standard curves) to generate target frequency response curves. When facing complex acoustic environments, the configuration is complicated and the universality is poor.
[0008] 4. Filter design issues: Some algorithms generate too many filters to process multiple frequency fluctuations at once, which may lead to over-adjustment of the frequency response and affect the listening experience. In addition, existing algorithms often rely on simple rules (such as fixed Q value) or empirical parameters (based on preset values) when estimating adjustment bandwidth, rather than dynamically adjusting according to the characteristics of the actual sound field data. This makes it difficult to accurately capture peak characteristics and the calibration effect is unstable.
[0009] 5. Insufficient gain and parameter optimization: Some algorithms do not effectively constrain the gain amplitude, which can easily introduce excessive positive gain and cause distortion (such as clipping); at the same time, the filter parameters are not sufficiently optimized to match the characteristics of human ear perception, resulting in poor listening experience of the calibration results. Summary of the Invention
[0010] In view of this, this application provides an adaptive audio equalization calibration method.
[0011] This application discloses an adaptive audio equalization calibration method, which includes:
[0012] Step 1: Acquire the audio signal from the audio system and perform a short-time Fourier transform on it to obtain the frequency response curve;
[0013] Step 2: Calculate a target level based on the frequency response curve for calibration;
[0014] Step 3: Smooth the acquired frequency response curve;
[0015] Step 4: Determine if there are peak values greater than the threshold in the smoothed frequency response curve. If so, find the largest peak among all peak values, calculate its frequency, peak height, and half-width at half-peak, extract frequency response curve data within the range of the half-width, perform binomial fitting, construct the intersection point between the fitted curve and the peak value at a specified percentage decrease in height to obtain two boundary frequencies, and calculate the bandwidth and quality factor of the largest peak. The frequency corresponding to the largest peak is the center frequency; the gain of the largest peak is the magnitude by which the peak value of the largest peak exceeds the target level in Step 2; the peak filter parameters include center frequency, quality factor, and gain.
[0016] Step 5: Based on the peak filter parameters, simulate the impact of the current peak filter on the frequency response using a Gaussian function, and superimpose its impact onto the smoothed frequency response curve from Step 3 to obtain the adjusted new frequency response curve for the next iteration; and save the parameters of the current peak filter to the filter parameter group, then proceed to Step 4;
[0017] Step 6: If the number of iterations is greater than or equal to the preset value, the iteration ends and the filter parameter set of all saved peak filters is output. Several peak filters are configured using this filter parameter set.
[0018] Step 7: Input the audio signal into several pre-configured peak filters to obtain the equalized and calibrated audio signal.
[0019] Further, step 2 includes:
[0020] Select frequency band data within a specified frequency range from the frequency response data collected in step 1, calculate the average value of all amplitude values within that frequency band data, and use this average value as the target level of the frequency response curve; the target level represents the target frequency response level.
[0021] Further, step 3 includes:
[0022] For each frequency point of the frequency response collected in step 2, calculate its k-octave frequency range. Within this frequency range, take the average value of all amplitude values and use this average value to replace the amplitude value of the corresponding frequency point in the original frequency response curve.
[0023] Further, step 4 includes:
[0024] The frequency point of the peak filter is called to store the peak filter parameters, including the center frequency, quality factor, and gain. For the smoothed frequency response curve, the process of significant peak detection, selection of priority processing value, local data extraction and fitting, calculation of bandwidth and quality factor, calculation of gain, simulation and update of filter effect, and parameter saving is repeated until the number of iterations reaches the preset value or there are no significant peaks that need to be processed.
[0025] Furthermore, the saliency peak detection includes:
[0026] The frequency response curve is compared with the neighborhood, all local extreme points are extracted and used as peak points, the rise of each peak point relative to its neighborhood baseline is calculated, i.e., the rise degree, and a minimum rise threshold is set to filter out unstructured anomalies caused by relevant factors; for each valid peak, its half width at half maximum is estimated; relevant factors include environmental noise and fluctuations.
[0027] The selection of priority processing values includes:
[0028] From all the detected peaks, select the peak with the strongest current energy, i.e. the point with the largest amplitude, as the priority processing target.
[0029] Furthermore, the local data extraction and fitting includes:
[0030] Centered on the center frequency of the peak value f c Using the full width at half maximum (FWHM) as the range, extract local frequency response data {(f i ,R i The model is fitted using a quadratic polynomial model.
[0031] R i ≈af i 2 +bf i +c
[0032] Where {a,b,c} are the coefficients of the polynomial to be determined, satisfying the least squares criterion:
[0033]
[0034] By solving the least squares problem, a local response model is established to describe the shape of the peak:
[0035]
[0036] Where i = 1, 2, ..., N, f i R is the frequency of the i-th frequency point. i Let N be the amplitude corresponding to the i-th frequency point, and N be the total number of frequency points. This represents the peak value corresponding to frequency f.
[0037] Furthermore, the computational bandwidth and quality factor include:
[0038] Construction reference line:
[0039] Let the amplitude of the current peak be R. peak In the fitted curve Construct a constant reference line based on this: R ref =R peak -3dB
[0040] Find the intersection points:
[0041] Setting the quadratic fitted curve equal to the constant reference line, we obtain the quadratic equation:
[0042]
[0043] af 2 +bf+c-(R peak -3)=0
[0044] Solve for the two real roots f1 and f2 of this quadratic equation, which correspond to the -3dB boundary frequency.
[0045] Calculate bandwidth and quality factor:
[0046] Bandwidth: BW = |f2 - f1|
[0047] Quality Factor:
[0048] Among them, f c The center frequency of the peak value.
[0049] Further, the calculation of gain includes:
[0050] Calculate the difference between the current peak amplitude and the target level. Perform negative attenuation only on frequency bands with excessive energy, i.e., the portion where the peak amplitude is higher than the target level. The gain value is the difference. Limit the maximum attenuation to a specified decibel.
[0051] The filter effect simulation and update include:
[0052] The effect of using a Gaussian function to approximate the filter on the frequency response:
[0053] The filter parameters obtained in each iteration include the center frequency f. c Given bandwidth BW and gain Gain, construct the following Gaussian function:
[0054]
[0055] in, That is, half of the bandwidth is used to control the spread width of the Gaussian function;
[0056] The effect of the Gaussian function is superimposed onto the current frequency response curve to simulate the frequency response curve after the filter adjustment; the updated frequency response curve is used as the input for the next iteration.
[0057] The parameter storage includes:
[0058] Save the peak filter parameters generated in the current round to an array.
[0059] Furthermore, step 4 also includes:
[0060] If there are no peak values greater than the threshold in the smoothed frequency response curve, skip directly to step 6;
[0061] If a good fit cannot be achieved, use an empirical method to set the quality factor.
[0062] Furthermore, in step 6, the filter array is used to configure several peak filters, including:
[0063] Based on the parameters of the peak filter in the filter array, the digital angular frequency, gain coefficient, and filter bandwidth factor are obtained.
[0064] The coefficients of the peak filter are obtained based on the digital angular frequency, gain coefficient, and filter bandwidth factor.
[0065] Divide all coefficients of the peak filter by a specified value to normalize them, resulting in the final peak filter coefficients. Use these final peak filter coefficients to configure the peak filter; the specified value is one of all the coefficients before normalization.
[0066] Due to the adoption of the above technical solution, this application has the following advantages: While overcoming the limitations of the prior art, this application optimizes performance for diverse application scenarios and achieves the following main technical effects:
[0067] 1. Low resource consumption: The algorithm employs lightweight polynomial fitting and iterative peak suppression logic, enabling efficient operation on resource-constrained embedded platforms (such as ARM Cortex-M4). A single calibration process takes only 5 seconds, with extremely low computational overhead, making it suitable for real-time applications.
[0068] 2. Dual-mode signal acquisition, adaptable to multiple scenarios: The algorithm supports two different signal acquisition modes to meet different usage requirements.
[0069] Sweep signal mode: Suitable for high-precision frequency response measurement at a fixed listening position, meeting the stringent requirements of professional recording studios.
[0070] Handheld Pink Noise Mode: By moving the microphone within the listening area, the noise level is collected, simulating multi-location averaging. This effectively solves the measurement problem of "no fixed best listening position" in the home environment, reduces the complexity of device deployment, and improves adaptability to dynamic acoustic environments.
[0071] 3. Adaptive Target Frequency Response Extraction: The algorithm calculates the actual average response in the 500Hz to 2000Hz frequency band as the target frequency response curve, without relying on a preset ideal curve or external reference sound field data. This adaptive method simplifies the deployment process and enhances versatility in different acoustic environments, making it more convenient and universal compared to traditional methods that require the "frequency response difference between the reference sound field and the current sound field".
[0072] 4. Iterative Priority for Significant Peaks to Optimize Filtering Efficiency and Sound Quality: The algorithm employs an iterative peak-shaving strategy, processing only the most significant peaks in each round. Compared to identifying multiple peaks and configuring multiple filters at once, this effectively controls the number of equalization filters and avoids over-correction of the frequency response curve. Each iteration updates the adjusted frequency response curve, dynamically approximating the target response, ensuring controllable filter parameters and improving the naturalness of the sound.
[0073] 5. Bandwidth estimation based on fitting and real root solution: For each peak region, the bandwidth is accurately estimated by fitting a quadratic polynomial curve and calculating the intersection frequency with the -3dB level. Compared with the coarse estimation methods in existing technologies that rely on "difference between adjacent valleys" or "half-amplitude energy points," this method has higher accuracy and stronger stability. If the fitting fails, it automatically reverts to the empirical Q value (e.g., Q≤10 for low frequencies and Q≤5 for mid frequencies), balancing accuracy and robustness.
[0074] 6. Optimization for Embedded Applications: To avoid multiple frequency domain filtering operations, each iteration uses a Gaussian function corresponding to the equalization parameters to approximate the filter's impact on the frequency response. The Gaussian function, with center frequency, bandwidth, and gain as control parameters, quickly updates the current frequency response by superposition, eliminating the need for real-time construction or calculation of the dual second-order filter response. This method significantly reduces computational complexity and resource consumption, making it particularly suitable for embedded applications.
[0075] 7. Controllable Gain: The algorithm only performs peak clipping (negative gain) and does not boost valley values, avoiding compression, clipping, or coloration distortion caused by positive gain. The maximum gain attenuation is set to -12dB to control the filtering intensity and prevent sound quality loss. Both gain and Q value have frequency band constraint logic (e.g., low-frequency Q≤10, mid-frequency Q≤5), which conforms to the characteristics of human hearing perception and further optimizes the naturalness and comfort of the listening experience. Attached Figure Description
[0076] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0077] Figure 1 This is a flowchart illustrating an adaptive audio equalization calibration method according to an embodiment of this application. Detailed Implementation
[0078] The present application will be further described in conjunction with the accompanying drawings and embodiments. The described embodiments are only some, not all, of the embodiments of the present application. All other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of the present application.
[0079] See Figure 1 This application provides an embodiment of an adaptive audio equalization calibration method, which includes:
[0080] S1: Acquire the audio signal from the audio system and perform a short-time Fourier transform on it to obtain the frequency response curve;
[0081] In this embodiment, either mode A (sweep signal acquisition) or mode B (pink noise acquisition) is selected to acquire the frequency response curve of the audio system, providing basic data for subsequent analysis.
[0082] Regarding Method A: Frequency sweep signal acquisition, the operation procedure is as follows:
[0083] 1. Fix the microphone at a typical listening point of the audio system (such as where the user usually sits) to ensure that the microphone position is stable.
[0084] 2. Play a sweep signal (chirp) three times with a duration of 2 seconds each. The sweep signal gradually changes from a low frequency (e.g., 20Hz) to a high frequency (e.g., 20kHz), and the change can be linear or logarithmic.
[0085] 3. The microphone simultaneously captures the response signals from these three playbacks and records the audio data for each playback.
[0086] The data processing involved in method A is as follows:
[0087] 1. Perform a short-time Fourier transform (STFT) on the acquired signal to convert the time-domain signal into the frequency domain and extract the steady-state frequency response characteristics of the system under static conditions.
[0088] 2. The average value of the three frequency response data is taken to reduce the impact of transient interference in the environment (such as sudden background noise or brief sound wave reflection) on the frequency response estimation.
[0089] Advantages: This method is suitable for use in static environments. Multiple averaging can improve the accuracy of frequency response estimation and reduce noise interference.
[0090] Method B: Pink noise acquisition, the operation procedure is as follows:
[0091] Playing a pink noise signal, pink noise is characterized by its power spectral density decreasing as the frequency increases, simulating the frequency distribution of natural sound.
[0092] The user holds the microphone and slowly moves or rotates it within a typical listening area, such as moving it forward, backward, left, or right around the listening point, or rotating it around a center point to cover multiple angles.
[0093] The data processing involved in method B is as follows:
[0094] From the collected audio data, select the middle 10 seconds of stable audio as the analysis object, and remove the potentially unstable parts at the beginning and end (such as the shaking when the user first starts moving).
[0095] Perform a short-time Fourier transform (STFT) on this 10-second audio file to extract the frequency response curve.
[0096] By using spatial moving average (i.e., smoothing data collected from different locations), the effects of standing waves (frequency distortion caused by room reflections) and local anomalies (such as echoes at a certain location) can be reduced.
[0097] Advantages: This approach is suitable for dynamic environments, improves the spatial robustness of frequency response estimation through spatial averaging, and can better reflect the overall acoustic characteristics of the room.
[0098] Output a: Both methods will generate a frequency response curve, which includes a frequency axis (usually from 20Hz to 20kHz) and the corresponding amplitude value (in decibels).
[0099] S2: Calculate a target level based on the frequency response curve for calibration.
[0100] In this embodiment of the application, the adjustment target of the audio system is defined by analyzing the frequency response data of a specific frequency band. The operation process is as follows:
[0101] 1. Select the frequency band data from 500Hz to 2000Hz from the frequency response data collected by S1 (the data here corresponds to output a).
[0102] 2. Calculate the average value of all amplitude values within the frequency band, and use this average value as the target level of the target frequency response curve for subsequent frequency response calibration and peak filter parameter adjustment.
[0103] Output b: A scalar value representing the target frequency response level (in decibels), which serves as a reference standard for subsequent adjustments.
[0104] S3: Smooth the acquired frequency response curve;
[0105] In this embodiment, the frequency response curve is smoothed to reduce the impact of noise and spikes while preserving the main trend. The operation process is as follows:
[0106] 1. For each frequency point of the frequency response (corresponding to output a) collected by S2, calculate its frequency range of 1 / 6 octave (i.e., a small frequency window, with the upper and lower limits based on the logarithmic scale of the current frequency).
[0107] 2. Within this frequency range, take the average of all amplitude values.
[0108] 3. Replace the amplitude value of that frequency point in the original curve with the calculated average value.
[0109] Objective: Smoothing can reduce the impact of frequency spikes (such as local amplification caused by standing waves) while preserving the overall trend of the frequency response curve and avoiding noise interference in subsequent steps.
[0110] Output c: The smoothed frequency response curve, which is smoother than the original curve and is suitable for further analysis.
[0111] S4: Determine if there are peak values greater than the threshold in the smoothed frequency response curve. If so, find the largest peak among all peak values, calculate its frequency, peak height, and half-width at half-peak, extract frequency response curve data within the range of the half-width, perform binomial fitting, construct the intersection point between the fitted curve and the peak value at a specified percentage height, obtain two boundary frequencies, calculate the bandwidth and quality factor of the largest peak; obtain the center frequency based on the bandwidth; the gain of the largest peak is the magnitude by which the peak value of the largest peak exceeds the target level of S2; the peak filter parameters include center frequency, quality factor, and gain;
[0112] In this embodiment, the parameters of the peak filter are generated through an iterative process, and the frequency response curve is gradually adjusted to approximate the target level (corresponding to output b) until a preset number of iterations (e.g., 10 iterations) are reached. The overall process is as follows: 1. A peak filter frequency is called to store the subsequent peak filter parameters, including the center frequency, quality factor, and gain. 2. For the smoothed frequency response curve (corresponding to output c), the following sub-steps (S4.1 to S4.7) are repeated until the number of iterations reaches 10, or no significant peaks can be processed.
[0113] Step S4 includes S4.1 to S4.7, as follows:
[0114] S4.1: Significance Peak Detection:
[0115] Overview: The detection process for significant peaks is based on a combined strategy of "local maxima + spuriousness criterion". All local extrema are extracted by performing neighborhood comparisons on the frequency response curve. Then, the rise (spuriousness) of each peak point relative to its left and right neighborhood baselines is calculated, and a minimum spuriousness threshold is set to filter out unstructured anomalies caused by environmental noise, fluctuations, and other factors. For each valid peak, its half-width at half-maximum (HWHM) is further estimated to provide basic data for subsequent bandwidth and Q-value calculations.
[0116] Scope: Processing is only applied to frequency bands below 500Hz, as significant peaking issues, such as low-frequency resonance, are more likely to occur in low-frequency bands.
[0117] The specific operating procedure for S4.1 is as follows:
[0118] S4.11: Local Maximum Identification:
[0119] The function first iterates through the input signal data sequence {x1, x2, ..., x...} N-1 ,x N For each point in}, find points that satisfy the following conditions:
[0120] x n >x n-1 And x n >xn+1
[0121] That is, the point x n This is a local maximum and is taken as a local peak. This can be achieved through first-order difference sign changes or sliding window comparisons.
[0122] S4.12: Protrusion Calculation:
[0123] For each local peak point, calculate its "prominence," which is the minimum height difference between that point and the bottoms of its left and right envelope valleys. The calculation steps include:
[0124] Traverse the signal left and right to find the minimum value between the current peak and the nearest higher peak on either side; subtract this local trough value from the current peak amplitude to obtain the prominence; if the prominence is less than a set threshold (e.g., 1 dB), the peak is considered insignificant and discarded. Ensure that only peaks with obvious rise characteristics are retained, and filter out false peaks caused by minor fluctuations or random noise.
[0125] S4.13: Calculate peak width:
[0126] (1) Based on the significance value of the peak, the measurement height of the peak width is determined to be half of the peak height minus the prominence, that is, from the peak amplitude down to half the height of its significance value.
[0127] (2) Width boundary positioning:
[0128] Left boundary: Move to the left from the peak point to find the position where the signal amplitude is first equal to or lower than the measurement height.
[0129] Right boundary: Move to the right from the peak point to find the position where the signal amplitude is first equal to or lower than the measurement height.
[0130] (3) Calculate peak width:
[0131] Based on the physical coordinates of the signal's horizontal axis (such as frequency value), calculate the distance between the left and right boundaries to obtain the peak width at the half-significance height.
[0132] Output d1: A list of peaks, containing the center frequency and half-width at half-maximum (HWHM) information for each peak. Here, HWHM refers to half the height of the peak, and HWHM refers to the bandwidth corresponding to half the height of the peak.
[0133] S4.2: Select the priority value:
[0134] From all detected peaks (corresponding to all peaks in the peak list of output d1), the peak with the strongest current energy (i.e., the point with the largest amplitude) is selected as the priority for processing. This step ensures that the self-calibration process focuses on the most significant frequency anomaly region, avoiding processing minor issues. Output d2: Information on the peak currently being processed, including its center frequency and amplitude value.
[0135] S4.3: Local Data Extraction and Fitting
[0136] Centered on the center frequency of the peak value f c (corresponding to the center frequency in output d2), extract local frequency response data with a half-width ratio of 500x50 (F). i ,R i (That is, focusing only on a small segment of the frequency response curve near the peak), and fitting it with a quadratic polynomial model:
[0137] R i ≈af i 2 +bf i +c(i=1,2,...,N)
[0138] Where {a,b,c} are the coefficients of the polynomial to be determined, satisfying the least squares criterion:
[0139]
[0140] By solving the above least squares problem, a local response model is established to describe the shape of the peak:
[0141]
[0142] Among them, f i R is the frequency of the i-th frequency point. i Let N be the amplitude corresponding to the i-th frequency point, and N be the total number of frequency points. This represents the peak value corresponding to frequency f.
[0143] Output d3: The fitted quadratic function (Used to represent this curve), for subsequent calculations.
[0144] S4.4: Calculate bandwidth and quality factor:
[0145] Bandwidth describes the effective frequency range covered by a peak in a frequency response curve, and is usually calculated using the "-3dB method". "-3dB" means that the amplitude at that frequency point drops by 3 decibels, equivalent to halving the signal power, which is a standard critical point in audio filter design.
[0146] S4.4 includes the following steps S4.41 to S4.43:
[0147] S4.41: Construction Reference Line:
[0148] Let the current peak amplitude be R. peak In the fitted curve Construct a constant reference line based on (corresponding to output d3):
[0149] R ref =R peak -3dB
[0150] S4.42: Solve for the intersection points:
[0151] Equalizing the quadratic fitted curve with the reference line, we obtain the quadratic equation:
[0152]
[0153] af 2 +bf+c-(R peak -3)=0
[0154] Solve for the two real roots f1 and f2 of the equation, which correspond to the -3dB boundary frequency.
[0155] S4.43: Calculate bandwidth and quality factor:
[0156] Bandwidth: BW = |f2 - f1|
[0157] Quality Factor:
[0158] Among them, f c The center frequency of the peak value.
[0159] Regarding exception handling in S4.4:
[0160] If the fitted quadratic function cannot provide two valid intersection points (e.g., blurred peak shapes or data anomalies), use the rule of thumb: if the center frequency is below 200Hz, set the quality factor to 10; otherwise, set the quality factor to 5 (the default value).
[0161] Output d4: bandwidth and quality factor.
[0162] S4.5: Calculate the gain:
[0163] Calculate the difference between the current peak amplitude and the target level (corresponding to output b). Perform negative attenuation only on frequency bands with excessive energy (i.e., the portion where the peak amplitude exceeds the target level), with the gain value being the difference. Limit the maximum attenuation to -12 dB to avoid excessive attenuation that could degrade audio quality. Avoid positive gain (i.e., do not increase the amplitude) to prevent compression or distortion issues in the system.
[0164] Output d5: Gain value (in decibels, usually a negative value).
[0165] S4.6: Simulation and Update of Filter Effects
[0166] The effect of using a Gaussian function to approximate the peak filter on the frequency response: For the peak filter parameter set obtained in each iteration (center frequency f) c (corresponding to output d2), bandwidth BW (corresponding to output d4), gain Gain (corresponding to output d5), construct the following Gaussian function:
[0167]
[0168] in, That is, half of the bandwidth is used to control the spread width of the Gaussian function.
[0169] The Gaussian function effect is superimposed onto the current frequency response curve to simulate the frequency response after filter adjustment. The updated frequency response curve serves as the input for the next iteration. The updated frequency response curve is then output.
[0170] S4.7: Parameter saving:
[0171] Save the parameters of the peak filter generated in the current round (center frequency (corresponding to the center frequency in output d2), quality factor (corresponding to the quality factor in output d4), and gain value (corresponding to output d5)) to an array.
[0172] Output: Peak filter parameter set, recording all generated parameters.
[0173] The iteration control in step S4 is as follows:
[0174] Each iteration weakens the most significant peak, gradually bringing the frequency response curve closer to the target level. A maximum of 10 iterations can be performed. The iteration ends when no significant peaks can be addressed (e.g., all peaks have been weakened below the target level) or the maximum number of iterations has been reached.
[0175] S5: Based on the peak filter parameters, simulate the impact of the current peak filter on the frequency response using a Gaussian function, and superimpose its impact onto the smoothed frequency response curve in S3 to obtain the adjusted new frequency response curve for the next iteration, then proceed to S4;
[0176] S6: If the number of iterations is greater than or equal to the preset value, the iteration ends and the peak filter parameter group consisting of all the saved peak filters is output. Several peak filters are configured using this peak filter parameter group.
[0177] In this embodiment of the application, each set of peak filter parameters generated by the aforementioned algorithm includes the center frequency f.c The center frequency (corresponding to output d2), quality factor Q (corresponding to output d4), and gain (corresponding to output d5) are converted into biquad filter coefficients that can be directly deployed in digital audio processing.
[0178] The specific operating procedure is as follows:
[0179] 1. Calculate intermediate variables:
[0180] Set the sampling rate to f s The intermediate variable is defined as follows:
[0181] Digital angular frequency:
[0182]
[0183] Gain coefficient:
[0184] A = 10 G / 40
[0185] Filter bandwidth factor:
[0186]
[0187] 2. Calculate the peak filter coefficients:
[0188] The time-domain form of audio processing using a dual second-order filter is as follows (difference equation):
[0189] y(n)=b0*x(n)+b1*x(n-1)+b2*x(n-2)-a1*y(n-1)-a2*y(n-2)
[0190] The corresponding transfer function in the Z-domain is:
[0191]
[0192] The coefficients are usually normalized by dividing both the numerator and denominator by a0 to recalculate the coefficients, such that a0 = 1.
[0193]
[0194] 3. Calculate the peak filter coefficients:
[0195] This application primarily uses a peak filter:
[0196] b0=1+αA
[0197] b1 = -2cos(ω0)
[0198] b2=1-αA
[0199]
[0200] a1 = -2cos(ω0)
[0201]
[0202] Divide all coefficients by a0 and normalize to obtain the final filter coefficients:
[0203]
[0204] Finally, the filter coefficient array {b0′,b1′,b2′,a1′,a′2} is obtained, which is used to construct a bi-second-order filter structure.
[0205] Dual second-order filters have the advantages of high computational efficiency and adjustable amplitude response, and are widely used in audio equalization systems.
[0206] S7: Input the audio signal into several pre-configured peak filters to obtain the equalized audio signal. Several peak filters can form an equalizer (EQ).
[0207] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and not to limit them. Although this application has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of this application. Any modifications or equivalent substitutions that do not depart from the spirit and scope of this application should be covered within the protection scope of the claims of this application.
Claims
1. An adaptive audio equalization calibration method, characterized in that, include: Step 1: Acquire the audio signal from the audio system and perform a short-time Fourier transform on it to obtain the frequency response curve; Step 2: Calculate a target level based on the frequency response curve for calibration; Step 3: Smooth the acquired frequency response curve; Step 4: Determine if there are peak values greater than the threshold in the smoothed frequency response curve. If so, find the largest peak among all peak values, calculate its frequency, peak height, and half-width at half-peak, extract frequency response curve data within the range of the half-width, perform binomial fitting, construct the intersection point between the fitted curve and the peak value at a specified percentage decrease in height to obtain two boundary frequencies, and calculate the bandwidth and quality factor of the largest peak. The frequency corresponding to the largest peak is the center frequency; the gain of the largest peak is the magnitude by which the peak value of the largest peak exceeds the target level in Step 2; the peak filter parameters include center frequency, quality factor, and gain. Step 5: Based on the peak filter parameters, simulate the impact of the current peak filter on the frequency response using a Gaussian function, and superimpose its impact onto the smoothed frequency response curve from Step 3 to obtain the adjusted new frequency response curve for the next iteration; and save the parameters of the current peak filter to the filter parameter group, then proceed to Step 4; Step 6: If the number of iterations is greater than or equal to the preset value, the iteration ends and the filter parameter set of all saved peak filters is output. Several peak filters are configured using this filter parameter set. Step 7: Input the audio signal into several pre-configured peak filters to obtain the equalized and calibrated audio signal.
2. The method according to claim 1, characterized in that, Step 2 includes: Select frequency band data within a specified frequency range from the frequency response data collected in step 1, calculate the average value of all amplitude values within that frequency band data, and use this average value as the target level of the frequency response curve; the target level represents the target frequency response level.
3. The method according to claim 1, characterized in that, Step 3 includes: For each frequency point of the frequency response collected in step 2, calculate its k-octave frequency range. Within this frequency range, take the average value of all amplitude values and use this average value to replace the amplitude value of the corresponding frequency point in the original frequency response curve.
4. The method according to claim 1, characterized in that, Step 4 includes: The frequency point of the peak filter is called to store the peak filter parameters, including the center frequency, quality factor, and gain. For the smoothed frequency response curve, the process of significant peak detection, selection of priority processing value, local data extraction and fitting, calculation of bandwidth and quality factor, calculation of gain, simulation and update of filter effect, and parameter saving is repeated until the number of iterations reaches the preset value or there are no significant peaks that need to be processed.
5. The method according to claim 4, characterized in that, The saliency peak detection includes: The frequency response curve is compared with the neighborhood, all local extreme points are extracted and used as peak points, the rise of each peak point relative to its neighborhood baseline is calculated, i.e., the rise degree, and a minimum rise threshold is set to filter out unstructured anomalies caused by relevant factors; for each valid peak, its half width at half maximum is estimated; relevant factors include environmental noise and fluctuations. The selection of priority processing values includes: From all the detected peaks, select the peak with the strongest current energy, i.e. the point with the largest amplitude, as the priority processing target.
6. The method according to claim 4, characterized in that, The local data extraction and fitting includes: Centered on the center frequency of the peak value f c Using half-width at half-maximum (FWHM) as the range, extract local frequency response data {(f i ,R i The model is fitted using a quadratic polynomial model. R i ≈af i 2 +bf i +c Where {a,b,c} are the coefficients of the polynomial to be determined, satisfying the least squares criterion: By solving the least squares problem, a local response model is established to describe the shape of the peak: Where i = 1, 2, ..., N, f i Let R be the frequency of the i-th frequency point. i Let N be the amplitude corresponding to the i-th frequency point, and N be the total number of frequency points. This represents the peak value corresponding to frequency f.
7. The method according to claim 4, characterized in that, The computational bandwidth and quality factor include: Construction reference line: Let the amplitude of the current peak be R. peak In the fitted curve Construct a constant reference line based on this: R ref =R peak -3dB Find the intersection points: Setting the quadratic fitted curve equal to the constant reference line, we obtain the quadratic equation: of 2 +bf+c-(R peak -3)=0 Solve for the two real roots f1 and f2 of this quadratic equation, which correspond to the -3dB boundary frequency. Calculate bandwidth and quality factor: Bandwidth: BW = |f2 - f1| Quality Factor: Among them, f c The center frequency of the peak value.
8. The method according to claim 4, characterized in that, The calculated gain includes: Calculate the difference between the current peak amplitude and the target level. Perform negative attenuation only on frequency bands with excessive energy, i.e., the portion where the peak amplitude is higher than the target level. The gain value is the difference. Limit the maximum attenuation to a specified decibel. The filter effect simulation and update include: The effect of using a Gaussian function to approximate the filter on the frequency response: The filter parameters obtained in each iteration include the center frequency f. c Given bandwidth BW and gain Gain, construct the following Gaussian function: in, That is, half of the bandwidth is used to control the spread width of the Gaussian function; The effect of the Gaussian function is superimposed onto the current frequency response curve to simulate the frequency response curve after the filter adjustment; the updated frequency response curve is used as the input for the next iteration. The parameter storage includes: Save the peak filter parameters generated in the current round to an array.
9. The method according to claim 1, characterized in that, Step 4 also includes: If there are no peak values greater than the threshold in the smoothed frequency response curve, skip directly to step 6; If a good fit cannot be achieved, use an empirical method to set the quality factor.
10. The method according to claim 4, characterized in that, In step 6, the filter array is used to configure several peak filters, including: Based on the parameters of the peak filter in the filter array, the digital angular frequency, gain coefficient, and filter bandwidth factor are obtained. The coefficients of the peak filter are obtained based on the digital angular frequency, gain coefficient, and filter bandwidth factor. Divide all coefficients of the peak filter by a specified value to normalize them, resulting in the final peak filter coefficients. Use these final peak filter coefficients to configure the peak filter; the specified value is one of all the coefficients before normalization.
Citation Information
Patent Citations
Audio calibration method and device
CN117528382A
Improved frequency response fitting method and device and storage medium
CN118249781A