An automatic gain control method and system fusing adaptive dynamic threshold and double envelope tracking

CN123019641APending Publication Date: 2026-10-30SHAANXI FENGHUO ELECTRONICS
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202611147089.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]该方案的局限性在于:固定目标电平和衰减系数在强噪声、高动态环境下适应性不足

Benefits of technology

(1)噪声自适应的动态门限:将传统固定目标电平改写为实时噪声功率的函数,使AGC 在噪声升高时自动降低增益目标、噪声降低时恢复,有效抑制噪声段的误放大和语音段的欠放大,与固定门限方案相比,在信噪比动态变化超过 20dB 的场景下,输出信噪比提升可达 6dB 以上。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123019641A_ABST
    Figure CN123019641A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of digital audio signal processing, and relates to an automatic gain control method and system fusing adaptive dynamic threshold and double envelope tracking. The method comprises the following modules: a preprocessing module, input audio data, and calculating the logarithmic value of the ratio of the current signal energy and the estimated background noise energy; an envelope tracking module, containing a fast envelope tracker and a slow envelope tracker; dynamic threshold and gain calculation, leading zero count statistics, gain table query and linear interpolation acquisition; an output module: output sample and audio frame. The application directly calculates the speech presence probability in real time from the online statistics of VAD, and performs frame-by-frame probability weighted correction on the gain. Cooperating with the VAD gating mechanism based on the difference between the fast and slow envelopes and the noise standard deviation, even under the condition of -5dB SNR, the false alarm probability is reduced from 8% of the traditional scheme to below 4%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of digital audio signal processing technology, and relates to an automatic gain control method and system that integrates adaptive dynamic threshold and dual envelope tracking. Background Technology

[0002] Automatic gain control (AGC) is a core technology in audio signal processing, designed to maintain a stable output signal level. For voice communication scenarios in noisy, high-dynamic environments, existing technical solutions can be categorized as follows.

[0003] Direction 1: Classical Digital AGC Based on Fixed Target Level A gain curve is constructed using a fixed target level and a preset compression gain. The core process is as follows: the VAD determines whether the current frame is a speech frame; if so, it calculates the gain based on the difference between the current energy and the target level, and outputs it after first-order IIR smoothing. The VAD uses asymmetric noise power estimation (fast decrease, slow increase), and the AGC envelope tracking uses a single slow envelope with a fixed attenuation coefficient.

[0004] The limitations of this approach are: the fixed target level and attenuation coefficient are not adaptable enough to strong noise and high dynamic environments. When the ambient noise fluctuates significantly, it can easily lead to the noise segment being amplified incorrectly or the weak speech segment having insufficient gain; and a single envelope tracker cannot simultaneously protect transient speech and suppress steady-state noise.

[0005] Direction 2: Dual-envelope tracking AGC Two envelope trackers, one slow and one fast, are used to detect the start and end of speech by comparing their differences. The gating logic freezes the gain during non-speech segments to prevent noise amplification.

[0006] However, its envelope attenuation coefficient is a fixed value and is not dynamically adjusted according to the intensity of speech activity; the gating mechanism is based only on a simple comparison of envelope differences and lacks a speech presence probability measure based on a statistical model; at the same time, its target level is still a fixed value and no adaptive threshold is introduced.

[0007] Direction 3: Digital AGC Based on Speech Probability Models Chinese invention patent application number 201910860075.X, published on January 7, 2020, discloses a method that calculates the speech probability of each signal segment through a speech probability model and combines envelope estimation and noise classification to calculate dual gain, thereby achieving adaptive control.

[0008] The limitations of this method are: the speech probability model relies on a pre-trained statistical model, which has limited adaptability to non-stationary and rapidly changing airborne noise scenarios; it does not perform computational optimization for embedded fixed-point DSP platforms; and it does not involve coordinated control with modules such as noise suppression (NS) and echo cancellation (AEC).

[0009] Direction 4: AGC in Airborne Audio Processing Chinese invention patent application number 202210948786.4, published on November 22, 2022, discloses an airborne audio processing unit based on an FPGA+CPU architecture, integrating AGC and noise reduction enhancement functions. CN 202310157237 discloses an airborne voice processing platform that uses spectral subtraction combined with adaptive enhancement to achieve AGC.

[0010] The AGC modules of the above schemes mostly adopt fixed thresholds or simple adaptive LMS algorithms. They do not propose a dynamic threshold strategy that adapts to noise energy to address the problem of gain false boosting under strong noise, nor do they integrate VAD-driven attenuation control into the dual-envelope tracking framework.

[0011] Direction 5: Numerical AGC Based on Lookup Tables Chinese invention patent application number 200610138564.7, published on May 14, 2008, discloses an AGC scheme based on amplitude detection and lookup table, which compares the detection result with a reference level to obtain an error signal, and uses this as an index to obtain the gain. US 5,623,521, on the other hand, uses polynomial approximation to calculate the gain value.

[0012] These schemes use gain table indexes based on error signals or polynomial approximations, and do not utilize leading zero counting to achieve a fast mapping of the natural logarithm of signal energy, resulting in high computational complexity; furthermore, they do not link the lookup mechanism with the envelope tracking driven by VAD.

[0013] In summary, existing AGC (Automatic Guided Vehicle) technologies generally suffer from the following shortcomings: Fixed threshold and poor environmental adaptability: The fixed target level cannot distinguish between "high noise and low speech" and "low noise and high speech" scenarios, and is prone to gain overshoot or undershoot in dynamic noise environments.

[0014] Envelope tracking lacks VAD coordination: The attenuation coefficient of the existing dual envelope scheme is fixed, and it cannot achieve dynamic adjustment of "rapid attenuation of speech segments and freezing of noise segments" according to the intensity of speech activity.

[0015] The statistical foundation of gating logic is weak: it relies heavily on simple envelope comparisons or fixed thresholds, lacks utilization of short-term statistics of noise (such as mean and standard deviation), and has a high misjudgment rate under non-stationary noise.

[0016] Gain indexing is inefficient: it does not fully utilize the leading zero instruction of the fixed-point DSP for logarithmic mapping, and the computational overhead of table lookup or approximation is large.

[0017] Independent modules and lack of link coordination: AGC often runs independently and does not share control information with modules such as NS and AEC, resulting in computational redundancy and false triggering problems.

[0018] In summary, there is an urgent need to provide an automatic gain control method and system that integrates adaptive dynamic threshold and dual envelope tracking to solve the above problems. Summary of the Invention

[0019] The purpose of this invention is to overcome the shortcomings of the prior art and propose an automatic gain control method and system that integrates adaptive dynamic threshold and dual envelope tracking.

[0020] In a first aspect, the present invention discloses an automatic gain control method that integrates adaptive dynamic threshold and dual envelope tracking, comprising the following steps: Step 1: Input audio data, downsample it, and send it to the VAD module for interference removal processing and calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; Step 2: After dividing the audio data into frames, calculate the maximum amplitude envelope of each subframe. First, determine if the maximum amplitude envelope of each subframe is greater than the fast envelope. If so, update the fast envelope to the maximum amplitude envelope; otherwise, decay the fast envelope at a fixed rate. Next, determine if the maximum amplitude envelope of each subframe is greater than the slow envelope. If so, allow the slow envelope to rise and track according to the rise factor; otherwise, decay the slow envelope. The decay rate of the slow envelope is determined by a logarithmic value. As a control signal; Step 3: Take the maximum value between the fast envelope and the slow envelope as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation, and then perform VAD module gating correction and SPP weighted correction in sequence. Step 4: Perform an overload protection loop until the output does not exceed a fixed value; then use a linear difference transition between the gain of the previous frame and the current gain; subsequently output samples and audio frames.

[0021] Furthermore, in step one, each frame of audio data consists of 160 sampling points with a sampling rate of 16kHz, corresponding to a duration of 10ms; the 16kHz is reduced to 4kHz through downsampling processing.

[0022] Furthermore, in step two, the calculation of the maximum amplitude envelope specifically involves dividing the 10ms frame into 10 1ms subframes and calculating the maximum amplitude envelope for each subframe: Formula 1 in: For input digital audio signals, This is the index for the sampling points.

[0023] Furthermore, in step two, the fast envelope decays at a fixed rate using the following formula: Formula 2 Where: represents the fast envelope.

[0024] Furthermore, in step two, the decay rate of the slow envelope is determined by the logarithmic value. As a control signal, it can be categorized into the following situations: Scenario 1: When hour, =-65; Scenario 2: When hour, =0; Scenario 3: When hour, ; in: Logarithmic value; This is the attenuation coefficient.

[0025] Furthermore, in step three, the formula for counting leading zeros is: Formula 3 Formula 4 in: frac For the extracted decimal part; It is a 32-bit unsigned integer.

[0026] Furthermore, in step three, the linear interpolation specifically involves: Formula 5 in: This represents the gain value in the gain lookup table, indexed by the "leading zero count zeros" of the signal energy. This represents the gain value at the index position in the gain lookup table that is one less than the current index zeros; frac is the extracted decimal part; Furthermore, in step three, the VDD gating correction specifically involves: first calculating the gate value using VDD gating: Formula 6 in: To fast envelope leading zero, The current level is a leading zero. The standard deviation of short-term noise; The decision value used to determine whether to activate gating attenuation; When gating attenuation is enabled, The larger the value, the stronger the attenuation. Next, calculate the gate decay: Formula 7.

[0027] Furthermore, in step three, the SPP weighted adjustment specifically involves: Formula 8 Where: 65536 is the representation of 0dB in Q16 format; This is the original gain after interpolation; This is the final gain after gating and SPP correction; The probability of the existence of speech.

[0028] Furthermore, this invention also discloses an automatic gain control system that integrates adaptive dynamic threshold and dual envelope tracking, comprising the following modules: Preprocessing module: Input audio data is downsampled and then sent to the VAD module for interference removal and to calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; Envelope tracking module: includes a fast envelope tracker and a slow envelope tracker; the fast envelope is used to capture speech bursts and transient noise; the slow envelope tracks the long-term energy baseline of the signal; the core of the coordinated operation of the fast and slow envelopes is that the decay rate is dynamically controlled by the logratio output by the VAD module. Dynamic threshold and gain calculation and post-processing module: Take the maximum value between the fast envelope and the slow envelope as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation; Output module: Performs overload protection loop until the output does not exceed a fixed value; then uses differential linear transition between the gain of the previous frame and the current gain; subsequently outputs samples and audio frames.

[0029] Compared with the prior art, the present invention has the following beneficial effects: (1) Noise-adaptive dynamic threshold: The traditional fixed target level is rewritten as a function of real-time noise power, so that AGC automatically reduces the gain target when the noise increases and restores it when the noise decreases. This effectively suppresses the false amplification of the noise segment and the under-amplification of the speech segment. Compared with the fixed threshold scheme, the output signal-to-noise ratio can be improved by more than 6dB in scenarios where the dynamic change of signal-to-noise ratio exceeds 20dB.

[0030] (2) VAD-driven three-zone attenuation dual-envelope tracking: For the first time, VAD logratio and the attenuation coefficient of envelope tracking are linked in segments—fast attenuation in the strong speech zone (decay = -65), linear interpolation in the transition zone, and frozen attenuation in the silence / noise zone (decay = 0), so that envelope tracking exhibits optimal behavior in three typical acoustic scenarios. Compared with the dual-envelope scheme with fixed attenuation coefficient, it responds more promptly to sudden speech (attack time ~0.7ms) and suppresses steady-state noise more thoroughly (frozen attenuation in the noise zone prevents false lifts).

[0031] (3) Low-complexity implementation of the leading zero index gain table: The natural logarithmic characteristic of the signal energy is directly mapped to the gain table index using the leading zero counting instruction (clz) of the fixed-point DSP, without the need for floating-point or polynomial approximation calculations of logarithmic / exponential functions. The gain calculation for each subframe only requires 1 clz + 1 table lookup + 1 multiplication + 1 shift, which greatly reduces the computational complexity compared to the Chebyshev polynomial approximation scheme, making it suitable for resource-constrained embedded platforms.

[0032] (4) Joint Correction of Speech Presence Probability Weighting and Gating: Unlike speech probability calculation based on pre-trained models, this invention directly calculates the speech presence probability in real time from the online statistics of VAD and performs frame-by-frame probability weighting correction on the gain. Combined with the VAD gating mechanism based on the difference between fast and slow envelopes and the standard deviation of noise, even under the condition of -5dB SNR, the probability of false boosting is reduced from 8% in the traditional scheme to below 4%.

[0033] (5) Collaboration with front-end and back-end modules of the link: AGC directly shares the dual-end detection flag of AEC and the residual noise power of NS, avoiding the false amplification of echo and the repeated estimation of noise power, and the overall link delay increases by less than 1ms. Attached Figure Description

[0034] The accompanying drawings are incorporated in and form part of this specification, and together with the description serve to explain the principles of the invention.

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a flowchart of the control method of the present invention; Figure 2 The flowchart shows the detailed processing steps S1-S5 of the control method of the present invention. Figure 3 The flowchart shows the detailed processing steps S6-S12 of the control method of the present invention. Figure 4 The flowchart shows the detailed processing steps S13-S19 of the control method of the present invention. Figure 5 This is an overall block diagram of the AGC method that integrates multiple algorithm strategies in this invention. Detailed Implementation

[0037] Exemplary embodiments will now be described in detail. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples consistent with some aspects of the invention as detailed in the appended claims.

[0038] To enable those skilled in the art to better understand the technical solutions of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Example

[0039] This invention discloses an automatic gain control method that integrates adaptive dynamic threshold and dual envelope tracking, such as... Figure 1 As shown, it includes the following steps: Step 1: Input audio data, downsample it, and send it to the VAD module for interference removal processing and calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; like Figure 2 As shown, S1–S3 (preprocessing and VAD): Input a 10ms frame of audio data, downsample it to 4kHz, and then send it to the VAD module. The VAD removes low-frequency interference (such as 50Hz power frequency) through high-pass filtering, calculates the energy of each 1ms subframe, and estimates the decibel value by counting leading zeros. (Q10 format, zeros is the leading zero count), update short-term statistics ( (reflecting energy changes over the past 10–100 ms) and long-term statistics ( (Reflecting the slow-changing characteristics of background noise) The final output is the log-energy ratio of the current frame: After smoothing and limiting ( (Q10 format) in: For the previous frame value; The logarithmic energy (decibels) of the current frame. This is the mean of the long-term statistics; The standard deviation of long-term statistics; The dynamic target threshold formula is as follows: Formula 9 in: The reference target level is (typical -12 dBFS). This is the noise compensation factor (typical value 0.2). For real-time noise power estimation; the threshold update period is synchronized with the frame length (approximately 4ms).

[0040] Step 2: After dividing the audio data into frames, calculate the maximum amplitude envelope of each subframe. First, determine if the maximum amplitude envelope of each subframe is greater than the fast envelope. If so, update the fast envelope to the maximum amplitude envelope; otherwise, decay the fast envelope at a fixed rate. Next, determine if the maximum amplitude envelope of each subframe is greater than the slow envelope. If so, allow the slow envelope to rise and track according to the rise factor; otherwise, decay the slow envelope. The decay rate of the slow envelope is determined by a logarithmic value. As a control signal; Specifically, such as Figure 2-3 As shown, S4–S10 (dual envelope tracking): The 10ms frame is divided into 10 1ms subframes, and the maximum amplitude envelope is calculated for each subframe. Fast envelope : Rising edge directly follows ( The value is assigned at the time, and decays exponentially at a fixed rate on the falling edge. The key innovation of the slow envelope capacitorSlow lies in its attenuation coefficient. By VAD drive-- (Strong voice) = -65 (rapid decay, release in about 50ms), (Silence / Noise) = 0 (freeze attenuation), hour (Linear interpolation). This three-zone decision-making method ensures optimal behavior of "rapid follow-up in speech segments, no change in noise segments, and smooth transition segments"; The formula used is as follows: Fast envelope update: when (Rising edge) when (At the falling edge): in The fast envelope attenuation coefficient; The attack time is approximately 0.7ms; For maximum amplitude envelope; This is the fast envelope value, i.e., capacitorFast.

[0041] Slow envelope update (VAD driver decay): when (Rising edge) in, The rising coefficient of the slow envelope. This is the slow envelope value, i.e., capacitorSlow.

[0042] when (At the falling edge): in The slow envelope VAD drive attenuation coefficient is determined by the VAD logratio r according to the three-zone decision: like (Strong voice): (Rapid decay) like (Transition Zone): (Linear interpolation) like (Silence / Noise): (Freeze-down) Step 3: Take the maximum value between the fast envelope value and the slow envelope value as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation, and then perform VAD module gating correction and SPP weighted correction in sequence. Specifically, S11–S13 (gain calculation): Current level The larger of the fast and slow envelope values ​​is selected to balance transient protection and steady-state suppression. Leading zero counting. ( , represents leading zero counting; (represents a 32-bit unsigned integer). A larger value indicates lower energy and a higher gain required. Extract the decimal part. (Q12 format, 13-bit precision). Look up the gain table. This table is pre-calculated and generated during the initialization phase based on the target level, compression gain, and limiter configuration—low energy level. (High) corresponds to high gain, and high energy level corresponds to low gain.

[0043] Linear interpolation: ; in: This represents the gain value in the gain lookup table, indexed by the "leading zero count zeros" of the signal energy. This represents the gain value at the index position in the gain lookup table that is one less than the current index zeros; frac is the extracted decimal part; like Figure 3 As shown, S14–S15 (Gating and Correction): VAD Gating Calculation value, When to activate gating: (attenuation) Gain to noise floor Directional decay.

[0044] SPP weighted correction: , Depend on Obtained through threshold mapping; This is the original gain after interpolation; The final gain after gating and SPP correction; the two-step correction ensures that the gain in the pure noise range is effectively reduced to around 0dB. Experiments show that the false boost probability is reduced from 8% to below 4% under -5dB SNR conditions. The formulas used include: Current level: in, Represents the fast envelope value (capacitorFast); This represents the slow envelope value (capacitorSlow). VAD gate value calculation: Here, is the fast envelope leading zero, is the current level leading zero, and is the short-term noise standard deviation. Gated attenuation is enabled at this time; the larger the value, the stronger the attenuation.

[0045] Step 4: Perform an overload protection loop until the output does not exceed a fixed value; then use a linear difference transition between the gain of the previous frame and the current gain; subsequently output samples and audio frames.

[0046] Specifically, such as Figure 4 As shown, S16–S19 (post-processing and output): Overload protection cycle check: like ,but (Attenuation approximately -0.1dB) until safety conditions are met. Gain smoothing is calculated between each 1ms subframe. (Depending on the number of subframe samples), gain increases per sample point. This allows for a linear transition in gain between adjacent subframes. The final output.

[0047] Furthermore, in step one, each frame of audio data consists of 160 sampling points with a sampling rate of 16kHz, corresponding to a duration of 10ms; the 16kHz is reduced to 4kHz through downsampling processing.

[0048] Furthermore, in step two, the calculation of the maximum amplitude envelope specifically involves dividing the 10ms frame into 10 1ms subframes and calculating the maximum amplitude envelope for each subframe: Formula 1 in: For input digital audio signals, This is the index for the sampling points.

[0049] Furthermore, in step two, the fast envelope decays at a fixed rate using the following formula: Formula 2 Where: represents the fast envelope.

[0050] On the other hand, this invention discloses an automatic gain control system that integrates adaptive dynamic threshold and dual envelope tracking, comprising the following modules: Preprocessing module: Input audio data is downsampled and then sent to the VAD module for interference removal and to calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; Specifically, the preprocessing module buffers the input audio in frames of fixed length (160 sampling points at a 16kHz sampling rate, corresponding to 10ms). The VAD module performs speech activity detection for each frame and outputs a logratio—representing the log ratio of the current frame signal energy to the long-term noise floor (Q10 fixed-point format)—as a measure of the speech presence probability for subsequent modules.

[0051] Envelope tracking module: includes a fast envelope tracker and a slow envelope tracker; the fast envelope is used to capture speech bursts and transient noise; the slow envelope tracks the long-term energy baseline of the signal; the core of the coordinated operation of the fast and slow envelopes is that the decay rate is dynamically controlled by the logratio output by the VAD module. Specifically, the envelope tracking module includes a fast envelope tracker (capacitorFast) and a slow envelope tracker (capacitorSlow). The fast envelope tracks the instantaneous peak of the signal with an extremely short time constant (approximately 0.7ms attack time) to capture speech bursts and transient noise; the slow envelope tracks the long-term energy baseline of the signal with a longer release time (configurable from 50 to 200ms). The core of their collaborative operation lies in the fact that the decay rate is dynamically controlled by the logratio output by the VAD—when the logratio is high (strong speech), the slow envelope decays rapidly to keep up with the energy decrease; when the logratio is low (silence / noise), the slow envelope freezes the decay to maintain the noise reference baseline; and the transition region is linearly interpolated. This "three-zone" decay strategy is one of the essential differences between this invention and existing fixed-coefficient dual-envelope schemes.

[0052] Dynamic threshold and gain calculation and post-processing module: Take the maximum value between the fast envelope and the slow envelope as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation; Specifically, the dynamic threshold and gain calculation module: The noise power estimation module uses an improved minimum statistical method to track the noise floor in real time, obtaining the minimum power spectrum value within a forgetting window (0.5–1s). The dynamic target threshold module rewrites the traditional fixed target level as a function of noise power, allowing the target threshold to dynamically drift with the noise floor. Gain calculation is implemented using a 32-level gain table: the natural logarithmic characteristic of the signal energy is directly mapped to the gain table index (zeros = clz(cur_level)) using the leading zero counting instruction (clz) of the fixed-point DSP, and a smooth gain value is obtained by linear interpolation between adjacent levels. The entire table lookup and interpolation process requires only 1 leading zero count + 1 table lookup + 1 multiplication + 1 shift.

[0053] Gating and gain correction module: Calculates the speech presence probability (SPP) using the logratio output from the VAD, and applies a probability-weighted correction to the gain—the gain in the speech segment functions normally, while the gain in the noise segment approaches 0dB. The VAD gating mechanism further calculates the gate value based on the difference between the fast and slow envelopes (zeros_fast - zeros) and the short-term noise standard deviation (stdShortTerm): gate = 1000 + zeros_fast - zeros - stdShortTerm. Gating attenuation is enabled when gate > 0; the larger the gate, the stronger the attenuation (maximum attenuation can be reduced to the noise floor level of the gain table). The gating value is first-order smoothed (historical weight 7 / 8) to prevent abrupt changes. Post-processing module: Overload protection is achieved through progressive attenuation (multiplied by 253 / 256 per step, approximately -0.1dB) cyclical checks to ensure the output signal does not exceed the int16 range (±32767). Gain smoothing module calculates the gain difference delta between adjacent 1ms subframes and performs a linear transition per sample point: delta = (gains[k+1] - gains[k]) >> (L2 - 4), with the gain incrementing by delta for each sample, eliminating the audible "click" sound caused by gain steps.

[0054] Output module: Performs overload protection loop until the output does not exceed a fixed value; then uses differential linear transition between the gain of the previous frame and the current gain; subsequently outputs samples and audio frames.

[0055] Link Coordination Interface: AGC shares the dual-end detection flag of the Echo Cancellation (AEC) module—when AEC determines it to be a remote single-end call, AGC forcibly disables gain updates (logratio is corrected) to prevent echo from being mistakenly amplified as speech. AGC uses the residual noise power of the Noise Suppression (NS) module as input for noise estimation, reducing secondary estimation errors. The overall link latency increases by less than 1ms.

[0056] The following is in conjunction with the appendix Figure 5 This paper provides a detailed description of the technical solution of the automatic gain control method proposed in this invention. The method adopts a modular design, and its core processing flow includes five main stages: preprocessing, envelope tracking, dynamic threshold and gain calculation, gating correction, and post-processing.

[0057] 1. Preprocessing and VAD module As shown in the upper part of the flowchart, the audio input signal x(n) first enters the preprocessing module. This module performs the following operations: Frame segmentation and buffering: The input 16kHz audio data is buffered in 10ms frames as the basic processing unit to ensure real-time performance.

[0058] Voice Activity Detection (VAD): VAD processing is performed on each frame, with the core being the calculation of the logratio value. This value is obtained by comparing the long-term statistical characteristics (mean and standard deviation) of the current frame's energy with the background noise, and then undergoing first-order recursive smoothing to stably reflect the confidence level of whether the current signal is speech or noise. The calculated logratio serves as the core driving parameter for all subsequent adaptive control.

[0059] 2. Envelope tracking module (VAD driver) This module is key to achieving "rapid follow-up of speech segments while keeping noise segments stationary" in this invention, and its logical path is clearly shown in the flowchart: VAD-driven decay control: Based on the logratio value output from the preprocessing stage, a three-zone decision is made to dynamically generate the decay coefficient decay of the slow envelope. Specifically: When logratio indicates strong speech, decay is set to a fast decay value (e.g., -65), corresponding to a release time of approximately 50ms.

[0060] When logratio indicates silence or pure noise, decay is set to 0, i.e., freeze decay.

[0061] When logratio is in a transitional state, decay interpolates linearly between fast values ​​and 0.

[0062] CapacitorSlow: Driven by the attenuation coefficient, the signal envelope is tracked. Its release time is approximately 50ms in the speech segment and frozen in the noise segment, with the overall range adaptively varying within 50-200ms, achieving dynamic adjustment of the envelope tracking time constant according to the intensity of speech activity.

[0063] 3. Dynamic Threshold and Gain Calculation Module This module performs the core gain value calculation, and its data processing flow is as follows: Real-time noise power estimation: An improved minimum statistical method is used to estimate the current background noise power P_noise in real time and robustly.

[0064] Dynamic target threshold calculation: Based on the estimated noise power P_noise, an adaptive target level threshold is calculated using the function T(t) = f(P_noise). This threshold adjusts in real time according to changes in ambient noise, fundamentally solving the problem of over-amplification or under-amplification caused by fixed thresholds when noise fluctuates.

[0065] Leading Zero Indexed Gain Table: The current signal envelope level (cur_level) is counted for leading zeros, and this count is used as an index to look up the pre-generated gain table (gainTable). Linear interpolation is then performed using the fractional part (frac, Q12 format) to obtain the base gain (g_raw). This mechanism fully utilizes the leading zero instructions of the fixed-point DSP, achieving a fast and low-complexity mapping of the signal's logarithmic characteristics.

[0066] 4. Gating and Gain Correction Module Based on the base gain, this module performs intelligent correction to ensure that the gain in the noise range is effectively suppressed: Gating calculation: The gate value `gate` is calculated based on the leading zero count and short-term statistics of the signal envelope. When `gate > 0`, gating attenuation is triggered to suppress the base gain.

[0067] SPP weighted correction: The logratio of VAD is mapped to the speech presence probability (SPP), i.e., P_spp. Then, the gain is finally corrected using the formula g_final = g_raw * P_spp + 65536 * (1 - P_spp). This weighted mixing makes the gain close to the original calculated value in the speech segment and smoothly transitions to 0dB (i.e., no amplification) in the noise segment, effectively suppressing the erroneous gain rise in the noise segment.

[0068] 5. Post-processing module Finally, the corrected gain is subjected to safety and smoothing processing: Overload protection: Checks if the output after applying the gain exceeds the range of ±32767. If it does, a progressive decay cycle is executed, multiplying the gain by 253 / 256 each time (approximately -0.1dB decay) until the output signal meets the safety requirements, preventing clipping distortion.

[0069] Gain smoothing and output: Between each 1ms subframe, the gain value is linearly smoothed, increasing incrementally at each sampling point to avoid audible noise caused by abrupt gain changes. Finally, the smoothed gain is applied to the input signal, and the processed audio frame y(n) is output.

[0070] Through the above five stages, this invention achieves closed-loop adaptive gain control across the entire link.

[0071] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. 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 the invention.

[0072] It should be understood that the present invention is not limited to the content already described above, and various modifications and changes can be made without departing from its scope. The scope of the present invention is limited only by the appended claims.

Claims

1. An automatic gain control method integrating adaptive dynamic threshold and dual-envelope tracking, characterized in that, Includes the following steps: Step 1: Input audio data, downsample it, and send it to the VAD module for interference removal processing and calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; Step 2: After dividing the audio data into frames, calculate the maximum amplitude envelope value of each subframe. First, determine whether the maximum amplitude envelope value of each subframe is greater than the fast envelope value. If so, update the fast envelope value to the maximum amplitude envelope value. Otherwise, the fast envelope value decays at a fixed rate; Next, determine whether the maximum amplitude envelope value of each subframe is greater than the slow envelope value. If so, allow the slow envelope value to rise and track according to the rise factor; otherwise, allow the slow envelope value to decay. The decay rate of the slow envelope value is determined by the logarithmic value. As a control signal; Step 3: Take the maximum value between the fast envelope value and the slow envelope value as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation, and then perform VAD module gating correction and SPP weighted correction in sequence. Step 4: Perform an overload protection loop until the output does not exceed a fixed value; then use a linear difference transition between the gain of the previous frame and the current gain; subsequently output samples and audio frames.

2. The automatic gain control method integrating adaptive dynamic threshold and dual-envelope tracking according to claim 1, characterized in that, In step one, each frame of audio data has 160 sampling points with a sampling rate of 16kHz, corresponding to a duration of 10ms; the 16kHz is reduced to 4kHz through downsampling.

3. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step two, the calculation of the maximum amplitude envelope specifically involves dividing the 10ms frame into 10 1ms subframes and calculating the maximum amplitude envelope for each subframe: Official 1 in: For input digital audio signals, This is the index for the sampling points.

4. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step two, the fast envelope decays at a fixed rate using the following formula: Official 2 in: For fast envelope value.

5. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step two, the decay rate of the slow envelope is determined by the logarithmic value. As a control signal, it can be categorized into the following situations: Scenario 1: When hour, =-65; Scenario 2: When hour, =0; Scenario 3: When hour, ; in: Logarithmic value; This is the attenuation coefficient.

6. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step three, the formula for counting leading zeros is: Official 3 Official 4 in: frac For the extracted decimal part; It is a 32-bit unsigned integer.

7. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step three, the linear interpolation specifically involves: Official 5 in: This represents the gain value in the gain lookup table, indexed by the "leading zero count zeros" of the signal energy. This represents the gain value at the index position that is 1 less than the current index zeros in the gain lookup table; frac is the extracted decimal part.

8. The automatic gain control method integrating adaptive dynamic threshold and dual envelope tracking according to claim 1, characterized in that, In step three, the VDD gating correction specifically involves: first, calculating the gate value using VDD gating: Official 6 in: For fast envelope leading zero counting, The leading zero count is for the current level. This represents the short-term noise standard deviation. The decision value used to determine whether to activate gating attenuation; Next, calculate the gate decay: Formula 7.

9. The automatic gain control method integrating adaptive dynamic threshold and dual-envelope tracking according to claim 1, characterized in that, In step three, the SPP weighted adjustment is specifically as follows: Official 8 Where: 65536 is the representation of 0dB in Q16 format; This is the original gain after interpolation; This is the final gain after gating and SPP correction; The probability of the existence of speech.

10. An automatic gain control system based on any one of claims 1 to 9, integrating adaptive dynamic threshold and dual-envelope tracking, characterized in that, Includes the following modules: Preprocessing module: Input audio data is downsampled and then sent to the VAD module for interference removal and to calculate the logarithm of the ratio of the current signal energy to the estimated background noise energy. ; Envelope tracking module: includes a fast envelope tracker and a slow envelope tracker; the fast envelope is used to capture speech bursts and transient noise; the slow envelope tracks the long-term energy baseline of the signal; the core of the coordinated operation of the fast and slow envelopes is that the decay rate is dynamically controlled by the logratio output by the VAD module. Dynamic threshold and gain calculation and post-processing module: Take the maximum value between the fast envelope and the slow envelope as the current level value, count the leading zeros, look up the gain table and obtain the linear interpolation; Output module: Performs overload protection loop until the output does not exceed a fixed value; then uses differential linear transition between the gain of the previous frame and the current gain; subsequently outputs samples and audio frames.

Citation Information

Patent Citations

  • Specific lookup table based digital automatic gain control device

    CN101179280A

  • Digital automatic gain control method and device

    CN110660408A

  • An airborne integrated audio processing unit

    CN115022776B

  • Airborne voice processing platform

    CN115841820A

  • Digital gain controller and gain control method

    US5623521A