An extendable automatic gain control method and system
By introducing multi-level threshold voltages and AGC algorithms into the audio amplifier circuit, the compression rate can be adjusted, solving the problem of insufficient sound quality in existing technologies and improving the quality of audio playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI ORIENT CHIP TECH CO LTD
- Filing Date
- 2021-12-20
- Publication Date
- 2026-05-29
AI Technical Summary
The compression rate of the AGC algorithm in existing audio amplifier circuits cannot be adjusted when the signal amplitude changes, resulting in insufficient sound quality.
A scalable automatic gain control method is adopted. By setting multiple threshold voltages and AGC algorithm, the compression rate can be adjusted. The counting signal is calculated using multiple threshold voltages and clock signals, and combined with addition or subtraction operations, the gain signal is synchronized to control the gain of the operational amplifier.
It effectively reduces truncated distortion, optimizes output loudness, and improves the quality of music playback.
Smart Images

Figure CN114268286B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of audio power amplifier gain control, and more specifically to a scalable automatic gain control method and system. Background Technology
[0002] The audio amplifier control circuit is a circuit that amplifies sound. It is the most basic in principle and the most widely used power amplifier circuit.
[0003] With the development of audio amplifier circuits, in order to provide better listening effects and ensure better sound quality, most audio amplifier circuits now include Automatic Gain Control (AGC) algorithms. When the amplitude of the input signal to the power amplifier varies greatly, the output signal amplitude remains constant. When the input signal reaches a certain strength, the compression function is activated, reducing the amplification gain and thus lowering the output amplitude; when the input signal decreases to a certain level, the release function is activated, and the amplification gain is gradually increased again.
[0004] The existing AGC algorithm uses the compression and limiting function of the compressor expander in audio processing. When the signal reaches the power limit point, it actively reduces the gain inside the power amplifier to control the output at the power limit value, protecting the speaker and avoiding distortion and noise, while improving the overall loudness of the sound. However, its compression rate is not adjustable, resulting in many shortcomings in volume and sound quality. Summary of the Invention
[0005] The purpose of this invention is to provide a scalable automatic gain control method and system with adjustable compression rate and higher sound quality.
[0006] This invention provides a scalable automatic gain control method, comprising the following steps:
[0007] S1: Set at least one threshold voltage in descending order of size, compare the output detection voltage with the at least one threshold voltage, and output a counting signal based on the comparison result through an automatic gain control algorithm.
[0008] S2: The gain control signal is obtained by performing addition or subtraction on the counting signal;
[0009] S3: Synchronize the gain signal with the gain control signal and output the gain signal;
[0010] S4: Control the gain of the operational amplifier according to the gain signal.
[0011] Further, step S1 includes:
[0012] When the output detection voltage is greater than the first-stage threshold voltage, an automatic gain control algorithm outputs a counting signal with the first-stage compressed clock signal as the counting rate. When the output detection voltage is less than the last-stage threshold voltage, an automatic gain control algorithm first uses a holding clock signal to output a counting signal with a fixed signal value for a fixed duration, and then outputs a counting signal with the release clock signal as the counting rate. When the output detection voltage is less than the previous stage threshold voltage but greater than the current stage threshold voltage, an automatic gain control algorithm outputs a counting signal with the current stage compressed clock signal as the counting rate.
[0013] Further, step S2 includes:
[0014] The counting signal with the counting rate of the compressed clock signal is added, and the counting signal with the counting rate of the release clock signal is subtracted.
[0015] Furthermore, when the output detection voltage crosses zero, a zero-crossing signal is output. The zero-crossing signal is used to synchronize the gain signal with the gain control signal and output the corresponding gain signal.
[0016] Furthermore, the at least one threshold voltage includes a first threshold voltage, a second threshold voltage, and a third threshold voltage.
[0017] Another aspect of the present invention provides a scalable automatic gain control system, comprising:
[0018] A register module, wherein at least one threshold voltage and at least one clock frequency are set;
[0019] The clock divider module is configured to provide at least one stage of compressed clock signal, hold clock signal, and release clock signal;
[0020] The threshold voltage comparison module is configured to receive the output detection voltage, compare it with the threshold voltages at each level, and output the comparison result.
[0021] The automatic gain control algorithm module is configured to receive the comparison result and the compression clock signal, hold clock signal and release clock signal at each stage, and output a counting signal according to the comparison result;
[0022] The addition / subtraction module is configured to perform addition or subtraction calculations on the counting signal to obtain and output a gain control signal;
[0023] The zero-crossing detection module is configured to synchronize the gain signal with the gain control signal and output the gain signal to the variable gain operational amplifier module.
[0024] The variable gain operational amplifier module is configured to control the gain of the operational amplifier according to the gain signal and output the detected voltage.
[0025] Furthermore, the variable gain operational amplifier module is provided with a power amplifier gain control unit, which is configured to receive the gain signal and control the gain of the variable gain operational amplifier module according to the gain signal.
[0026] Furthermore, the at least one threshold voltage includes a first threshold voltage, a second threshold voltage, and a third threshold voltage that decrease sequentially.
[0027] Furthermore, the automatic gain control algorithm module includes a first-level automatic gain control algorithm unit, a second-level automatic gain control algorithm unit, and a third-level automatic gain control algorithm unit.
[0028] Furthermore, the frequency of the at least one level of compressed clock signal decreases sequentially as the number of levels increases.
[0029] The scalable automatic gain control method and system of the present invention, by setting an adjustable number of multi-level threshold voltages and multi-level AGC algorithms, makes its compression rate adjustable, thereby effectively reducing truncated distortion while optimizing output loudness and improving the quality of music playback. Attached Figure Description
[0030] Figure 1 This is a flowchart of a scalable automatic gain control method according to an embodiment of the present invention;
[0031] Figure 2 This is a diagram illustrating the effect of the scalable automatic gain method according to an embodiment of the present invention when it only includes a first-level AGC algorithm;
[0032] Figure 3 This is a diagram illustrating the effect of the scalable automatic gain method according to an embodiment of the present invention when it includes a multi-level AGC algorithm;
[0033] Figure 4 This is a schematic diagram of a scalable automatic gain system according to another embodiment of the present invention. Detailed Implementation
[0034] The preferred embodiments of the present invention are given below with reference to the accompanying drawings and described in detail.
[0035] The maximum output voltage of an operational amplifier is determined by the voltage of the power supply. When there is a large signal input, the output voltage of the operational amplifier will be limited to the power supply voltage, resulting in truncated distortion. In order to achieve better sound quality, this invention provides a scalable automatic gain control method suitable for audio power amplifiers.
[0036] like Figure 1 As shown, this embodiment of the invention provides a scalable automatic gain control method, including the following steps:
[0037] S1: Set at least one threshold voltage in descending order of size, compare the output detection voltage with the at least one threshold voltage, and output a counting signal through an automatic gain control algorithm to obtain the comparison result.
[0038] Each threshold voltage level can be set by multiple registers; that is, each register sets a threshold voltage level, and each threshold voltage level corresponds to an AGC algorithm unit. Each register controls the opening of the AGC algorithm unit through the threshold voltage, and the comparison result is output as a counting signal after passing through the AGC algorithm unit. Specifically, when the output detection voltage is greater than the first-level threshold voltage, the AGC algorithm outputs a counting signal with the first-level compressed clock signal as the counting rate. When the output detection voltage is less than the last-level threshold voltage, the AGC algorithm first uses a holding clock signal to output a counting signal with a fixed signal value, and then outputs a counting signal with the release clock signal as the counting rate. When the output detection voltage is greater than the current-level threshold voltage (between the second-level and last-level threshold voltages) but less than the previous-level threshold voltage, the AGC algorithm outputs a counting signal with the current-level compressed clock signal as the counting rate. The previous level refers to the level before the current level. For example, when the current level is the second level, its previous level is the first level; when the current level is the third level, its previous level is the second level, and so on.
[0039] In this system, the frequency of each level of compressed clock signal can be adjusted, and the frequency decreases sequentially. That is, the frequency of the first level compressed clock signal is greater than the frequency of the second level compressed clock signal, the frequency of the second level compressed clock signal is greater than the frequency of the third level compressed clock signal, and so on. This allows for the generation of counting signals at different rates, thereby enabling gain signals with different speed controls.
[0040] S2: The gain control signal is obtained by performing addition or subtraction on the counting signal;
[0041] Addition and subtraction operations are implemented through an addition / subtraction module. Different operations are required for different counting signals. Specifically, addition is performed on counting signals with a count rate based on a compressed clock signal, and subtraction is performed on counting signals with a count rate based on a release clock signal. Specifically, the counter starts from 0 for the first time. When the counter's count value is 0, the gain control signal is the default gain (i.e., the initial gain). For signals with a count rate based on a compressed clock signal, the gain control signal for the current moment is obtained by adding the count signal to the gain control signal from the previous moment. For counting signals with a count rate based on a hold clock signal, the gain control signal remains unchanged. For counting signals with a count rate based on a release clock signal, the gain control signal for the current moment is obtained by subtracting the count signal from the gain control signal from the previous moment.
[0042] S3: Synchronize the gain control signal and output the gain signal;
[0043] Synchronization of the gain control signal can be achieved through a zero-crossing detection module. Specifically, when the output detection voltage is detected to cross zero, it outputs a zero-crossing signal. The zero-crossing signal is used to synchronize the gain signal with the gain control signal (that is, when the zero-crossing signal is received, the value of the gain control signal at this time is used as the value of the gain signal before the next zero-crossing signal is received), and the corresponding gain signal is output at the same time.
[0044] S4: Control the gain of the operational amplifier according to the gain signal.
[0045] The gain of the operational amplifier can be controlled by the power amplifier gain control module, which includes a gain control unit. In step S4, the gain control unit is controlled according to the gain signal, thereby controlling the gain of the operational amplifier.
[0046] The threshold voltage and the number of AGC levels can be set according to specific requirements, such as one, two, three or more levels. The number of registers also has a corresponding number, with one AGC algorithm unit set in each register. Preferably, a switch signal can be set in the register to control the start or stop of each level of the AGC algorithm unit, thereby controlling the specific number of levels.
[0047] The scalable automatic gain method of the present invention will be specifically illustrated below using a three-level threshold voltage and a three-level AGC algorithm unit as an example.
[0048] At this point, the scalable automatic gain method is configured with first-level threshold voltages, second-level threshold voltages, and third-level threshold voltages, from largest to smallest. When the output detection voltage is greater than the first-level threshold voltage, the first-level compression logic flag signal FLAG-ATT1 activates the first-level AGC algorithm unit. The comparison result between the output detection voltage and the first-level threshold voltage is output by the first-level AGC algorithm as a counting signal with the first-level compression clock signal CLK_ATT1 as the counting rate. Then, the addition is performed by the addition / subtraction module. <m:0>The gain control signal is obtained after the +1 calculation, and then the zero-crossing detection module synchronizes the gain control signal to output the corresponding gain signal GAIN. <n:0>Finally, the gain signal GAIN <n:0>The gain of the variable gain operational amplifier module can be changed by the power amplifier gain control module.
[0049] When the output detection voltage is less than the first-level threshold voltage and greater than the second-level threshold voltage, the second-level compression logic flag signal FLAG-ATT2 activates the first-level AGC algorithm unit. The comparison result is output by the second-level AGC algorithm as a counting signal with the second-level compression clock signal CLK_ATT2 as the counting rate, and then addition is performed by the addition / subtraction module. <m:0>The gain control signal is obtained after the +1 calculation, and then the zero-crossing detection module synchronizes the gain control signal to output the corresponding gain signal GAIN. <n:0>Finally, the gain signal GAIN <n:0>The gain of the variable gain operational amplifier module can be changed by the power amplifier gain control module.
[0050] When the output detection voltage is less than the second-level threshold voltage and greater than the third-level threshold voltage, the third-level compression logic flag signal FLAG-ATT3 activates the third-level AGC algorithm unit. The comparison result is output by the third-level AGC algorithm as a counting signal with the third-level compression clock signal CLK_ATT3 as the counting rate, and then addition is performed by the addition / subtraction module. <m:0>The gain control signal is obtained after the +1 calculation, and then the zero-crossing detection module synchronizes the gain control signal to output the corresponding gain signal GAIN. <n:0>Finally, the gain signal GAIN <n:0>The gain of the variable gain operational amplifier module can be changed by the power amplifier gain control module.
[0051] The frequencies of the first-level compressed clock signal CLK_ATT1, the second-level compressed clock signal CLK_ATT2, and the third-level compressed clock signal CLK_ATT3 decrease sequentially.
[0052] When the output detection voltage is less than the third-level threshold voltage, the third-level release logic flag signal FLAG_RLS3 controls the corresponding clock signal. First, a fixed-duration hold clock signal CLK_HLD is used to obtain a count signal with a constant count value. Then, a gain control signal with a constant value is obtained. After a fixed duration of the hold clock signal, the release clock signal CLK_RLS outputs the corresponding count signal. Based on the count signal, subtraction is performed by the addition / subtraction module CNT. <m:0>The gain control signal is obtained after the calculation of -1, and then the zero-crossing detection module synchronizes the gain control signal to output the corresponding gain signal GAIN. <n:0>The gain signal GAIN <n:0>The gain of the variable gain op-amp module is controlled by the power amplifier gain control module, meaning that the op-amp gain is only adjusted when it crosses zero.
[0053] In this embodiment, the first-level threshold voltage is used to reduce truncated distortion, the second-level threshold voltage is used to increase the average output volume, and the third-level threshold voltage is used to set the output power limit. When there are more threshold voltage levels, the first-level threshold voltage is used to reduce truncated distortion, the secondary threshold voltages are used to increase dynamic range, improve average power and loudness, and the last-level threshold voltage is used to set the output power limit. The more secondary threshold voltage levels there are, the more precise the adjustment can be, thereby improving the music quality.
[0054] like Figure 2 As shown, in a method with only one AGC algorithm unit, the initial input signal Vin is amplified by a power amplifier to output Vout. As Vin increases, Vout output exhibits truncated distortion, exceeding the first-stage threshold voltage, triggering the first-stage AGC algorithm for rapid compression to reduce the truncated distortion time and reach the set threshold power, at which point compression ends. When the input signal Vin decreases, causing the output signal Vout to decrease below the first threshold, it is initially held for a period of time. After the release signal is activated, the release power voltage amplitude is reached, and the release ends. Figure 2 The dashed and solid lines represent the gains obtained by AGC compression at different rates, with the rate of the dashed line being half that of the solid line.
[0055] like Figure 3 As shown, in the method of the present invention including a multi-level AGC algorithm unit, Vin is the input signal and Vout is the output signal. Initially, the input signal Vin is amplified by a power amplifier to output Vout. As Vin increases, Vout output exhibits truncated distortion. When it exceeds the first-level threshold voltage, the first-level AGC algorithm is triggered for rapid compression to reduce the truncated distortion time. When the voltage is less than the first-level threshold voltage but greater than the second-level threshold voltage, the second-level AGC is activated to slow down the compression speed and increase the average output volume. When the voltage is less than the second-level threshold voltage but greater than the third-level threshold voltage, the third-level AGC begins to compress the signal until it reaches the set threshold power, at which point the compression ends. When the input signal Vin decreases, causing the output signal Vout to decrease below the third threshold, it is first held for a period of time. After the release signal is activated and the release power voltage amplitude is reached, the release ends. The fourth and fifth levels of AGC, and so on, are adjustable multi-level gain AGCs. It can be seen that the more levels there are, the smoother the gain curve becomes, allowing for more precise output control. The number of levels can be changed according to the actual application, thereby improving volume loudness, average power, and increasing dynamic range.
[0056] The scalable automatic gain control method provided in this invention adjusts the compression rate by setting an adjustable number of threshold voltages and a multi-level AGC algorithm, thereby effectively reducing truncated distortion while optimizing output loudness and improving the quality of music playback.
[0057] like Figure 4 As shown, another embodiment of the present invention provides a scalable automatic gain control system, which can implement the scalable automatic gain control method of the above embodiments, including:
[0058] The variable gain operational amplifier module 1 is used to control the gain of the operational amplifier according to the gain signal and output the output detection voltage.
[0059] Register module 2 is used to set at least one threshold voltage and at least one clock frequency, with each threshold voltage corresponding to one clock frequency.
[0060] Threshold voltage comparison module 3 is used to receive the output detection voltage, compare it with the threshold voltages at each level, and output the comparison result;
[0061] The clock divider module 4 is used to divide at least one level of clock frequency into at least one level of compressed clock signal, holding clock signal and release clock signal with adjustable rate; the rate of compressed clock signal, holding clock signal and release clock signal can be set in register, thereby realizing adjustment;
[0062] AGC algorithm module 5 is used to receive comparison results and various levels of compression clock signals, hold clock signals and release clock signals, and output counting signals.
[0063] Addition / subtraction module 6 is used to perform addition or subtraction operations on the counting signal and output a gain control signal;
[0064] Zero-crossing detection module 7 is used to synchronize the gain control signal and output the gain signal to the variable gain operational amplifier module.
[0065] The variable gain operational amplifier module 1 is equipped with a power amplifier gain control unit 11, which receives a gain signal and controls the gain of the variable gain operational amplifier module 1 according to the gain signal.
[0066] The AGC algorithm module 5 is equipped with AGC algorithm units for each level, which correspond one-to-one with the threshold voltages at each level. These units are used to calculate the counting signals of the output detection voltages at each level.
[0067] In one feasible implementation, register module 2 is provided with three threshold voltage levels: a first threshold voltage, a second threshold voltage, and a third threshold voltage, with their values decreasing sequentially. The first threshold voltage is used to reduce truncated distortion, the second threshold voltage is used to increase the average output volume, and the third threshold voltage is used to set the output power limit.
[0068] The compression clock signals at each stage also decrease sequentially, that is, the first-stage compression clock signal is less than the second-stage compression clock signal, the second-stage compression clock signal is less than the third-stage compression clock signal, and so on.
[0069] The scalable automatic gain control system provided in this embodiment of the invention, by setting an adjustable number of multi-level threshold voltages and AGC algorithm modules, makes its compression rate adjustable, thereby effectively reducing truncated distortion while optimizing output loudness and improving the quality of music playback.
[0070] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of the invention. Various variations can be made to the above embodiments of the present invention. That is, all simple and equivalent changes and modifications made based on the claims and description of this invention fall within the protection scope of the claims of this patent. All aspects not described in detail in this invention are conventional technical content.
Claims
1. A scalable automatic gain control method, characterized in that, Includes the following steps: S1: Set at least one threshold voltage in descending order of size, compare the output detection voltage with the at least one threshold voltage, and output a counting signal based on the comparison result through an automatic gain control algorithm; S2: The gain control signal is obtained by performing addition or subtraction on the counting signal; S3: Synchronize the gain signal with the gain control signal and output the gain signal; S4: Control the gain of the operational amplifier according to the gain signal; Step S1 includes: When the output detection voltage is greater than the first-stage threshold voltage, the automatic gain control algorithm outputs a counting signal with the first-stage compressed clock signal as the counting rate; when the output detection voltage is less than the last-stage threshold voltage, the automatic gain control algorithm first uses the holding clock signal to output a counting signal with a fixed signal value for a fixed duration, and then outputs a counting signal with the release clock signal as the counting rate; when the output detection voltage is less than the previous stage threshold voltage but greater than the current stage threshold voltage, the automatic gain control algorithm outputs a counting signal with the current stage compressed clock signal as the counting rate. In step S2, an addition operation is performed on the counting signal with the compression clock signal as the counting rate to obtain a gain control signal, and a subtraction operation is performed on the counting signal with the release clock signal as the counting rate to obtain a gain control signal. For the counting signal with the holding clock signal as the counting rate, the gain control signal remains unchanged. In step S4, when the output detection voltage crosses zero, a zero-crossing signal is output. The zero-crossing signal is used to synchronize the gain signal with the gain control signal and output the corresponding gain signal.
2. The scalable automatic gain control method according to claim 1, characterized in that, The at least one threshold voltage includes a first threshold voltage, a second threshold voltage, and a third threshold voltage.
3. A scalable automatic gain control system, characterized in that, include: A register module, wherein at least one threshold voltage and at least one clock frequency are set; The clock divider module is configured to provide at least one stage of compressed clock signal, hold clock signal, and release clock signal; The threshold voltage comparison module is configured to receive the output detection voltage, compare it with the threshold voltages at each level, and output the comparison result. The automatic gain control algorithm module is configured to receive the comparison result and the compression clock signal, hold clock signal and release clock signal at each stage, and output a counting signal according to the comparison result; The addition / subtraction module is configured to perform addition or subtraction calculations on the counting signal to obtain and output a gain control signal; The zero-crossing detection module is configured to output a zero-crossing signal when the output detection voltage is detected to cross zero, and to use the zero-crossing signal to synchronize the gain signal with the gain control signal, and output the gain signal to the variable gain operational amplifier module. The variable gain operational amplifier module is configured to control the gain of the operational amplifier according to the gain signal and output the output detection voltage. The counting signal is output based on the comparison result, specifically including: When the output detection voltage is greater than the first-stage threshold voltage, the automatic gain control algorithm outputs a counting signal with the first-stage compressed clock signal as the counting rate; when the output detection voltage is less than the last-stage threshold voltage, the automatic gain control algorithm first uses the holding clock signal to output a counting signal with a fixed signal value for a fixed duration, and then outputs a counting signal with the release clock signal as the counting rate; when the output detection voltage is less than the previous stage threshold voltage but greater than the current stage threshold voltage, the automatic gain control algorithm outputs a counting signal with the current stage compressed clock signal as the counting rate. The gain control signal is obtained and output after performing addition or subtraction on the counting signal, specifically including: The gain control signal is obtained by performing an addition operation on the counting signal with the compression clock signal as the counting rate, and the gain control signal is obtained by performing a subtraction operation on the counting signal with the release clock signal as the counting rate. The gain control signal remains unchanged for the counting signal with the holding clock signal as the counting rate.
4. The scalable automatic gain control system according to claim 3, characterized in that, The variable gain operational amplifier module is equipped with a power amplifier gain control unit, which is configured to receive the gain signal and control the gain of the variable gain operational amplifier module according to the gain signal.
5. The scalable automatic gain control system according to claim 3, characterized in that, The at least one threshold voltage includes a first threshold voltage, a second threshold voltage, and a third threshold voltage that decrease sequentially.
6. The scalable automatic gain control system according to claim 5, characterized in that, The automatic gain control algorithm module includes a first-level automatic gain control algorithm unit, a second-level automatic gain control algorithm unit, and a third-level automatic gain control algorithm unit.
7. The scalable automatic gain control system according to claim 5, characterized in that, The frequency of the at least one level of compressed clock signal decreases sequentially as the number of levels increases.