Automatic gain control method and device

By combining analog gain control and digital gain control, the problem of insufficient adjustment capability and insufficient adaptability of automatic gain adjustment in the prior art is solved, and more sufficient adjustment capability and better adaptability are achieved, and suitable for multimedia equipment. complex needs.

CN119401963APending Publication Date: 2025-02-07BEIJING SMARTER EYE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411597586.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, the adjustment capability and adaptability of automatic gain adjustment are insufficient, making it difficult to meet the complex needs of multimedia devices.

Method used

By combining analog gain control and digital gain control, the audio signal to be processed is obtained and framed, energy information and noise information are calculated, analog gain adjustment is performed, and the initial gain adjustment results are compressed by using a multi-stage digital compressor. Obtain the target gain adjustment result.

Benefits of technology

It achieves more sufficient adjustment capabilities and better adaptability, and can adjust the gain accurately and quickly. It is suitable for various complex equipment, with more flexible control and more stable gain control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119401963A_ABST
    Figure CN119401963A_ABST
Patent Text Reader

Abstract

The invention provides an automatic gain control method and device. The automatic gain control method comprises the following steps: acquiring an input audio signal to be processed; the audio signal to be processed is input to an analog gain control module, framing processing is carried out on the audio signal to be processed based on the analog gain control module, energy information and noise information are calculated according to a framing processing result, analog gain adjustment is carried out according to the energy information and the noise information, and the audio signal to be processed is obtained. Obtaining an initial gain adjustment result; inputting the initial gain adjustment result to a digital gain control module, and calculating a detection output value of the initial gain adjustment result based on the digital gain control module, and according to the detection output value of the initial gain adjustment result, performing voltage limiting processing on the initial gain adjustment result by using a pre-designed multi-segment digital voltage limiter to obtain a target gain adjustment result. According to the invention, analog gain control and digital gain control are combined, the adjustment capability is sufficient, and the adaptability to various complex devices is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of signal processing, and in particular to a method and device for automatic gain control. Background Art

[0002] With the rapid development of information today, multimedia devices have become an indispensable tool in people's daily life. Live broadcast, on-demand, interactive and other scenes are the main support methods of multimedia. Gain control is crucial for multimedia, and the diversity of multimedia device types also puts forward higher technical requirements for gain control. This includes various types of windows devices, android devices, iphone devices, mac devices, microphone devices, camera devices, Bluetooth devices, etc., because the technical parameter indicators of these hardware devices are not uniform, and the acquisition capabilities are also very different. For example, some devices have a maximum acquisition capacity of 10dB, and some devices have a maximum acquisition capacity of 60dB; some devices only need to adjust an analog gain, and some devices will also have a BOOST (microphone enhancement) option; some devices adjust one grid by 0.2dB, and some devices adjust one grid by 10dB; some devices have very little noise when collecting, while some devices have great noise interference under the same acquisition capacity, and we need not only to do analog gain adjustment, but also digital gain adjustment to make up for the shortcomings of analog gain adjustment. All of the above situations can show that it is not easy to make an automatic gain control system with high adaptability and strong adjustment ability.

[0003] Currently, many open source software or systems have an automatic gain adjustment function, but most of them are not ideal. For example, webrtc (Web Real-Time Communications), an open source software widely used in the multimedia field, has a maximum gain capability that is insufficient to support our needs for many devices, and it does not have a function to adjust the BOOST option on devices, which makes it insufficient to adjust the gain on many devices.

[0004] In summary, the gain adjustment in the prior art has the problems of insufficient adjustment capability and insufficient adaptability. Summary of the invention

[0005] The present invention provides an automatic gain control method and device, which are used to solve the defects of insufficient adjustment ability and insufficient adaptability in the prior art, and realize automatic gain control with sufficient adjustment ability and good adaptability.

[0006] The present invention provides an automatic gain control method, comprising the following steps:

[0007] Obtaining the input audio signal to be processed;

[0008] Inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result;

[0009] The initial gain adjustment result is input into a digital gain control module, a detection output value of the initial gain adjustment result is calculated based on the digital gain control module, and the initial gain adjustment result is compressed by a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0010] According to an automatic gain control method provided by the present invention, the audio signal to be processed is input into an analog gain control module, the audio signal to be processed is framed based on the analog gain control module, energy information and noise information are calculated based on the result of the frame processing, and analog gain is adjusted according to the energy information and the noise information to obtain an initial gain adjustment result, which specifically includes:

[0011] Performing frame processing on the audio signal to be processed according to a preset frame length and frame shift to obtain a plurality of audio signal frames;

[0012] Calculating average energy and maximum energy of the audio signal frame as the energy information;

[0013] Tracking frame energy information of the audio signal frame within a preset time range in the past to obtain noise information of the audio signal frame;

[0014] The analog gain is adjusted according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result.

[0015] According to an automatic gain control method provided by the present invention, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0016] In the case that there is no microphone enhancement in the current audio signal frame, judging whether it is necessary to adjust the analog volume bar according to the average energy, the maximum energy and the noise information;

[0017] If the analog volume bar needs to be adjusted, determining the adjustment timing and adjustment amplitude of the analog volume bar according to the average energy, the maximum energy and the noise information;

[0018] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0019] According to an automatic gain control method provided by the present invention, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0020] In the case where microphone enhancement exists in the current audio signal frame, determining whether microphone enhancement needs to be adjusted according to the average energy, the maximum energy and the noise information;

[0021] If the microphone enhancement needs to be adjusted, determining the adjustment timing and adjustment range of the microphone enhancement according to the average energy, the maximum energy and the noise information;

[0022] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0023] According to an automatic gain control method provided by the present invention, calculating the average energy and the maximum energy of the audio signal frame as the energy information specifically includes:

[0024] Convert the audio signal frame from audio sampling points to decibels to obtain a conversion result;

[0025] Calculating a detection output value of the conversion result;

[0026] The average energy of the current audio signal frame and the maximum energy of the current audio signal frame are calculated according to the detection output values ​​of all the conversion results.

[0027] According to an automatic gain control method provided by the present invention, the initial gain adjustment result is compressed by using a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result, specifically comprising:

[0028] When the input of the digital compressor is not higher than the compression threshold, the original signal is kept unchanged; when the input of the digital compressor is higher than the compression threshold, the input of the digital compressor is compressed according to the compression ratio;

[0029] Traverse all digital compressors to obtain the target gain adjustment result.

[0030] The present invention also provides an automatic gain control device, comprising the following modules:

[0031] An input unit, used for obtaining an input audio signal to be processed;

[0032] An analog gain control unit, used for inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result;

[0033] A digital gain control unit is used to input the initial gain adjustment result into a digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and use a pre-designed multi-stage digital compressor to perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0034] The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned automatic gain control methods when executing the program.

[0035] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the automatic gain control method as described above is implemented.

[0036] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the automatic gain control method as described above is implemented.

[0037] The method and device for automatic gain control provided by the present invention obtain an input audio signal to be processed; input the audio signal to be processed into an analog gain control module, perform frame processing on the audio signal to be processed based on the analog gain control module, calculate energy information and noise information based on the result of the frame processing, adjust the analog gain according to the energy information and the noise information, and obtain an initial gain adjustment result; input the initial gain adjustment result into a digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result using a pre-designed multi-stage digital compressor to obtain a target gain adjustment result. The present invention combines analog gain control and digital gain control, and the two cooperate to realize the functions of automatic gain control and adjustment. Compared with other software and systems, it has sufficient adjustment capacity, can adjust the gain more accurately and quickly, has better adaptability to various complex devices, is more flexible in control, and can achieve more stable gain control. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 This is one of the flow charts of the automatic gain control method provided by the present invention.

[0040] Figure 2 This is the second flow chart of the automatic gain control method provided by the present invention.

[0041] Figure 3 It is a schematic diagram of audio signal framing in the automatic gain control method provided by the present invention;

[0042] Figure 4 This is the third flow chart of the automatic gain control method provided by the present invention.

[0043] Figure 5 The present invention provides a multi-segment digital compressor parameter design schematic diagram for the automatic gain control method.

[0044] Figure 6 It is a structural schematic diagram of the automatic gain control device provided by the present invention.

[0045] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] Combine the following Figure 1-Figure 5 Describe the method of automatic gain control of the present invention, Figure 1 is one of the flow charts of the automatic gain control method provided by the present invention, such as Figure 1 As shown, the method includes:

[0048] Step 110: Obtain an input audio signal to be processed.

[0049] In step 110, an audio signal inputted from an electronic device (eg, a multimedia device) that needs to perform automatic gain control is acquired and used as an audio signal to be processed.

[0050] Step 120: Input the audio signal to be processed into an analog gain control module, perform frame processing on the audio signal to be processed based on the analog gain control module, calculate energy information and noise information based on the result of the frame processing, adjust the analog gain according to the energy information and the noise information, and obtain an initial gain adjustment result.

[0051] The present invention processes the acquired audio signal to be processed in two parts, including performing analog gain control module processing and digital gain control module processing on the audio signal to be processed, and finally outputs the audio signal after automatic gain processing.

[0052] In step 120, the analog gain control module is processed for the audio signal to be processed. Specifically, the analog gain control module processing is divided into several steps, firstly, the audio signal is framed, then the energy information and noise information are calculated according to the result of the frame processing, and the device is notified to make specific adjustments according to the energy information and noise information through a certain timing and strategy.

[0053] Step 130: Input the initial gain adjustment result into a digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and use a pre-designed multi-stage digital compressor to perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0054] In step 130, the audio signal to be processed is processed by the digital gain control module. Specifically, the digital gain part is adjusted after the analog gain part is processed, and the digital gain adjustment is a supplement to the analog gain adjustment.

[0055] It is understandable that the volume of some devices is still too low or too loud after the analog gain is adjusted, and many devices do not have the option of analog gain adjustment. For example, various mobile phones or PADs do not have this option. At this time, the main gain adjustment work is completed by the digital gain part.

[0056] The general idea of ​​the digital gain adjustment used in the present invention is to first calculate the frame energy of the audio signal, and then perform compression processing on the audio signal by designing a multi-stage digital compressor.

[0057] The present invention realizes more accurate, fast and stable gain adjustment and has better device adaptability through the combined operation of analog gain control and digital gain control.

[0058] The following further explains step 120. In some embodiments, the audio signal to be processed is input into an analog gain control module, the audio signal to be processed is framed based on the analog gain control module, energy information and noise information are calculated based on the result of the frame processing, and the analog gain is adjusted according to the energy information and the noise information to obtain an initial gain adjustment result, specifically including:

[0059] Step 121: performing frame processing on the audio signal to be processed according to a preset frame length and frame shift to obtain a plurality of audio signal frames;

[0060] Step 122: Calculate the average energy and maximum energy of the audio signal frame as the energy information;

[0061] Step 123: Tracking frame energy information of the audio signal frame within a preset time range in the past to obtain noise information of the audio signal frame;

[0062] Step 124: Adjust the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result.

[0063] Specifically, if Figure 2 As shown, the audio signal is first framed, and then the average energy and maximum energy of the audio signal frame are calculated. The noise information is then judged by the noise module, and then the analog volume and microphone enhancement volume are processed separately by distinguishing whether there is a microphone enhancement option. After processing, the device is notified to make specific adjustments through certain timing and strategies.

[0064] More specifically, in step 121, the received audio signal data to be processed is framed according to the preset frame length and frame shift. Figure 3 As shown, the frame length is set to 20ms, and the received audio signal data to be processed is divided into 20ms as a frame data, which is convenient for data calculation. The frame shift is set to 5ms to maintain the continuity of the signal between frames.

[0065] In step 122, the average energy and the maximum energy of the audio signal frame are calculated. During the calculation process, the average energy and the maximum energy can be determined by using the detection output value of each audio signal frame.

[0066] Based on the above embodiment, step 122 is further described. In some embodiments, calculating the average energy and the maximum energy of the audio signal frame as the energy information specifically includes:

[0067] Convert the audio signal frame from audio sampling points to decibels to obtain a conversion result;

[0068] Calculating a detection output value of the conversion result;

[0069] The average energy of the current audio signal frame and the maximum energy of the current audio signal frame are calculated according to the detection output values ​​of all the conversion results.

[0070] Specifically, the input audio signal frame is first converted from the form of sampling points into The form of (decibel, decibel).

[0071] In some embodiments, the conversion is performed as follows:

[0072]

[0073] in, is the length of the audio frame, is the value of the sampling point, The value of the sampling point is converted into dB expression. is the maximum amplitude of the sampling point. For a 16-bit (bit number) audio sampling signal, The value is 32767.

[0074] Then calculate the detection output value of each frame of the audio signal. The advantage of using the detection output value is that it can quickly respond to the instantaneous maximum value in the audio signal to avoid signal overload and clipping. The calculation method of the detection output value is as follows:

[0075]

[0076] in, is the length of the audio frame, is the sampling point value of the input audio, is the output value of the sample point. For a 16-bit audio sampling signal, The value is 32767, T is the time, which can be 5 milliseconds. is the audio sampling frequency.

[0077] Then, the audio signal frame detection output value is used to calculate the average energy of the current frame and the maximum energy of the current frame. The average energy is calculated as follows:

[0078]

[0079] in, is the average energy of the current frame, is the value of the audio signal in the current audio frame in the form of a detection output value, The length of the current audio frame.

[0080] Finally, the maximum energy of the current signal frame is calculated. The maximum energy is calculated as follows:

[0081]

[0082] in, is the maximum energy of the current frame, is the value of the audio signal in the current frame in the form of detection output value, The length of the current audio frame.

[0083] In step 123, a simplified minimum tracking algorithm is designed to obtain noise information, and the noise information of the current frame is obtained by tracking the frame energy information within the past preset time range. In a specific embodiment, the preset time range is 1.5 seconds.

[0084] Specifically, the energy of the noisy audio signal is expressed as follows (here the energy is expressed as the square of the audio signal value, the same below):

[0085]

[0086] In the formula, is the frame number mark, It is a noisy frequency signal. It is a pure audio signal. is a noise signal.

[0087] because It fluctuates very quickly over time, and the energy of the current noisy frequency signal frame is obtained using a first-order recursive form:

[0088]

[0089] In the formula, is a smoothing constant, and its typical value is 0.8. is the frame number mark, It is a noisy frequency signal. is the energy of the smoothed noisy signal. The above recursive equation can be regarded as an IIR low-pass filter.

[0090] Next, find the minimum energy value in the past D frames by following the minimum value tracking method:

[0091]

[0092] In the formula, is the frame number mark, Represents the minimum energy value found.

[0093] Finally, the historical audio frame information is updated according to the window size, and the next round of operations is continued. Here, two background noise thresholds are combined and To make strategic decisions. In a specific embodiment, , .

[0094] In step 124, specific analog gain adjustments are made based on the average energy of the audio frame, the maximum energy of the audio frame, and the noise information obtained in the previous steps, including gain increase, gain decrease, gain adjustment timing, gain adjustment size, gain adjustment speed, etc. Finally, the device is notified to perform specific adjustment operations.

[0095] Further, step 124 is further explained below. In some embodiments, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0096] In the case that there is no microphone enhancement in the current audio signal frame, judging whether it is necessary to adjust the analog volume bar according to the average energy, the maximum energy and the noise information;

[0097] If the analog volume bar needs to be adjusted, determining the adjustment timing and adjustment amplitude of the analog volume bar according to the average energy, the maximum energy and the noise information;

[0098] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0099] Specifically, if Figure 4 As shown, first determine whether the current audio signal frame has microphone enhancement. If the determination result is no, that is, the current audio signal frame does not have microphone enhancement, then proceed to the next step of determining whether the analog volume bar needs to be adjusted based on the average energy, maximum energy, and noise information. Specifically, determine whether the analog volume bar needs to be adjusted based on the average energy, maximum energy, and noise information.

[0100] In some embodiments, whether the device has a microphone enhancement function is obtained according to a system API function.

[0101] If the analog volume bar needs to be adjusted upward, the adjustment timing and adjustment amplitude of the upward adjustment are further determined according to the average energy, maximum energy and noise information.

[0102] Correspondingly, if the analog volume bar needs to be adjusted downward, the adjustment timing and adjustment amplitude of the downward adjustment are further determined according to the average energy, maximum energy and noise information.

[0103] Further, step 124 is further explained below. In some embodiments, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0104] In the case where microphone enhancement exists in the current audio signal frame, determining whether microphone enhancement needs to be adjusted according to the average energy, the maximum energy and the noise information;

[0105] If the microphone enhancement needs to be adjusted, determining the adjustment timing and adjustment range of the microphone enhancement according to the average energy, the maximum energy and the noise information;

[0106] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0107] Specifically, if Figure 4 As shown, first determine whether the current audio signal frame has microphone enhancement. If the determination result is yes, that is, the current audio signal frame has microphone enhancement, then proceed to the next step of determining whether the microphone enhancement needs to be adjusted. Specifically, determine whether the microphone enhancement needs to be adjusted based on average energy, maximum energy, and noise information.

[0108] If the microphone enhancement needs to be adjusted upward, the adjustment timing and adjustment range of the upward adjustment are further determined according to the average energy, maximum energy and noise information.

[0109] Correspondingly, if the microphone enhancement needs to be adjusted downward, the adjustment timing and adjustment range of the downward adjustment are further determined according to the average energy, the maximum energy and the noise information.

[0110] The following further describes the compression processing in step 130. In some embodiments, the initial gain adjustment result is compressed using a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result, specifically including:

[0111] When the input of the digital compressor is not higher than the compression threshold, the original signal is kept unchanged; when the input of the digital compressor is higher than the compression threshold, the input of the digital compressor is compressed according to the compression ratio;

[0112] Traverse all digital compressors to obtain the target gain adjustment result.

[0113] Specifically, it should be explained first that the calculation method of the detection output value of each frame of the input audio signal (initial gain adjustment result) of the digital gain control module in step 130 is the same as the calculation method of the detection output value of the audio signal frame in the aforementioned embodiment, and the present invention will not be repeated here.

[0114] After that, the audio signal is compressed using a pre-designed multi-band digital compressor. It is understandable that the digital compressor can reduce the dynamic range of the signal above the compression threshold and keep the signal below the compression threshold unchanged. Using a digital compressor to process the audio signal can prevent the audio signal from being over-distorted, thereby protecting the audio signal.

[0115] The compressor has several important parameters, including compression threshold, compression ratio, attack time and release time. The compressor compares the input signal with the compression threshold. When the input signal is lower than the threshold, the original signal remains unchanged; when the input signal is higher than the threshold, the compressor compresses the signal according to the compression ratio. Traverse the entire multi-stage digital compressor, compress gradually, and get the final target gain adjustment result.

[0116] In addition, a design method of a multi-band digital compressor is given. Figure 5 Specifically, Figure 5 The horizontal axis represents the input signal , the vertical axis represents the output signal , the units of both input and output signals are The horizontal and vertical coordinates of the two inflection points in the figure are designed values. The horizontal coordinate of the inflection point represents the compression threshold. The thresholds of the two inflection points from bottom to top are , , the vertical intercept represents the target level of the output , the maximum value of the output signal cannot exceed the target level value.

[0117] With the known coordinate points, we can easily calculate the slope and intercept of the three broken lines in the figure. The slope and intercept of the three broken lines from left to right are defined as , , and , , Therefore, the following formula can be used to calculate the input signal The output signal is calculated from the value of Values:

[0118]

[0119] In this way, a multi-band digital compressor can be designed.

[0120] The method of automatic gain control provided by the present invention is to obtain an input audio signal to be processed; input the audio signal to be processed into an analog gain control module, perform frame processing on the audio signal to be processed based on the analog gain control module, calculate energy information and noise information based on the result of the frame processing, adjust the analog gain according to the energy information and the noise information, and obtain an initial gain adjustment result; input the initial gain adjustment result into a digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result using a pre-designed multi-stage digital compressor to obtain a target gain adjustment result. The present invention combines analog gain control and digital gain control, and the two cooperate to realize the functions of automatic gain control and adjustment. Compared with other software and systems, it has sufficient adjustment capacity, can adjust the gain more accurately and quickly, has better adaptability to various complex devices, is more flexible in control, and can achieve more stable gain control.

[0121] The automatic gain control device provided by the present invention is described below. The automatic gain control device described below and the automatic gain control method described above can be referred to each other. Figure 6 Schematic diagram of the structure of the automatic gain control device provided by the present invention, such as Figure 6 As shown, the device includes the following modules:

[0122] An input unit 610, used for acquiring an input audio signal to be processed;

[0123] The analog gain control unit 620 is used to input the audio signal to be processed into the analog gain control module, perform frame processing on the audio signal to be processed based on the analog gain control module, calculate energy information and noise information based on the result of the frame processing, adjust the analog gain according to the energy information and the noise information, and obtain an initial gain adjustment result;

[0124] The digital gain control unit 630 is used to input the initial gain adjustment result into the digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and use a pre-designed multi-stage digital compressor to limit the initial gain adjustment result according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0125] According to an automatic gain control device provided by the present invention, the audio signal to be processed is input into an analog gain control module, the audio signal to be processed is framed based on the analog gain control module, energy information and noise information are calculated based on the result of the frame processing, and analog gain is adjusted according to the energy information and the noise information to obtain an initial gain adjustment result, which specifically includes:

[0126] Performing frame processing on the audio signal to be processed according to a preset frame length and frame shift to obtain a plurality of audio signal frames;

[0127] Calculating average energy and maximum energy of the audio signal frame as the energy information;

[0128] Tracking frame energy information of the audio signal frame within a preset time range in the past to obtain noise information of the audio signal frame;

[0129] The analog gain is adjusted according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result.

[0130] According to an automatic gain control device provided by the present invention, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0131] In the case that there is no microphone enhancement in the current audio signal frame, judging whether it is necessary to adjust the analog volume bar according to the average energy, the maximum energy and the noise information;

[0132] If the analog volume bar needs to be adjusted, determining the adjustment timing and adjustment amplitude of the analog volume bar according to the average energy, the maximum energy and the noise information;

[0133] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0134] According to an automatic gain control device provided by the present invention, adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes:

[0135] In the case where microphone enhancement exists in the current audio signal frame, determining whether microphone enhancement needs to be adjusted according to the average energy, the maximum energy and the noise information;

[0136] If the microphone enhancement needs to be adjusted, determining the adjustment timing and adjustment range of the microphone enhancement according to the average energy, the maximum energy and the noise information;

[0137] The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

[0138] According to an automatic gain control device provided by the present invention, calculating the average energy and the maximum energy of the audio signal frame as the energy information specifically includes:

[0139] Convert the audio signal frame from audio sampling points to decibels to obtain a conversion result;

[0140] Calculating a detection output value of the conversion result;

[0141] The average energy of the current audio signal frame and the maximum energy of the current audio signal frame are calculated according to the detection output values ​​of all the conversion results.

[0142] According to an automatic gain control device provided by the present invention, the initial gain adjustment result is compressed by a pre-designed multi-segment digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result, specifically comprising:

[0143] When the input of the digital compressor is not higher than the compression threshold, the original signal is kept unchanged; when the input of the digital compressor is higher than the compression threshold, the input of the digital compressor is compressed according to the compression ratio;

[0144] Traverse all digital compressors to obtain the target gain adjustment result.

[0145] The automatic gain control device provided by the present invention obtains an input audio signal to be processed; inputs the audio signal to be processed into an analog gain control module, performs frame processing on the audio signal to be processed based on the analog gain control module, calculates energy information and noise information based on the result of the frame processing, adjusts the analog gain according to the energy information and the noise information, and obtains an initial gain adjustment result; inputs the initial gain adjustment result into a digital gain control module, calculates the detection output value of the initial gain adjustment result based on the digital gain control module, and performs compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result using a pre-designed multi-stage digital compressor to obtain a target gain adjustment result. The present invention combines analog gain control and digital gain control, and the two cooperate to realize the functions of automatic gain control and adjustment. Compared with other software and systems, it has sufficient adjustment capacity, can adjust the gain more accurately and quickly, has better adaptability to various complex devices, is more flexible in control, and can achieve more stable gain control.

[0146] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the method of automatic gain control, which includes: obtaining an input audio signal to be processed; inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result; inputting the initial gain adjustment result into a digital gain control module, calculating the detection output value of the initial gain adjustment result based on the digital gain control module, and performing compression processing on the initial gain adjustment result using a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0147] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0148] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the automatic gain control method provided by the above-mentioned methods, which includes: obtaining an input audio signal to be processed; inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result; inputting the initial gain adjustment result into a digital gain control module, calculating the detection output value of the initial gain adjustment result based on the digital gain control module, and performing compression processing on the initial gain adjustment result using a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0149] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the automatic gain control method provided by the above-mentioned methods, the method comprising: obtaining an input audio signal to be processed; inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result; inputting the initial gain adjustment result into a digital gain control module, calculating the detection output value of the initial gain adjustment result based on the digital gain control module, and performing compression processing on the initial gain adjustment result using a pre-designed multi-stage digital compressor according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

[0150] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0151] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for automatic gain control, characterized in that: include: Obtain the input audio signal to be processed; Inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result; The initial gain adjustment result is input into a digital gain control module, a detection output value of the initial gain adjustment result is calculated based on the digital gain control module, and a pre-designed multi-stage digital compressor is used to perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

2. The automatic gain control method according to claim 1, characterized in that: Inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result, specifically includes: Performing frame processing on the audio signal to be processed according to a preset frame length and frame shift to obtain a plurality of audio signal frames; Calculating average energy and maximum energy of the audio signal frame as the energy information; Tracking frame energy information of the audio signal frame within a preset time range in the past to obtain noise information of the audio signal frame; The analog gain is adjusted according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result.

3. The automatic gain control method according to claim 2, characterized in that: Adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes: In the case where there is no microphone enhancement in the current audio signal frame, determining whether it is necessary to adjust the analog volume bar according to the average energy, the maximum energy and the noise information; If the analog volume bar needs to be adjusted, determining the adjustment timing and adjustment amplitude of the analog volume bar according to the average energy, the maximum energy and the noise information; The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

4. The automatic gain control method according to claim 2, characterized in that: Adjusting the analog gain according to the average energy, the maximum energy and the noise information to obtain an initial gain adjustment result specifically includes: In the case where microphone enhancement exists in the current audio signal frame, determining whether microphone enhancement needs to be adjusted according to the average energy, the maximum energy and the noise information; If the microphone enhancement needs to be adjusted, determining the adjustment timing and adjustment range of the microphone enhancement according to the average energy, the maximum energy and the noise information; The relevant equipment is notified to make adjustments according to the adjustment timing and the adjustment range, so as to obtain an initial gain adjustment result.

5. The automatic gain control method according to claim 2, characterized in that: Calculating the average energy and the maximum energy of the audio signal frame as the energy information specifically includes: Convert the audio signal frame from audio sampling points to decibels to obtain a conversion result; Calculating a detection output value of the conversion result; The average energy of the current audio signal frame and the maximum energy of the current audio signal frame are calculated according to the detection output values ​​of all the conversion results.

6. The automatic gain control method according to claim 1, characterized in that: According to the detection output value of the initial gain adjustment result, the initial gain adjustment result is compressed by using a pre-designed multi-stage digital compressor to obtain a target gain adjustment result, specifically including: When the input of the digital compressor is not higher than the compression threshold, the original signal is kept unchanged; when the input of the digital compressor is higher than the compression threshold, the input of the digital compressor is compressed according to the compression ratio; Traverse all digital compressors to obtain the target gain adjustment result.

7. An automatic gain control device, characterized in that: include: An input unit, used for obtaining an input audio signal to be processed; An analog gain control unit, used for inputting the audio signal to be processed into an analog gain control module, performing frame processing on the audio signal to be processed based on the analog gain control module, calculating energy information and noise information based on the result of the frame processing, adjusting the analog gain according to the energy information and the noise information, and obtaining an initial gain adjustment result; A digital gain control unit is used to input the initial gain adjustment result into a digital gain control module, calculate the detection output value of the initial gain adjustment result based on the digital gain control module, and use a pre-designed multi-stage digital compressor to perform compression processing on the initial gain adjustment result according to the detection output value of the initial gain adjustment result to obtain a target gain adjustment result.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the automatic gain control method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the automatic gain control method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the automatic gain control method according to any one of claims 1 to 6 is implemented.