Earphone audio intelligent detection and optimization method
By detecting clipped segments in headphone audio signals, calculating severity indices, and combining this with a psychoacoustic model for signal reconstruction and frequency response compensation, the problem of residual distortion in headphone audio signals is solved, improving sound fidelity and listenability.
Patent Information
- Application Number
- CN202610108290.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-27
- Publication Date
- 2026-03-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies struggle to perfectly reproduce clipping distortion in headphone audio signal processing, resulting in residual distortion components that cannot distinguish between useful music signals and harmful residual distortion, thus affecting the overall sound quality optimization effect.
By detecting clipped segments in the audio signal and calculating the severity index, signal reconstruction and frequency response compensation are performed by combining the headphone target frequency response curve and psychoacoustic model. High-shelf filtering is used to suppress residual distortion and synergistically optimize headphone sound quality.
It improves the fidelity and listenability of audio signals, avoids the harshness caused by residual distortion amplification, and achieves a more outstanding improvement in sound quality.
Smart Images

Figure CN121603838A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of testing, and in particular relates to a method for intelligent detection and optimization of headphone audio. Background Technology
[0002] The sound quality of headphones is limited by factors such as structure, driver materials, and acoustic structure. Different headphone models often exhibit different frequency responses, meaning their ability to reproduce different frequencies is uneven, resulting in a deviation between the output sound and the original recording. To correct this deviation, the industry commonly uses frequency response compensation technology. This technology measures the actual frequency response curve of the headphones and compares it with a recognized target frequency response curve that better matches human hearing characteristics. Digital signal processing technology is then used to compensate for the difference between the two, thereby optimizing the headphone's sound quality. Furthermore, during the production and distribution of audio content, the amplitude of the audio signal may exceed the maximum value that a digital system can represent due to improper processing, resulting in clipping distortion. Clipping severely damages the integrity of the audio waveform, introducing a large number of harsh high-order harmonics, reducing audio fidelity and listenability. De-clipping and frequency response compensation are treated as two independent, sequentially executed modules. Existing de-clipping algorithms struggle to perfectly reconstruct clipped signals, and the processed signal often retains some distortion components input by the algorithm or those not completely eliminated. When a signal with residual distortion enters the subsequent frequency response compensation stage, the compensation algorithm may apply gain to the high-frequency components in order to correct the headphone's insufficient sensitivity in the high-frequency region. This gain strategy cannot distinguish between useful music signals and harmful residual distortion, thus amplifying the high-frequency distortion components as well. As a result, the output audio not only fails to improve but may become more harsh and unnatural, severely impacting the overall sound quality optimization. Existing technology lacks a mechanism that can consider both factors synergistically; that is, the frequency response compensation process cannot adjust the compensation strategy according to the degree of clipping damage to the audio signal. Summary of the Invention
[0003] This invention proposes an intelligent detection and optimization method for headphone audio to address the problem that existing technologies often fail to achieve perfect reproduction, and the processed signal usually retains some distortion components input by the algorithm or not completely eliminated, making it impossible to distinguish between useful music signals and harmful residual distortion, thus affecting the overall sound quality optimization effect. The method includes the following steps: Obtain the preset target frequency response curve of the headphones, the actual frequency response curve of the headphones, and the input audio signal; Detect clipped segments in the input audio signal and calculate a severity index representing the degree of clipping; Based on the non-clipping data before and after the clipped segment, the clipped segment is reconstructed by estimating the harmonic components to obtain the de-clipping audio signal. The frequency response compensation of the de-clipping audio signal is performed to obtain an optimized output audio signal. The frequency response compensation includes: Based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, and combined with the psychoacoustic model, parametric equalization is performed to correct the audible deviation. Based on the severity index, the optimized output audio signal is subjected to high-shelf filtering, wherein the higher the severity index, the lower the gain of the high-shelf filtering, thereby suppressing the high-frequency components of the residual clipping distortion input.
[0004] Optionally, detecting clipped segments in the input audio signal and calculating a severity index representing the degree of clipping includes: The normalized amplitude of the input audio signal is compared with a first preset positive threshold and a first preset negative threshold. When the number of consecutive sampling points whose amplitude exceeds the threshold reaches a first preset number of samples, it is determined that the clipping segment has started. The severity index is calculated as the percentage of the total number of sample points of all clipped segments to the total number of sample points of the frame within an audio frame of a preset duration.
[0005] Optionally, the step of reconstructing the signal of the clipped segment by estimating harmonic components based on the un-clipped data before and after the clipped segment includes: Extract a second preset number of non-clipping data sampling points before the starting point of the clipping segment, establish an autoregressive model of a preset order, and predict data of the same length as the clipping segment based on the model coefficients, which will be used as the harmonic components. Cubic spline interpolation is performed on the first and last two non-clipping data sampling points of the clipped segment to obtain the reference reconstructed signal; The reconstructed signal is obtained by adding the estimated harmonic components to the reference reconstructed signal or by weighted addition.
[0006] Optionally, the parametric equalization process to correct audible deviation based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, combined with a psychoacoustic model, includes: The frequency axis of the difference curve is mapped to the Buck scale, and the energy within a preset number of critical frequency bands is calculated. Based on the absolute hearing threshold curve in the ISO226:2003 acoustic standard and the spectral energy of the signal, calculate the masking threshold for each critical frequency band. Equalization is performed only on deviations in the difference curve where the absolute value of the amplitude exceeds the corresponding frequency band masking threshold.
[0007] Optionally, the equalization process for deviations in the difference curve whose absolute amplitude value exceeds the corresponding frequency band masking threshold includes: In the deviation portion exceeding the masking threshold, peaks and valleys with bandwidth less than a first preset bandwidth octave and absolute amplitude values greater than a second preset amplitude threshold are identified; For each peak, configure a peak-type equalization filter with a center frequency and Q value corresponding to that peak. For each valley point, configure a notch equalizer with a center frequency and Q value corresponding to that valley point; The absolute value of the gain of the equalization filter is equal to the absolute value of the amplitude at the corresponding peak or valley point, but in the opposite direction.
[0008] Optionally, the step of performing high-shelf filtering based on the severity index, wherein the higher the severity index, the lower the gain of the high-shelf filtering, includes: Set the center frequency of the high-shelf filter to the preset center frequency, and the Q value to the preset Q value; The gain G of the high-shelf filtering process, expressed in dB, is calculated using the following formula: , Wherein, S is the severity index; and These are the lower and upper limits of the preset severity index, respectively; and These are the preset gain values corresponding to the lower and upper limits of the severity index, respectively.
[0009] Optionally, the preset center frequency is a preset value, or a preset multiple of the estimated fundamental frequency, or a preset frequency offset higher than the centroid of the spectrum.
[0010] Optionally, the step of extracting a second preset number of non-clipping data sampling points before the starting point of the clipping segment, establishing an autoregressive model of a preset order, and predicting data of the same length as the clipping segment based on the model coefficients as the harmonic components, specifically involves: Let the non-clipping data sampling points of the second preset sample number be the signal sequence x(n), and the preset order be P; Initialize forward prediction error With backward prediction error All are signal sequences x(n); Perform iterations from i=1 to P. In the i-th iteration: Based on the (i-1)th order forward prediction error and backward prediction error The reflection coefficient of the i-th order is calculated. ; Using the Levinson-Durbin recurrence relation, based on the reflection coefficient And the model coefficients of order i-1 are used to update the autoregressive model coefficients of order i. ,j}; According to the reflectance coefficient Update the forward prediction error and the backward prediction error to obtain and This is for use in the next iteration; After the iteration is completed, the coefficients of the Pth-order autoregressive model are { ,j} are the model coefficients; j=1,2,...,P; Based on the P non-clipping data sampling points before the starting point of the clipped segment as the initial sequence, and according to the autoregressive model formula, the data sequence of the same length as the clipped segment is generated by recursively predicting point by point. The generated data sequence is used as the harmonic component.
[0011] Before reconstructing the signal from the clipped segment, the method further includes: Analyze the acoustic characteristics of the non-clipping data around the clipped segment to classify the signal type of the clipped segment as at least one of transient or steady-state signals; Based on the classification results, a matching signal reconstruction strategy is selected and executed for the clipped segment, wherein: If the signal type is a steady-state signal, then a prediction method based on an autoregressive model is used for reconstruction; If the signal type is a transient signal, then a nonlinear interpolation method based on envelope preservation is used for reconstruction.
[0012] The step of reconstructing the clipped segment by estimating harmonic components further includes: Based on the non-clipping data before the start point of the clipped segment, a forward prediction model is established and a forward prediction signal is generated; Based on the non-clipping data after the end point of the clipped segment, a backward prediction model is established and a backward prediction signal is generated; The forward prediction signal and the backward prediction signal are weighted and fused to obtain the harmonic component, wherein the weights are dynamically adjusted according to the relative position of the prediction point within the clipping segment.
[0013] This invention integrates de-clipping processing with frequency response compensation. By assessing the degree of clipping damage in the input audio and adjusting the high-frequency processing in subsequent frequency response compensation accordingly, it reduces the gain of high-frequency components when processing severely clipped signals, thereby suppressing the problem of improper amplification of distortion and artifacts that may remain after the de-clipping algorithm. While correcting the inherent frequency response defects of the headphones, it avoids the harsh and unnatural listening experience caused by residual distortion amplification in the output audio, improving the fidelity and listenability of the audio signal. It achieves synergistic optimization of audio content damage and playback device defects, resulting in a more outstanding overall sound quality improvement. Attached Figure Description
[0014] Figure 1 A flowchart of the first embodiment; Figure 2 This is a schematic diagram of audio signal clipping. Figure 3 This is a schematic diagram of the frequency response curve and the difference compensation. Figure 4 A schematic diagram of equilibrium based on a psychological model. Figure 5 This is a schematic diagram of the high-shelf type filter response; Figure 6 This is a diagram illustrating the severity index and gain. Detailed Implementation
[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0016] In the first embodiment, the present invention proposes a method for intelligent detection and optimization of headphone audio, such as... Figure 1 This includes the following steps: S1, Obtain the preset target frequency response curve of the headphones, the actual frequency response curve of the headphones, and the input audio signal; Specifically, the target frequency response curve of the headphones, such as the Harman target curve, is pre-stored in the device's memory as an ideal listening standard. The actual frequency response curve of the headphones is obtained by playing test signals such as swept sine waves and recording the response using professional acoustic measurement equipment, such as a head and shoulder simulator and a measurement microphone, and is also stored in the form of a data file. The input audio signal is input to the processing system in real time in the form of pulse code modulation, i.e., PCM digital audio stream.
[0017] S2, detect clipped segments in the input audio signal and calculate a severity index representing the degree of clipping; Specifically, the input audio signal is processed in fixed-length audio frames, for example, each frame contains 1024 sampling points. Within each frame, all sampling points are traversed, and the number of samples whose amplitude is equal to or greater than the maximum representation level, such as 1.0 or -1.0, is counted. This number is divided by the total number of samples in the frame, 1024, to obtain a ratio between 0 and 1. This ratio is the severity index of the current frame. If multiple consecutive samples reach the maximum representation level, the segment is determined to be a clipped segment.
[0018] In an optional embodiment, detecting clipped segments in the input audio signal and calculating a severity index representing the degree of clipping includes: The normalized amplitude of the input audio signal is compared with a first preset positive threshold and a first preset negative threshold. When the number of consecutive sampling points whose amplitude exceeds the threshold reaches a first preset number of samples, it is determined that the clipping segment has started. The severity index is calculated as the percentage of the total number of sample points of all clipped segments to the total number of sample points of the frame within an audio frame of a preset duration.
[0019] The sampled values of the input 16-bit PCM audio signal are mapped to a floating-point range of -1.0 to 1.0 for normalization. A first preset positive threshold is set to 0.99, a first preset negative threshold to -0.99, and a first preset sample size of 4. The normalized audio signal is scanned point by point. When four or more consecutive sample points are detected with amplitudes greater than 0.99 or less than -0.99, the starting position of this series of consecutive sample points is marked as the start of a clipping segment. All consecutive points exceeding the threshold are considered clipped samples. Figure 2 .
[0020] After clipping point detection, a severity index is calculated for each audio frame of a preset duration, such as a frame containing 4096 sampling points. The total number of sampling points identified as clipped within that frame is counted. For example, if two clipped segments are detected in a 4096-sampling-point audio frame, with lengths of 60 and 150 sampling points respectively, the total number of clipped sampling points in that frame is 210. In this case, the severity index S is the percentage of the total length of the two segments to the total frame length, calculated as S≈5.13%. The resulting value S represents the severity of clipping in the current audio frame.
[0021] S3, Based on the non-clipping data before and after the clipped segment, the clipped segment is reconstructed by estimating the harmonic components to obtain the de-clipping audio signal; Specifically, after a clipped segment is detected, several non-clipped data samples immediately preceding and following the segment are extracted, for example, 50 samples before and after. Using these sample data, an autoregressive model is established to predict the normal waveform of the signal. By solving for the linear prediction coefficients, this model can detect the periodicity and harmonic structure of the audio signal. Using this model, interpolation calculations are performed on the samples within the clipped segment to generate a smooth curve that conforms to the original signal's spectral characteristics, replacing the original flat-topped clipped waveform, thus completing signal reconstruction. In another embodiment, the frequency, amplitude, and phase of each sinusoidal component are analyzed and extracted from the data segments before and after the clipped segment. By smoothing and interpolating or extrapolating these parameters, their trajectories within the clipped region are estimated. Based on the estimated parameters, the sinusoidal signal of the clipped region is resynthesized. Similarly, noise components can be modeled and interpolated, and then the two are added together to obtain the complete reconstructed signal.
[0022] In an optional embodiment, the step of reconstructing the signal of the clipped segment by estimating harmonic components based on the un-clipped data before and after the clipped segment includes: Extract a second preset number of non-clipping data sampling points before the starting point of the clipping segment, establish an autoregressive model of a preset order, and predict data of the same length as the clipping segment based on the model coefficients, which will be used as the harmonic components. Cubic spline interpolation is performed on the first and last two non-clipping data sampling points of the clipped segment to obtain the reference reconstructed signal; The reconstructed signal is obtained by adding the estimated harmonic components to the reference reconstructed signal or by weighted addition.
[0023] Upon detecting a clipped segment of length N, the system traces back and extracts a segment of un-clipped audio data immediately preceding the start point of the clipped segment. The length of this un-clipped audio data is specified by a second preset sample size, such as 256 sampling points. This 256-segment un-clipped data is used as training data to build an autoregressive model. The structure of the autoregressive model is that the value of the current signal sampling point is a linear weighted sum of the past p sampling points, where p is the order of the model.
[0024] The Bogle algorithm is used to estimate the coefficients of the above autoregressive model, with the pre-defined order p set to 16. The Bogle algorithm solves for the model coefficients by minimizing the average power of the forward and backward prediction errors. Thus, a stable model is obtained. After the model is established, 16 points from the 256 unclipping samples are used as initial values, and the model is then used to... Iterative prediction is performed to generate the first reconstructed point. The newly generated point is added to the historical data, and the next point is predicted again. This process is repeated N times to generate a prediction signal of length N. This signal mainly contains the harmonic structure of the original signal, and therefore serves as the harmonic components required for reconstruction. In one embodiment, the harmonic components in this invention refer to periodic components that are consistent with the harmonic structure of the original signal, estimated through a linear prediction model. Optionally, the harmonic components are band-limited, retaining only harmonic components above a preset cutoff frequency, and then superimposed on the reference reconstructed signal.
[0025] In one embodiment, the estimated harmonic components are added to the reference reconstructed signal in a weighted manner to obtain the reconstructed signal, for example, the weight of the harmonic components is 0.6 and the weight of the reference reconstructed signal is 0.4.
[0026] Optionally, the step of extracting a second preset number of non-clipping data sampling points before the starting point of the clipping segment, establishing an autoregressive model of a preset order, and predicting data of the same length as the clipping segment based on the model coefficients as the harmonic components, specifically involves: Let the non-clipping data sampling points of the second preset sample number be the signal sequence x(n), and the preset order be P; Initialize forward prediction error With backward prediction error All are signal sequences x(n); Perform iterations from i=1 to P. In the i-th iteration: Based on the (i-1)th order forward prediction error and backward prediction error The reflection coefficient of the i-th order is calculated. ; Using the Levinson-Durbin recurrence relation, based on the reflection coefficient And the model coefficients of order i-1 are used to update the autoregressive model coefficients of order i. ,j}; According to the reflectance coefficient Update the forward prediction error and the backward prediction error to obtain and This is for use in the next iteration; After the iteration is completed, the coefficients of the Pth-order autoregressive model are { ,j} are the model coefficients; j=1,2,...,P; Based on the P non-clipping data sampling points before the start point of the clipped segment as the initial sequence, according to the autoregressive model formula... The data sequence is generated by recursively predicting point by point to generate a data sequence of the same length as the clipped segment; The generated data sequence is used as the harmonic component.
[0027] Assume the audio signal begins to clip at sampling point 101, and this portion of the signal needs to be reconstructed. Set the order of the autoregressive model to P=4, and extract the 20 un-clipped data points as the analysis sequence x(n). Perform a Levinson-Durbin recursion for these 20 data points with 4 iterations (i=1 to 4). In each iteration, calculate a reflection coefficient. And use it to update the model's prediction coefficients. After four iterations, a set of fourth-order model coefficients was obtained that can describe the inherent patterns of the audio segment. , , , The four nearest sampling points of order P before clipping are extracted: x(97), x(98), x(99), and x(100) as the initial sequence for prediction. Using these four points and model coefficients, the predicted value of the 101st point is calculated using an autoregressive formula. Then, add this newly generated sequence to the sequence, discard the oldest x(97), and use x(98), x(99), x(100), The 102nd point is predicted from four points. This process is repeated recursively until a completely new data sequence of the same length as the original clipped segment is generated, which serves as the harmonic component for reconstruction.
[0028] To obtain a smooth signal envelope, the last non-clipped sampling point immediately preceding the clipped segment is identified, called the start anchor point, and the first non-clipped sampling point immediately following the clipped segment is identified, called the end anchor point. Assuming the clipped segment length is N, and the value of the start anchor point is... The value of the ending anchor point is Using the two anchor points as boundary conditions, a cubic spline interpolation algorithm is executed to generate N interpolation points. These points form a smooth curve connecting the starting and ending anchor points, which is the reference reconstruction signal.
[0029] The harmonic components of length N predicted by the autoregressive model are added point-by-point to the reference reconstructed signal of length N generated by cubic spline interpolation. For example, the i-th sampling point of the harmonic component is added to the i-th sampling point of the reference reconstructed signal to obtain the i-th sampling point of the reconstructed signal. Cubic spline interpolation ensures a smooth transition at the connection points of the reconstructed signal, while the harmonic components predicted by the autoregressive model recover the high-frequency details and periodic characteristics lost during clipping, thus achieving a more natural reconstruction effect.
[0030] In some embodiments, the preset center frequency is a preset value, or a preset multiple of the estimated fundamental frequency, or a preset frequency offset higher than the centroid of the spectrum.
[0031] In yet another embodiment, the signal reconstruction of the clipped segment includes: Analyze the acoustic characteristics of the non-clipping data around the clipped segment to classify the signal type of the clipped segment as at least one of transient or steady-state signals; Based on the classification results, a matching signal reconstruction strategy is selected and executed for the clipped segment, wherein: If the signal type is a steady-state signal, then a prediction method based on an autoregressive model is used for reconstruction; If the signal type is a transient signal, then a nonlinear interpolation method based on envelope preservation is used for reconstruction.
[0032] Specifically, an analysis window of a preset length, such as 4 milliseconds, is set before the start point of the clipped segment; at least one acoustic feature of the audio signal within the analysis window is calculated, including short-time energy, zero-crossing rate, or spectral centroid; the calculated acoustic feature values are compared with corresponding preset classification thresholds. For example, when both the rate of change of the short-time energy and the zero-crossing rate are higher than their respective preset thresholds, the signal type is determined to be a transient signal, which typically corresponds to plosives in percussion or speech; otherwise, it is determined to be a steady-state signal, which typically corresponds to long tones or vowels in musical instruments.
[0033] For clipped segments identified as steady-state signals, the aforementioned reconstruction method based on an autoregressive model is used to recover their harmonic structure.
[0034] For clipped segments identified as transient signals, the last non-clipped sampling point immediately preceding the clipped segment (i.e., the start anchor point) and the first non-clipped sampling point immediately following the clipped segment (i.e., the end anchor point) are identified. Not only are the values of these two anchor points recorded, but the slope (i.e., the first derivative) of the signal as it enters and leaves the clipped region is also calculated. Using cubic Hermite interpolation or a similar conformal interpolation algorithm, a smooth curve capable of restoring the original signal's impact and rapid decay pattern is generated based on the values of the two anchor points and the slope—these four boundary conditions—as the reconstructed signal. Priority is given to ensuring the accuracy of the transient signal envelope, avoiding potential tailing or ringing distortion that autoregressive models might produce for such signals.
[0035] In yet another embodiment, the step of reconstructing the signal from the clipped segment by estimating harmonic components further includes: Based on the non-clipping data before the start point of the clipped segment, a forward prediction model is established and a forward prediction signal is generated; Based on the non-clipping data after the end point of the clipped segment, a backward prediction model is established and a backward prediction signal is generated; The forward prediction signal and the backward prediction signal are weighted and fused to obtain the harmonic component, wherein the weights are dynamically adjusted according to the relative position of the prediction point within the clipping segment.
[0036] Specifically, let the length of the clipped segment be N sampling points, and the index n be from 1 to N.
[0037] M non-clipping data sampling points before the start point of the clipped segment are extracted. A P-order forward autoregressive model is established using the Burger algorithm. This model is then used to recursively predict and generate a forward prediction signal of length N, denoted as . M non-clipping data sampling points are extracted after the end point of the clipped segment. The time order of these M sampling points is reversed. Based on the reversed sequence, a P-order backward autoregressive model is established, and a prediction sequence of length N is recursively generated using this model. The prediction sequence of length N is reversed again to obtain the backward prediction signal, denoted as . .
[0038] Define a forward weight that varies with the sample index n. and a backward weight ,in Smoothly decrease from 1 to 0, and The number of n smoothly increases from 0 to 1, and for any n, In one embodiment, the weight calculation formula is: , Where n = 1, 2, ..., N. The fused harmonic components are calculated using the following formula: The fusion process ensures that the reconstructed signal relies more on reliable forward prediction results at the beginning of the clipped segment and more on reliable backward prediction results at the end, thus achieving a smooth transition throughout the segment.
[0039] S4, perform frequency response compensation on the de-clipping audio signal to obtain an optimized output audio signal, wherein the frequency response compensation includes: Based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, and combined with the psychoacoustic model, parametric equalization is performed to correct the audible deviation. Specifically, the target frequency response curve of the headphones is subtracted from the actual frequency response curve on the logarithmic frequency axis to obtain an original difference compensation curve, such as... Figure 3The difference curve is smoothed using a psychoacoustic model, for example, by employing the Buck scale or equivalent rectangular bandwidth, ignoring overly sharp frequency details that are insensitive to the human ear. An algorithm automatically generates a set of parametric equalizers, such as ten peak filters, and optimizes their respective center frequencies, gains, and Q-factors to ensure that the superimposed overall response approximates the smoothed difference compensation curve as closely as possible. This equalizer set is then applied to the de-clipping audio signal.
[0040] In an optional embodiment, the parametric equalization process to correct audible deviation based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, combined with a psychoacoustic model, includes: The frequency axis of the difference curve is mapped to the Buck scale, and the energy within a preset number of critical frequency bands is calculated. Based on the absolute hearing threshold curve in the ISO226:2003 acoustic standard and the spectral energy of the signal, calculate the masking threshold for each critical frequency band. Equalization is performed only on deviations in the difference curve where the absolute value of the amplitude exceeds the corresponding frequency band masking threshold.
[0041] The spectral difference between the original and reconstructed signals, i.e., the difference curve, is obtained. To ensure the processing conforms to human hearing characteristics, the linear frequency axis of this curve (Hertz) is converted to a nonlinear Buck scale. The entire audible spectrum, for example, from 0 to 22050 Hz, is divided into 25 critical bands. The energy of the original audio signal within each critical band is calculated. The construction of the psychoacoustic model involves two steps: first, inputting the absolute hearing threshold curve defined by the ISO 226:2003 standard, which is the minimum sound intensity that the human ear can hear in a quiet environment; second, calculating the masking effect based on the energy of the critical bands of the signal, i.e., how a strong sound makes a weak sound at a neighboring frequency less noticeable. A masking threshold is calculated for each critical band using a specific algorithm that combines the absolute hearing threshold and the masking effect. The amplitude of the difference curve within each critical band is compared with the corresponding masking threshold. If the amplitude of the difference curve is lower than the masking threshold, the deviation is considered imperceptible to the human ear. Only frequency bands whose absolute amplitude exceeds the masking threshold are identified as audible deviations and enter the subsequent equalization processing flow, such as... Figure 4 .
[0042] In an optional embodiment, the equalization process for deviations in the difference curve whose absolute amplitude values exceed the corresponding frequency band masking threshold includes: In the deviation portion exceeding the masking threshold, peaks and valleys with bandwidth less than a first preset bandwidth octave and absolute amplitude values greater than a second preset amplitude threshold are identified; For each peak, configure a peak-type equalization filter with a center frequency and Q value corresponding to that peak. For each valley point, configure a notch equalizer with a center frequency and Q value corresponding to that valley point; The absolute value of the gain of the equalization filter is equal to the absolute value of the amplitude at the corresponding peak or valley point, but in the opposite direction.
[0043] After identifying all audible deviation regions exceeding the masking threshold in the difference curve, local extrema, i.e., peaks and troughs, are searched within these regions. To ensure that concentrated deviations are processed, filtering conditions are set, such as a first preset bandwidth octave of one-third of an octave and a second preset amplitude threshold of 3dB. Only those extrema that are narrow in shape (bandwidth less than one-third of an octave) and sufficiently large in amplitude (absolute amplitude exceeding 3dB) are selected for processing.
[0044] For each selected extreme point, a parametric equalizer filter is automatically configured. For example, if a peak of +5dB is detected at 2500Hz, with a Q value of 4.0, a peak equalizer will be configured with a center frequency of 2500Hz, a Q value of 4.0, and a gain of -5dB. Conversely, if a valley of -4dB is detected at 400Hz, with a Q value of 3.5, a notch equalizer will be configured with a center frequency of 400Hz, a Q value of 3.5, and a gain of +4dB. This precise inverse compensation eliminates audible spectral bias. The center frequency is equivalent to the shelving corner frequency.
[0045] S5. Based on the severity index, the optimized output audio signal is subjected to high-shelf filtering processing, wherein the higher the severity index, the lower the gain of the high-shelf filtering processing, thereby suppressing the high-frequency components of residual clipping distortion input.
[0046] The clipping ratio is positively correlated with the high-frequency harmonic energy; therefore, clipping severity is used as the high-frequency suppression control variable. During parametric equalization, an additional high-shelf filter is applied with a fixed inflection point frequency, for example, 6kHz. The gain parameter of this filter is linked to the previously calculated severity index. A mapping relationship is established: when the severity index is 0, the gain is 0dB, meaning the filter is inactive; when the severity index is the maximum value of 1, the gain is set to a preset minimum value, for example, -5dB. For severity indices between 0 and 1, the gain is calculated using linear or non-linear interpolation between 0 and 1. Thus, when the processed audio frame is severely clipped, the high-frequency components are automatically attenuated, suppressing potentially harsh noise, such as… Figure 5 .
[0047] In an optional embodiment, the step of performing high-shelf filtering based on the severity index, wherein the higher the severity index, the lower the gain of the high-shelf filtering, includes: Set the center frequency of the high-shelf filter to the preset center frequency, and the Q value to the preset Q value; The gain G of the high-shelf filtering process, expressed in dB, is calculated using the following formula: , Wherein, S is the severity index; and These are the lower and upper limits of the preset severity index, respectively; and These are the preset gain values corresponding to the lower and upper limits of the severity index, respectively.
[0048] A high-shelf filter is applied to adjust the high-frequency components of the audio, compensating for any harshness that may result from clipping reconstruction. For example, the preset center frequency is set to 8000Hz, and the preset Q value is set to 0.707. The filter's key parameter, gain G, is adjusted based on the previously calculated clipping severity index S.
[0049] Define a set of mapping parameters, for example, a preset lower limit for the severity index. 2%, upper limit The gain is 30%. The corresponding preset gain values are as follows: Equal to 0dB, meaning slight clipping does not cause attenuation, and This equals -5dB, meaning the maximum attenuation is 5dB during severe clipping. Assuming the severity index S calculated for the current audio frame is 15%, the gain G calculated according to the formula is... dB. Therefore, high-shelf filters will smoothly attenuate frequency components above 8000Hz by approximately -2.32dB, thereby reducing the sharpness of the audio, and the attenuation strength is proportional to the severity of clipping, such as... Figure 6 .
[0050] In this specification, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise limited, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, "a," "an," "the," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. "Multiple" refers to at least two, such as 2, 3, 5, or 8, etc. "And / or" includes any and all combinations of the associated listed items.
[0051] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
[0052] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for intelligent detection and optimization of headphone audio, characterized in that, Includes the following steps: Obtain the preset target frequency response curve of the headphones, the actual frequency response curve of the headphones, and the input audio signal; Detect clipped segments in the input audio signal and calculate a severity index representing the degree of clipping; Based on the non-clipping data before and after the clipped segment, the clipped segment is reconstructed by estimating the harmonic components to obtain the de-clipping audio signal. The frequency response compensation of the de-clipping audio signal is performed to obtain an optimized output audio signal. The frequency response compensation includes: Based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, and combined with the psychoacoustic model, parametric equalization is performed to correct the audible deviation. Based on the severity index, the optimized output audio signal is subjected to high-shelf filtering, wherein the higher the severity index, the lower the gain of the high-shelf filtering, thereby suppressing the high-frequency components of the residual clipping distortion input.
2. The method according to claim 1, characterized in that, The process of detecting clipped segments in the input audio signal and calculating a severity index representing the degree of clipping includes: The normalized amplitude of the input audio signal is compared with a first preset positive threshold and a first preset negative threshold. When the number of consecutive sampling points whose amplitude exceeds the threshold reaches a first preset number of samples, it is determined that the clipping segment has started. The severity index is calculated as the percentage of the total number of sample points of all clipped segments to the total number of sample points of the frame within an audio frame of a preset duration.
3. The method according to claim 1, characterized in that, The process of reconstructing the signal from the clipped segment by estimating harmonic components based on the un-clipped data before and after the clipped segment includes: Extract a second preset number of non-clipping data sampling points before the starting point of the clipping segment, establish an autoregressive model of a preset order, and predict data of the same length as the clipping segment based on the model coefficients, which will be used as the harmonic components. Cubic spline interpolation is performed on the first and last two non-clipping data sampling points of the clipped segment to obtain the reference reconstructed signal; The reconstructed signal is obtained by adding the estimated harmonic components to the reference reconstructed signal or by weighted addition.
4. The method according to claim 1, characterized in that, The parametric equalization process, based on the difference curve between the target frequency response curve and the actual frequency response curve of the headphones, and in conjunction with a psychoacoustic model, to correct audible deviations includes: The frequency axis of the difference curve is mapped to the Buck scale, and the energy within a preset number of critical frequency bands is calculated. Based on the absolute hearing threshold curve in the ISO226:2003 acoustic standard and the spectral energy of the signal, calculate the masking threshold for each critical frequency band. Equalization is performed only on deviations in the difference curve where the absolute value of the amplitude exceeds the corresponding frequency band masking threshold.
5. The method according to claim 4, characterized in that, The process of equalizing the deviations in the difference curves whose absolute amplitude values exceed the corresponding frequency band masking threshold includes: In the deviation portion exceeding the masking threshold, peaks and valleys with bandwidth less than a first preset bandwidth octave and absolute amplitude values greater than a second preset amplitude threshold are identified; For each peak, configure a peak-type equalization filter with a center frequency and Q value corresponding to that peak. For each valley point, configure a notch equalizer with a center frequency and Q value corresponding to that valley point; The absolute value of the gain of the equalization filter is equal to the absolute value of the amplitude at the corresponding peak or valley point, but in the opposite direction.
6. The method according to claim 1, characterized in that, The step of performing high-shelf filtering based on the severity index, wherein the higher the severity index, the lower the gain of the high-shelf filtering, includes: Set the center frequency of the high-shelf filter to the preset center frequency, and the Q value to the preset Q value; The gain G of the high-shelf filtering process, expressed in dB, is calculated using the following formula: , Wherein, S is the severity index; and These are the lower and upper limits of the preset severity index, respectively; and These are the preset gain values corresponding to the lower and upper limits of the severity index, respectively.
7. The method according to claim 6, characterized in that, The preset center frequency is a preset value, or a preset multiple of the estimated fundamental frequency, or a preset frequency offset higher than the centroid of the spectrum.
8. The method according to claim 3, characterized in that, The process involves extracting a second preset number of non-clipping data sampling points before the start point of the clipping segment, establishing a preset order autoregressive model, and predicting data of equal length to the clipping segment based on the model coefficients, which are then used as the harmonic components. Specifically: Let the non-clipping data sampling points of the second preset sample number be the signal sequence x(n), and the preset order be P; Initialize forward prediction error With backward prediction error All are signal sequences x(n); Perform iterations from i=1 to P. In the i-th iteration: Based on the (i-1)th order forward prediction error and backward prediction error The reflection coefficient of the i-th order is calculated. ; Using the Levinson-Durbin recurrence relation, based on the reflection coefficient And the model coefficients of order i-1 are used to update the autoregressive model coefficients of order i. ,j}; According to the reflectance coefficient Update the forward prediction error and the backward prediction error to obtain and This is for use in the next iteration; After the iteration is completed, the coefficients of the Pth-order autoregressive model are { ,j} are the model coefficients; j=1,2,...,P; Based on the P non-clipping data sampling points before the starting point of the clipped segment as the initial sequence, and according to the autoregressive model formula, the data sequence of the same length as the clipped segment is generated by recursively predicting point by point. The generated data sequence is used as the harmonic component.
9. The method according to claim 1, characterized in that, The signal reconstruction of the clipped segment includes: Analyze the acoustic characteristics of the non-clipping data around the clipped segment to classify the signal type of the clipped segment as at least one of transient or steady-state signals; Based on the classification results, a matching signal reconstruction strategy is selected and executed for the clipped segment, wherein: If the signal type is a steady-state signal, then a prediction method based on an autoregressive model is used for reconstruction; If the signal type is a transient signal, then a nonlinear interpolation method based on envelope preservation is used for reconstruction.
10. The method according to claim 1, characterized in that, The step of reconstructing the clipped segment by estimating harmonic components further includes: Based on the non-clipping data before the start point of the clipped segment, a forward prediction model is established and a forward prediction signal is generated; Based on the non-clipping data after the end point of the clipped segment, a backward prediction model is established and a backward prediction signal is generated; The forward prediction signal and the backward prediction signal are weighted and fused to obtain the harmonic component, wherein the weights are dynamically adjusted according to the relative position of the prediction point within the clipping segment.