Gain control method of audio amplifier
By detecting the amplitude and zero point of the audio amplifier's output signal, the gain is reduced to address noise issues, thereby reducing noise, avoiding waveform distortion, and improving the performance of the audio amplifier.
Patent Information
- Application Number
- CN202511144422.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-11-28
AI Technical Summary
Existing audio amplifiers suffer from significant noise during use, hindering their further application.
By detecting the amplitude of the output signal of the audio amplifier, if it is less than a preset threshold, it is detected whether it has passed through zero. After detecting zero, the gain is reduced to reduce noise.
It effectively reduces noise, avoids distortion of output signal waveform, reduces noise, and improves the application effect of audio amplifiers.
Smart Images

Figure CN121036716A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of audio amplifier technology, and in particular to a gain control method of an audio amplifier. BACKGROUND
[0002] An audio amplifier can amplify an audio signal to drive a loudspeaker, so that the loudspeaker plays sound. Audio amplifiers, such as class-D audio amplifiers, etc., have important applications in modern electronic devices.
[0003] However, the audio amplifier in the related art has the problem of large noise when in use, which limits the further application of the audio amplifier. SUMMARY
[0004] The present application provides a gain control method of an audio amplifier to reduce the noise of the audio amplifier.
[0005] According to an aspect of the present application, a gain control method of an audio amplifier is provided, comprising:
[0006] detecting an amplitude of an output signal of the audio amplifier;
[0007] if the amplitude of the output signal is less than a first preset threshold, detecting whether the output signal passes through a zero point;
[0008] after detecting that the output signal passes through the zero point, reducing a gain of the audio amplifier.
[0009] Optionally, the step of detecting whether the output signal passes through the zero point if the amplitude of the output signal is less than the first preset threshold comprises:
[0010] continuously detecting whether the output signal passes through the zero point within a first preset time;
[0011] The gain control method further comprises:
[0012] if the output signal is not detected to pass through the zero point within the first preset time, performing the step of reducing the gain of the audio amplifier after the first preset time.
[0013] Optionally, the step of reducing the gain of the audio amplifier further comprises:
[0014] controlling a gain reduction rate;
[0015] continuously detecting whether the output signal passes through the zero point within a second preset time;
[0016] after detecting that the output signal passes through the zero point, returning to perform the step of reducing the gain of the audio amplifier.
[0017] Optionally, the control gain decrease rate comprises:
[0018] delaying for a first delay time.
[0019] Optionally, if the output signal does not pass zero point within a second preset time, then after the second preset time, the step of decreasing the gain of the audio amplifier is performed again.
[0020] Optionally, the gain control method further comprises:
[0021] during the first delay time and / or the second preset time, continuously detecting whether the gain of the audio amplifier needs to be increased;
[0022] if yes, then after detecting that the output signal passes zero point, increasing the gain of the audio amplifier.
[0023] Optionally, the continuously detecting whether the gain of the audio amplifier needs to be increased during the first delay time and / or the second preset time comprises:
[0024] during the first delay time and / or the second preset time, continuously detecting whether the output signal is greater than or equal to a second preset threshold value; if yes, then determining that the gain of the audio amplifier needs to be increased; wherein the second preset threshold value is greater than or equal to the first preset threshold value.
[0025] Optionally, before increasing the gain of the audio amplifier, the method further comprises:
[0026] controlling a gain increase rate of the audio amplifier.
[0027] Optionally, the gain control method further comprises:
[0028] if it is detected that the gain of the audio amplifier needs to be increased, and if the output signal does not pass zero point within a third preset time, then after the third preset time, the gain of the audio amplifier is increased.
[0029] Optionally, the detecting whether the output signal passes zero point comprises:
[0030] detecting whether a zero-crossing detection signal jumps; if yes, then determining that the output signal passes zero point; wherein if the output signal is less than zero, then the zero-crossing detection signal is a first level; if the output signal is greater than zero, then the zero-crossing detection signal is a second level.
[0031] the detecting whether the zero-crossing detection signal jumps comprises:
[0032] detecting whether an edge detection signal is a third level;
[0033] If yes, continuously detecting whether the edge detection signal is the fourth level;
[0034] If yes, continuously detecting whether the edge detection signal is the third level;
[0035] If yes, determining that the zero-crossing detection signal jumps.
[0036] Optionally, the gain control method further comprises:
[0037] If the amplitude of the output signal is less than the first preset threshold value within the fourth preset time, the step of detecting whether the output signal crosses zero is performed.
[0038] The technical scheme of the embodiment of the present application adopts a gain control method of an audio amplifier, which comprises: detecting the amplitude of an output signal of the audio amplifier; if the amplitude of the output signal is less than a first preset threshold value, detecting whether the output signal crosses zero; and after detecting that the output signal crosses zero, reducing the gain of the audio amplifier. When the amplitude of the output signal is small, noise is reduced by reducing the gain of the audio amplifier; meanwhile, the gain is reduced only when it is detected that the output signal crosses zero, so that waveform distortion of the output signal is avoided and noise is not heard by the human ear.
[0039] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0041] Figure 1 A flow chart of a gain control method of an audio amplifier provided by the embodiment of the present application;
[0042] Figure 2 A circuit structure schematic diagram of an audio amplifier provided by the embodiment of the present application;
[0043] Figure 3 A waveform diagram of an output signal provided by the embodiment of the present application;
[0044] Figure 4 A waveform diagram of zero-crossing detection of an output signal provided by the embodiment of the present application;
[0045] Figure 5A flow chart of output signal zero-crossing detection provided for an embodiment of the present application;
[0046] Figure 6 A flow chart of another gain control method of an audio amplifier provided for an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the personnel in the art without creative labor should belong to the protection scope of the present application.
[0048] It should be noted that the terms “first”, “second”, and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be exchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms “include” and “have” and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0049] Figure 1 A flow chart of a gain control method of an audio amplifier provided for an embodiment of the present application, referring to Figure 1 The gain control method of the audio amplifier comprises:
[0050] Step S110, detecting the amplitude of the output signal of the audio amplifier;
[0051] Specifically, Figure 2 A circuit structure schematic diagram of an audio amplifier provided for an embodiment of the present application, as Figure 2The audio amplifier can be a class-D audio amplifier, and can include two differential amplification links. One differential amplification link has an input end of the first input end INP of the audio amplifier and an output end of the first output end VOP of the audio amplifier. The other differential amplification link has an input end of the second input end INN of the audio amplifier and an output end of the second output end VON of the audio amplifier. Each differential amplification link includes an input resistor Rin, an input buffer 11, a first resistor R1, a first amplifier 12, a first capacitor C1, a second resistor R2, a second amplifier 13, a third resistor R3, a second capacitor C2, a third amplifier 14, an H-bridge, a fourth resistor R4, a fifth resistor R5, and a sixth resistor R6. The audio amplifier further includes a signal generator OSC. The specific circuit connection relationship of the audio amplifier is shown in FIG. 2, and the specific working principle thereof is well known to those skilled in the art and will not be described here again. The output signal of the audio amplifier can be a filtered signal of the signals of the first output end VOP and the second output end VON. In addition, the amplitude of the output signal can be detected in real time. If the amplitude of the output signal is large, it indicates that the sound is large at this time. If the amplitude of the output signal is small, it indicates that the sound is small at this time. Figure 2 The specific circuit connection relationship of the audio amplifier is shown in FIG. 2, and the specific working principle thereof is well known to those skilled in the art and will not be described here again. The output signal of the audio amplifier can be a filtered signal of the signals of the first output end VOP and the second output end VON. In addition, the amplitude of the output signal can be detected in real time. If the amplitude of the output signal is large, it indicates that the sound is large at this time. If the amplitude of the output signal is small, it indicates that the sound is small at this time.
[0052] Step S120, if the amplitude of the output signal is less than the first preset threshold, whether the output signal passes through a zero point is detected.
[0053] Specifically, the noise of the audio amplifier is related to the gain. When the gain is large, the noise is also large. Correspondingly, when the gain is small, the noise is also small. After the amplitude of the output signal of the audio amplifier is detected, the amplitude is compared with the first preset threshold. If the amplitude is less than the first preset threshold, it indicates that the amplitude of the output signal of the audio amplifier is small at this time, and the sound heard by the human ear is also small, which can be basically ignored by the human ear, that is, the human ear basically cannot hear the played sound. At this time, if the gain of the audio amplifier is large, the noise is also large, and the human ear can only hear the noise. Therefore, at this time, the gain can be reduced to reduce the noise.
[0054] The output signal is a sine signal. If the gain is directly reduced, the output signal will be deformed, and the human ear will hear noise. In the embodiment, whether the output signal passes through a zero point can be detected first for subsequent use.
[0055] Step S130, after it is detected that the output signal passes through a zero point, the gain of the audio amplifier is reduced.
[0056] Specifically, in the embodiment, once the output signal is detected to pass through the zero point, the gain of the audio amplifier is immediately reduced, so that the noise of the audio amplifier is reduced, and the noise, such as the hissing sound, heard by the human ear is also reduced. In addition, since the amplitude of the output signal at this time is 0, the amplitude of the corresponding input signal is also 0, and the change of the gain of the audio amplifier at this time will not cause the sudden deformation of the output signal, so that the noise heard by the human ear can be avoided. In other words, the positive half cycle or the negative half cycle of the output signal of the audio amplifier is still a half cycle of the sine wave. By contrast, if the gain is adjusted when the output signal is not 0, the waveform of the output signal is in the positive half cycle or the negative half cycle, and the waveform of the half cycle of the output signal is deformed relative to the half cycle of the sine wave, so that the human ear may hear the noise.
[0057] The technical scheme of the embodiment adopts the gain control method of the audio amplifier, which comprises the following steps: detecting the amplitude of the output signal of the audio amplifier; if the amplitude of the output signal is less than a first preset threshold, detecting whether the output signal passes through the zero point; and reducing the gain of the audio amplifier after detecting that the output signal passes through the zero point. When the amplitude of the output signal is small, the noise is reduced by reducing the gain of the audio amplifier; and the gain is reduced only when it is detected that the output signal passes through the zero point, so that the waveform of the output signal is prevented from being deformed, and the human ear is prevented from hearing the noise.
[0058] Exemplarily, as shown in Figure 3 , Figure 3 The waveform diagram of the output signal provided by the embodiment of the application is a sine signal. When the amplitude of the output signal is detected to be less than a first preset threshold Vth1 at a first time point t1, it is started to detect whether the output signal passes through the zero point, and the gain of the audio amplifier is reduced when it is detected that the output signal passes through the zero point. That is, the gain of the audio amplifier is reduced at the first zero point (a second time point t2) after the first time point t1.
[0059] Optionally, if the amplitude of the output signal is less than the first preset threshold, detecting whether the output signal passes through the zero point comprises:
[0060] The output signal is continuously detected whether it passes through the zero point within a first preset time.
[0061] Specifically, the first preset time is greater than or equal to a half cycle of the output signal, so that it can be ensured that the output signal actually passes through the zero point within the first preset time after the zero detection is started. When it is detected that the output signal passes through the zero point, the step of reducing the gain is immediately performed. The gain can be reduced by a preset step length, that is, the gain is reduced by one step length each time.
[0062] Optionally, the gain control method further comprises: if the output signal is not detected to pass through zero point within the first preset time, then executing the step of reducing the gain of the audio amplifier after the first preset time.
[0063] Specifically, the gain control method of the audio amplifier can be realized by an algorithm program, and in some scenarios, such as the amplitude of the output signal being too small, the output signal can not be detected to pass through zero point. Therefore, the embodiment is provided to directly execute the step of reducing the gain of the audio amplifier if the output signal is not detected to pass through zero point within the first preset time after starting the zero-crossing detection, so as to prevent the algorithm program from being stuck.
[0064] Optionally, Figure 4 a waveform diagram of the output signal zero-crossing detection provided by the embodiment of the present application, Figure 5 a flowchart of the output signal zero-crossing detection provided by the embodiment of the present application, with reference to Figure 4 and Figure 5 The output signal zero-crossing detection, i.e., detecting whether the output signal passes through zero point, comprises:
[0065] detecting whether the zero-crossing detection signal ZS jumps, and if the zero-crossing detection signal ZS jumps, it is determined that the output signal passes through zero point; wherein if the output signal is less than zero, the zero-crossing detection signal ZS is a first level; if the output signal is greater than zero, the zero-crossing detection signal ZS is a second level. The first level can be a low level, and the second level can be a high level.
[0066] More specifically, the edge detection signal ZSF can be used to determine whether the zero-crossing detection signal ZS jumps; wherein the edge detection signal ZSF only outputs a pulse of a fourth level when the zero-crossing detection signal ZS jumps, and the duration of the fourth level is much smaller than the period of the output signal. The edge detection signal ZSF is at a third level at other times. The third level can be a low level, and the fourth level can be a high level. In the zero-crossing detection, first determine whether the edge detection signal ZSF is at the third level; if the edge detection signal ZSF is detected to be at the third level, then start continuously detecting whether the edge detection signal is at the fourth level, and at the same time, the first timer starts timing. During this period, continuously detect whether the output signal is less than the first preset threshold value, if the output signal is still less than the first preset threshold value, then determine whether the first timer is full, when it is full, it indicates that no zero-crossing is detected within the first preset time, so the zero-crossing detection can be directly exited, and the step of reducing the gain is directly executed. When the edge detection signal ZSF is detected to be at the fourth level, the edge detection signal ZSF is detected again to determine whether it is at the third level, if the edge detection signal ZSF is detected to jump to the third level again, it indicates that the edge detection signal ZSF has a pulse of a high level, that is, the output signal passes through zero point. Alternatively, in the embodiment, if the output signal is detected to be greater than the first preset threshold value Vth1, the first timer can be stopped and cleared, and then return to the initial step.
[0067] In the above embodiment, whether the output signal is less than the first preset threshold value can be detected by detecting whether the amplitude marker signal is 1, when the amplitude marker signal is 1, it indicates that the output signal is less than the first preset threshold value; when the amplitude marker signal is not 1, it indicates that the output signal is greater than or equal to the first preset threshold value.
[0068] Alternatively, Figure 6 Another flowchart of a gain control method of an audio amplifier is provided in the embodiment of the present application, referring to Figure 6 The gain control method of the audio amplifier comprises:
[0069] In step S201, it is determined whether the amplitude of the output signal is less than the first preset threshold value, if not, return to step S201; if yes, execute step S202;
[0070] Step S202, it is judged whether the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the amplitude of the output signal is less than the first preset threshold in the fourth preset time, step S203 is executed. If the amplitude of the output signal is greater than or equal to the first preset threshold in the fourth preset time, step S203 is not executed, and step S201 is executed. After the amplitude of the output signal is less than the first preset threshold for a certain time, it is indicated that the output signal is not less than the first preset threshold due to accidental factors, and the probability of being less than the first preset threshold is also large. Therefore, the setting of the embodiment is that the zero-crossing detection is performed only after the amplitude of the output signal is less than the first preset threshold for a certain time, which can prevent the algorithm program from repeatedly entering and exiting the zero-crossing detection. Further, it is judged whether the output signal is less than the first preset threshold in the fourth preset time, which includes: controlling the second timer to start timing, and then executing a loop of detecting whether the output signal is less than the first preset threshold and judging whether the second timer is full. If the second timer is full, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the second timer is not full, the second timer continues to time. If the amplitude of the output signal is greater than the first preset threshold in the loop, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. At this time, step S201 can be returned, and the second timer can be disabled and cleared before returning to step S201.
[0071] Step S203, it is judged whether the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the amplitude of the output signal is less than the first preset threshold in the fourth preset time, step S203 is executed. If the amplitude of the output signal is greater than or equal to the first preset threshold in the fourth preset time, step S203 is not executed, and step S201 is executed. After the amplitude of the output signal is less than the first preset threshold for a certain time, it is indicated that the output signal is not less than the first preset threshold due to accidental factors, and the probability of being less than the first preset threshold is also large. Therefore, the setting of the embodiment is that the zero-crossing detection is performed only after the amplitude of the output signal is less than the first preset threshold for a certain time, which can prevent the algorithm program from repeatedly entering and exiting the zero-crossing detection. Further, it is judged whether the output signal is less than the first preset threshold in the fourth preset time, which includes: controlling the second timer to start timing, and then executing a loop of detecting whether the output signal is less than the first preset threshold and judging whether the second timer is full. If the second timer is full, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the second timer is not full, the second timer continues to time. If the amplitude of the output signal is greater than the first preset threshold in the loop, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. At this time, step S201 can be returned, and the second timer can be disabled and cleared before returning to step S201. Figure 5 Figure 5 Step S203, it is judged whether the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the amplitude of the output signal is less than the first preset threshold in the fourth preset time, step S203 is executed. If the amplitude of the output signal is greater than or equal to the first preset threshold in the fourth preset time, step S203 is not executed, and step S201 is executed. After the amplitude of the output signal is less than the first preset threshold for a certain time, it is indicated that the output signal is not less than the first preset threshold due to accidental factors, and the probability of being less than the first preset threshold is also large. Therefore, the setting of the embodiment is that the zero-crossing detection is performed only after the amplitude of the output signal is less than the first preset threshold for a certain time, which can prevent the algorithm program from repeatedly entering and exiting the zero-crossing detection. Further, it is judged whether the output signal is less than the first preset threshold in the fourth preset time, which includes: controlling the second timer to start timing, and then executing a loop of detecting whether the output signal is less than the first preset threshold and judging whether the second timer is full. If the second timer is full, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. If the second timer is not full, the second timer continues to time. If the amplitude of the output signal is greater than the first preset threshold in the loop, it is determined that the amplitude of the output signal is less than the first preset threshold in the fourth preset time. At this time, step S201 can be returned, and the second timer can be disabled and cleared before returning to step S201.
[0072] Step S204, the gain of the audio amplifier is reduced.
[0073] Optionally, after the gain of the audio amplifier is reduced, that is, after step S204, it further includes: controlling the gain reduction rate; continuously detecting whether the output signal passes through zero in the second preset time; after detecting that the output signal passes through zero, returning to execute the step of reducing the gain of the audio amplifier.
[0074] Specifically, the gain of the audio amplifier can be reduced at a predetermined rate to prevent the gain from being reduced too fast to cause the audio transition to be not smooth. After the step of reducing the gain is performed once, the gain is controlled to be reduced at the predetermined rate. The control of the gain reduction rate includes delaying for a first delay time. That is, the degree of the gain reduced each time can be the same, and the gain is reduced once every first delay time. The first delay time is configured to control the gain reduction rate. The shorter the first delay time is, the faster the gain reduction rate is; and correspondingly, the longer the first delay time is, the slower the gain reduction rate is.
[0075] Within a second preset time after the first delay time, it is detected whether the output signal passes zero. After the output signal is detected to pass zero, the step of reducing the gain of the audio amplifier is performed.
[0076] Specifically, the first delay time corresponds to the rate of the gain reduction of the audio amplifier. That is, the shorter the first delay time is, the faster the gain reduction is; and the longer the first delay time is, the slower the gain reduction is. In the embodiment, the gain is not directly reduced to the minimum value, but is reduced at a preset rate to make the change of the output signal more smooth. In addition, after the first delay time, the gain is not directly reduced, but is reduced after the output signal is detected to pass zero to prevent the waveform mutation of the output signal from causing noise. It should be noted that the gain of the audio amplifier has a lower limit value, and if the gain of the audio amplifier has reached the lower limit value, the gain is not reduced, but is kept unchanged.
[0077] Optionally, if the output signal is not detected to pass zero within the second preset time, the step of reducing the gain of the audio amplifier is performed after the second preset time. That is, if the output signal is not detected to pass zero all the time, it can be because the output signal is too small to be detected to pass zero, and in this case, the gain of the audio amplifier can be directly reduced to prevent the gain control method from being stuck in a dead loop.
[0078] Further, as shown in Figure 6 the gain control method further includes: within the first delay time, continuously detecting whether the gain of the audio amplifier needs to be increased; and if yes, increasing the gain of the audio amplifier after the output signal is detected to pass zero.
[0079] Specifically, when the user needs to play music or the like, the gain of the audio amplifier needs to be increased to ensure that the audio can be normally played. Therefore, within the first delay time, the step of detecting whether the gain of the audio amplifier needs to be increased is performed to ensure that the gain can be timely increased when the gain needs to be increased. In addition, when it is detected that the gain of the audio amplifier needs to be increased, the gain is not directly increased, but is increased after the output signal is detected to pass zero to prevent the waveform of the output signal from being deformed.
[0080] Optionally, the continuously detecting whether the gain of the audio amplifier needs to be increased in the first delay time comprises: continuously detecting whether the amplitude of the output signal is greater than or equal to a second preset threshold in the first delay time; wherein the second preset threshold is greater than or equal to the first preset threshold; that is, step S205, judging whether the output signal is greater than or equal to the second preset threshold in the first delay time. Wherein the second preset threshold is greater than or equal to the first preset threshold. If yes, it is determined that the gain of the audio amplifier needs to be increased.
[0081] If yes, step S207 is performed. In step S207, it is continuously detected whether the output signal passes through zero point in a third preset time. If yes, step S208 is performed, that is, the gain is increased.
[0082] Specifically, in step S205, that is, in the first delay time, it can be judged in real time whether the output signal is greater than or equal to the second preset threshold. Once it is detected that the amplitude of the output signal is greater than the second preset threshold, it indicates that the amplitude of the input signal at this time is also large, and the user needs to normally hear the audio. If the gain is small at this time, it may not be able to meet the normal playing requirement of the audio, and therefore the gain needs to be increased to meet the normal playing requirement of the audio. Of course, the step of increasing the gain is not immediately increased, but increased after detecting that the output signal passes through zero point, which can also avoid the problem of waveform distortion of the output signal caused by increasing the gain. Exemplarily, as shown in FIG. 2, at a third time point t3, it is detected that the amplitude of the output signal is greater than the second preset threshold Vth2, at a fourth time point t4 after the third time point t3, it is detected that the output signal passes through zero point, and at this time the gain of the audio amplifier is increased. Figure 2
[0083] Optionally, in the above embodiment, the judging whether the output signal is greater than the second preset threshold in the first delay time comprises: configuring a third timer to start timing, then detecting whether the amplitude of the output signal is greater than the second preset threshold, if yes, disabling the third timer, then emptying the third timer, and performing step S207. If the amplitude of the output signal is not detected to be greater than the second preset threshold, it is judged whether the third timer is counted up, if not, the step of judging whether the amplitude of the output signal is greater than the second preset threshold is continuously performed. The timing time of the third timer is the first delay time. When the third timer is counted up, it indicates that the amplitude of the output signal is less than the second preset threshold in the first delay time. Further, the second preset threshold can be equal to the first preset threshold, at this time, whether the amplitude of the output signal is greater than the second preset threshold can be judged according to the amplitude mark signal, that is, when the amplitude mark signal is not 1, it indicates that the amplitude of the output signal is greater than the second preset threshold.
[0084] Optionally, in step S207, whether the output signal passes through zero point in the third preset time can be specifically Figure 5 The zero-crossing detection step is shown. At this time, the timing time corresponding to the first timer is the third preset time. Figure 5 The next step corresponding to the increase of the gain. The third preset time can be equal to the first preset time.
[0085] Optionally, with continuous reference to Figure 6 After the first delay time, detecting whether the output signal crosses zero point includes: continuously detecting whether the output signal crosses zero point within the second preset time. That is, in the judgment of step S205, if the judgment result is that the output signal is less than the first preset threshold within the first delay time. At this time, step S209 is executed, that is, whether the output signal crosses zero point within the second preset time is judged. When the output signal is detected to cross zero point, return to execute step S204. If the output signal is not detected to cross zero point within the second preset time, return to execute step S204 after the second preset time to prevent the program algorithm from being deadlocked. The second preset time can be the same as the first preset time. Step S209 is also a zero-crossing detection step, which can be referred to the description of the zero-crossing detection step in the foregoing embodiment. Figure 5
[0086] Optionally, before continuously detecting whether the output signal crosses zero point within the third preset time, that is, before step S206, it further includes: controlling the gain increasing rate of the audio amplifier.
[0087] Specifically, when the gain of the audio amplifier needs to be increased, the gain is not directly increased to the upper limit value of the gain, but slowly increased at a preset rate, so that the gain transition of the audio is more smooth.
[0088] Optionally, controlling the gain increasing rate of the audio amplifier includes:
[0089] Delaying for a second delay time. The second delay time is used to set the rate of increasing the gain. The shorter the second delay time is, the faster the rate of increasing the gain is; and correspondingly, the longer the second delay time is, the slower the rate of increasing the gain is.
[0090] Optionally, if the output signal is detected to cross zero point within the third preset time, the gain of the audio amplifier is increased after the third preset time. That is, the specific process of step S207 can also be referred to the description of the zero-crossing detection step in the foregoing embodiment. Figure 5 The third preset time can be the same as the first preset time. The setting of the embodiment can also prevent the program algorithm from being deadlocked.
[0091] Optionally, when the gain reaches the maximum value, the gain can no longer be increased, and step S201 is returned to be executed.
[0092] Optionally, the gain control method further comprises: continuously detecting whether the gain of the audio amplifier needs to be increased in a second preset time; if yes, increasing the gain of the audio amplifier after detecting that the output signal passes through zero.
[0093] Specifically, similar to the principle of detecting whether the gain of the audio amplifier needs to be increased in the first delay time, in the second preset time, whether the gain of the audio amplifier needs to be increased is also detected. More specifically, it can also be that whether the output signal is greater than or equal to a second preset threshold in the second preset time is continuously detected. If yes, it is determined that the gain of the audio amplifier needs to be increased. And after detecting that the gain of the audio amplifier needs to be increased, instead of directly increasing the gain of the audio amplifier, it is detected after detecting that the output signal passes through zero, so as to prevent the waveform of the output signal from being deformed.
[0094] Exemplarily, Figure 6 The complete flow shown includes: step S201, judging whether the amplitude of the output signal is less than a first preset threshold; if yes, executing step S202; if no, returning to execute step S201; step S202, judging whether the amplitude of the output signal is less than the first preset threshold in a fourth preset time; if yes, executing step S203, if no, returning to execute step S201.
[0095] Step S203, judging whether the output signal passes through zero in the first preset time; after detecting that the output signal passes through zero, executing step S204; otherwise, after the first preset time, executing step S204.
[0096] Step S204, reducing the gain. Then, executing step S205.
[0097] Step S205, judging whether the output signal is greater than a second preset threshold in a first delay time; if yes, executing step S206 after detecting that the output signal is greater than the second preset threshold; if no, executing step S209 after the first delay time.
[0098] Step S206, delaying for a second delay time; then executing step S207.
[0099] Step S207, judging whether the output signal passes through zero in a third preset time; if yes, executing step S208 after detecting that the output signal passes through zero; if no, executing step S208 after the third preset time.
[0100] Step S209, judging whether the output signal passes through zero in a second preset time; if yes, returning to execute step S204 after detecting that the output signal passes through zero; if no, returning to execute step S204 after the second preset time.
[0101] Optionally, in some embodiments, the gain of the audio amplifier can be adjusted by adjusting the value of the first resistor R1 and / or the feedback resistor Rfb in the audio amplifier; for example, increasing the resistance can increase the gain, and decreasing the resistance can decrease the gain. By adjusting the gain by adjusting at least one of the first resistor R1 and the feedback resistor Rfb, the signal in the audio range will not be filtered out by the high pass filter in the audio amplifier; at the same time, there is no need to increase the capacitance in the audio amplifier, thus there is no need to increase the area required by the entire audio amplifier, which is beneficial to control the cost of the audio amplifier.
[0102] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, the steps described in the present application can be performed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0103] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A gain control method for an audio amplifier, characterized in that, include: Detect the amplitude of the output signal of the audio amplifier; If the amplitude of the output signal is less than the first preset threshold, then it is detected whether the output signal has passed through zero. After detecting that the output signal has passed through zero, the gain of the audio amplifier is reduced.
2. The gain control method for an audio amplifier according to claim 1, characterized in that, The step of detecting whether the output signal has passed through zero if the amplitude of the output signal is less than a first preset threshold includes: The output signal is continuously monitored for zero within a first preset time period. The gain control method further includes: If the output signal is not detected to have passed zero within the first preset time, then the step of reducing the gain of the audio amplifier is performed after the first preset time.
3. The gain control method for an audio amplifier according to claim 1, characterized in that, The process of reducing the gain of the audio amplifier further includes: Control the rate of gain decrease; The output signal is continuously monitored for zero within a second preset time period. After detecting that the output signal has passed through zero, the process returns to the step of reducing the gain of the audio amplifier.
4. The gain control method for an audio amplifier according to claim 3, characterized in that, The control gain decrease rate includes: Delay the first delay time.
5. The gain control method for an audio amplifier according to claim 3, characterized in that, If the output signal is not detected to have passed zero within the second preset time, the process returns to the step of reducing the gain of the audio amplifier after the second preset time.
6. The gain control method for an audio amplifier according to claim 4, characterized in that, The gain control method further includes: During the first delay time and / or the second preset time, continuously detect whether it is necessary to increase the gain of the audio amplifier; If so, the gain of the audio amplifier is increased after the output signal is detected to have passed through zero.
7. The gain control method for an audio amplifier according to claim 6, characterized in that, The step of continuously detecting whether the gain of the audio amplifier needs to be increased during the first delay time and / or the second preset time includes: During the first delay time and / or the second preset time, continuously detect whether the output signal is greater than or equal to a second preset threshold; if so, determine that the gain of the audio amplifier needs to be increased; wherein the second preset threshold is greater than or equal to the first preset threshold.
8. The gain control method for an audio amplifier according to claim 6, characterized in that, Before increasing the gain of the audio amplifier, the following steps are also included: Control the gain rise rate of the audio amplifier.
9. The gain control method for an audio amplifier according to claim 6, characterized in that, The gain control method further includes: If the detection requires increasing the gain of the audio amplifier, and if the output signal is not detected to have passed zero within a third preset time period, then the gain of the audio amplifier is increased after the third preset time period.
10. The gain control method for an audio amplifier according to claim 1, characterized in that, The detection of whether the output signal passes through zero includes: The system detects whether the zero-crossing detection signal changes abruptly. If it does, the system determines that the output signal has passed through zero. If the output signal is less than zero, the zero-crossing detection signal is at a first level; if the output signal is greater than zero, the zero-crossing detection signal is at a second level. The detection of whether the zero-crossing detection signal changes includes: Detect whether the edge detection signal is at the third level; If so, continue to check whether the edge detection signal is at the fourth level; If so, continue to check whether the edge detection signal is at the third level; If so, then the zero-crossing detection signal transition is determined.
11. The gain control method for an audio amplifier according to claim 1, characterized in that, The gain control method further includes: If the amplitude of the output signal is continuously less than the first preset threshold within a fourth preset time period, then the step of detecting whether the output signal has passed through zero is executed.