A gradient loudspeaker cabinet and a loudspeaker control method thereof
By combining the correlation between signal amplitude and loudness value and envelope smoothness, a weighted summation method is used to adjust the audio signal output by the speaker, which solves the problem of inaccurate loudness control in the existing technology and improves the audio signal quality and listening experience of the speaker.
Patent Information
- Application Number
- CN202510308518.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-03-17
AI Technical Summary
Existing speaker control methods cannot fully reflect the human ear's perception of sound, resulting in poor loudness control effects. In addition, traditional AGC algorithms rely on a single parameter, resulting in inaccurate loudness control.
The audio signal is obtained through the MEMS sensor, and the correlation of the gain coefficient and the envelope smoothness are calculated by combining the signal amplitude and loudness value. The audio signal output by the speaker is adjusted in real time using a weighted summation method.
The loudspeaker's loudness control effect on the audio signal is improved, the harshness and discomfort are reduced, and the audience's auditory experience is improved.
Smart Images

Figure CN120166333B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of loudspeaker control, and in particular to a gradual-change loudspeaker box and a loudspeaker control method thereof. Background Art
[0002] In loudspeaker control systems, large fluctuations in the loudness of audio signals can cause discomfort or harshness to listeners. Therefore, loudspeakers require precise loudness control of the output audio signal. Existing methods typically achieve this by adjusting the audio signal's level, essentially controlling the volume by varying the amplitude of the audio signal. However, human auditory perception depends not only on the level but also on the frequency of the sound. Therefore, simply adjusting the level to control loudness fails to fully reflect the human ear's perception of sound.
[0003] Secondly, existing automatic gain control (AGC) algorithms usually dynamically adjust the gain based on the peak value of the signal amplitude. Peak-based AGC algorithms can, to a certain extent, avoid situations where the audio signal amplitude is too large or too small, but they rely more on a single parameter and do not take into account the overall loudness characteristics of the audio signal, resulting in poor loudness control effects. Summary of the Invention
[0004] In order to solve the above technical problems, a gradual change loudspeaker box and a loudspeaker control method thereof are provided to solve the existing problems.
[0005] The solution to the technical problem of this application is to provide a gradual-change loudspeaker box and a loudspeaker control method thereof, comprising the following steps:
[0006] In a first aspect, an embodiment of the present application provides a gradual change loudspeaker control method, the method comprising the following steps:
[0007] Acquire an audio signal input to a speaker through a MEMS sensor, and determine a loudness value at each moment in the audio signal based on a signal amplitude at each moment in the audio signal;
[0008] Based on the signal amplitude and loudness value at each moment in the audio signal, combined with the automatic gain control algorithm, the gain coefficients corresponding to the signal amplitude and loudness value at each moment in the audio signal are obtained respectively;
[0009] Calculating a first correlation and a second correlation of the audio signal based on the abnormal distribution and abnormal degree of relative changes between the gain coefficient corresponding to the signal amplitude in the audio signal and the signal amplitude and loudness value;
[0010] Analyzing the deviation of the signal amplitude and loudness value at each moment in the audio signal, and the difference between the first correlation degree and the second correlation degree, to determine a correlation index between the loudness and amplitude of the audio signal;
[0011] Determining the envelope smoothness of the audio signal based on a change trend of an envelope corresponding to the loudness values of the audio signal at all moments;
[0012] Calculating a weight factor based on the first correlation, the second correlation, the correlation index, and the envelope smoothness;
[0013] The weight factor is used as the weight, and the gain coefficients corresponding to the signal amplitude and loudness value at each moment in the audio signal are weighted and summed to obtain the corrected gain coefficient at each moment in the audio signal. Combined with the automatic gain control algorithm, the audio signal output by the speaker is adjusted in real time.
[0014] Preferably, the calculating the first correlation of the audio signal includes:
[0015] The average of the differences between the gain coefficients corresponding to the signal amplitudes at each moment in the audio signal and all adjacent moments is recorded as the relative gain difference;
[0016] The average of the differences between the signal amplitudes at each moment in the audio signal and all its adjacent moments is recorded as the relative amplitude difference;
[0017] Recording the ratio of the relative gain difference to the relative amplitude difference as a first difference ratio;
[0018] Performing anomaly detection on the first difference ratio at all moments in the audio signal to obtain an anomaly score corresponding to the first difference ratio at each moment in the audio signal;
[0019] Calculating the dispersion degree of the abnormality scores corresponding to the first difference ratios at all moments in the audio signal, recorded as a first dispersion degree;
[0020] Analyze the deviation of the abnormality score corresponding to the first difference ratio at each moment in the audio signal to calculate a first relative deviation;
[0021] The first correlation is negatively correlated with the first dispersion and the first relative deviation respectively.
[0022] Preferably, the calculating the first relative deviation includes:
[0023] Recording the moment when the anomaly score corresponding to the first difference ratio in the audio signal is greater than 1 as the abnormal amplitude moment;
[0024] Calculate the mean of the anomaly scores corresponding to the first difference ratios at all moments in the audio signal, and record it as a first anomaly mean;
[0025] The first relative deviation is the sum of differences between the anomaly scores corresponding to the first difference ratios at all abnormal amplitude moments in the audio signal and the first anomaly mean.
[0026] Preferably, the calculation process of the second correlation is:
[0027] The average of the differences between the loudness values of each moment in the audio signal and all its adjacent moments is recorded as the relative loudness difference;
[0028] Recording the ratio of the relative gain difference to the relative loudness difference as a second difference ratio;
[0029] Performing anomaly detection on the second difference ratio at all moments in the audio signal, and obtaining an anomaly score corresponding to the second difference ratio at each moment in the audio signal;
[0030] Calculating the dispersion degree of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, recorded as a second dispersion degree;
[0031] Analyze the deviation of the abnormality score corresponding to the second difference ratio at each moment in the audio signal to calculate a second relative deviation;
[0032] The second correlation is negatively correlated with the second dispersion and the second relative deviation respectively.
[0033] Preferably, the calculating the second relative deviation includes:
[0034] Calculate the mean of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, and record it as a second anomaly mean;
[0035] Recording the moment when the abnormality score corresponding to the second difference ratio in the audio signal is greater than 1 as the abnormal loudness moment;
[0036] The second relative deviation is the sum of differences between the anomaly scores corresponding to the second difference ratios of all abnormal loudness moments in the audio signal and the second anomaly mean.
[0037] Preferably, the calculation formula for the correlation index Pv between the loudness and amplitude of the audio signal is: Wherein, R1 is the first correlation, R2 is the second correlation, and f i is the signal amplitude of the audio signal at the i-th moment, uf is the mean value of the signal amplitude of the audio signal at all moments, x iis the loudness value at the i-th moment in the audio signal, ux is the mean loudness value of all moments in the audio signal, N is the number of all moments in the audio signal, and exp() is an exponential function with a natural constant as the base.
[0038] Preferably, determining the envelope smoothness of the audio signal includes:
[0039] Extracting the upper envelope curve and the lower envelope curve of the loudness value at all times in the audio signal;
[0040] Calculating the average of the mean absolute deviation of the loudness values at all times on the upper envelope curve and the mean absolute deviation of the loudness values at all times on the lower envelope curve, and recording the result as envelope fluctuation;
[0041] The envelope smoothness is negatively correlated with the envelope fluctuation.
[0042] Preferably, the weight factor is a normalized result of the product of the first correlation, the second correlation, the correlation index and the envelope smoothness.
[0043] Preferably, the corrected gain coefficient Yz in the audio signal at time t is t The calculation formula is: t =k×Yz f,t +(1-k)×Yz x,t , among which, Yz f,t Yz is the gain coefficient corresponding to the signal amplitude at time t in the audio signal, x,t is the gain coefficient corresponding to the loudness value at the tth moment in the audio signal, and k is the weight factor.
[0044] In a second aspect, an embodiment of the present application further provides a gradual-change speaker box, wherein the control of the speaker of the speaker box is implemented by using any one of the gradual-change speaker control methods described above.
[0045] This application has at least the following beneficial effects:
[0046] The present application uses a peak-based AGC algorithm to obtain the gain coefficients corresponding to the signal amplitude and loudness value at each moment. A first correlation is calculated by analyzing the abnormalities in the relative changes between the gain coefficients corresponding to the signal amplitude at all moments in the audio signal and the signal amplitude. This has the beneficial effect of considering the consistency of the changing trends between the gain coefficients corresponding to the signal amplitude and the signal amplitude, illustrating the correlation between the changes between the two, and thus reflecting the degree to which the corresponding gain coefficients can respond promptly to sudden changes in the signal amplitude of the audio signal, thereby indicating the reliability of the gain coefficients corresponding to the signal amplitude. Secondly, a second correlation is calculated by analyzing the abnormalities in the relative changes between the gain coefficients corresponding to the signal amplitude and the loudness value at all moments in the audio signal. This has the beneficial effect of considering the consistency of the changing trends between the gain coefficients corresponding to the signal amplitude and the loudness value, illustrating the correlation between the changes between the two, and thus reflecting the response of the gain coefficients corresponding to the signal amplitude to changes in the audio signal. By determining the correlation index between the loudness and amplitude of the audio signal, this has the beneficial effect of considering the correlation between the loudness and signal amplitude of the audio signal. The method further determines the envelope smoothness of the audio signal, which advantageously takes into account the changing trends of the upper and lower envelopes of the loudness value to reflect the smoothness of the loudness change and the impact of the loudness change on the adjustment of the gain coefficient corresponding to the signal amplitude. A weighting factor is calculated based on the first correlation, the second correlation, the correlation index, and the envelope smoothness. Using the weighting factor as a weight, a weighted sum is performed on the gain coefficients corresponding to the signal amplitude and loudness value at each moment in the audio signal to obtain a corrected gain coefficient at each moment in the audio signal. In conjunction with an AGC algorithm, the audio signal output by the speaker is adjusted in real time. The method advantageously adjusts the gain parameter in real time based on the characteristics of the signal amplitude and loudness value, thereby overcoming the limitation of the traditional AGC algorithm that relies on a single parameter for adjustment, improving the quality of the audio signal output by the speaker, achieving better loudness control, enhancing the listener's auditory experience of the audio output from the speaker, and reducing the harshness or discomfort caused by the audio signal. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The following is a further detailed description of a gradual loudspeaker control method of the present application in conjunction with the accompanying drawings.
[0048] Figure 1 A flowchart of a method for controlling a gradually changing loudspeaker according to an embodiment of the present application;
[0049] Figure 2 This is a flowchart of the steps of the method for obtaining the first correlation of the audio signal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the following further describes in detail a gradually changing loudspeaker box and its loudspeaker control method proposed in this application in conjunction with the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0051] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0052] See also Figure 1 , which shows a flowchart of a gradual loudspeaker control method provided by an embodiment of the present application, the method comprising the following steps:
[0053] Step 1: Acquire an audio signal input to a speaker through a MEMS sensor, and determine a loudness value at each moment in the audio signal based on the signal amplitude at each moment in the audio signal.
[0054] An analog audio signal is captured by an external audio device containing a MEMS sensor, and the analog audio signal is transmitted to the speaker through an audio cable. Then, the analog-to-digital converter built into the speaker converts the analog audio signal into a digital audio signal, thereby obtaining the audio signal input to the speaker.
[0055] In this embodiment, the duration of the analog audio signal is 5 minutes. As other implementation methods, the implementer can set it by himself.
[0056] It should be noted that the analog-to-digital converter is a well-known technology and will not be described in detail here.
[0057] Furthermore, the strength of a sound can be reflected by loudness, but loudness is a subjective perception quantity, usually expressed in decibels (dB). Therefore, based on the audio signal, the loudness of the audio signal is determined as follows:
[0058] Measuring the loudness value of the audio signal at each moment based on the signal amplitude of the audio signal at each moment;
[0059] In this embodiment, an equivalent sound level Leq measurement method is used to obtain the loudness value. The equivalent sound level Leq measurement method is a well-known technology and will not be described in detail here.
[0060] At this point, the audio signal and the loudness value at each moment in the audio signal are obtained.
[0061] Step 2: Based on the signal amplitude and loudness value at each moment in the audio signal, in combination with an automatic gain control algorithm, obtain gain coefficients corresponding to the signal amplitude and loudness value at each moment in the audio signal; and calculate a first correlation of the audio signal based on the abnormal distribution and degree of relative changes between the gain coefficients corresponding to the signal amplitude in the audio signal and the signal amplitude.
[0062] Furthermore, the Automatic Gain Control (AGC) algorithm is a control method that automatically adjusts the gain of an amplifier circuit as signal strength changes. In the AGC algorithm, the gain factor determines the speed and amplitude of the gain adjustment. By selecting the appropriate gain factor, the audio signal is amplified or reduced. Currently, peak-based AGC algorithms require real-time monitoring of the peak value of the audio signal, comparing the detected peak value with a preset target peak value, and calculating the gain factor. If the signal peak value exceeds the target peak value, the gain is reduced; if the signal peak value is lower than the target peak value, the gain is increased. The obtained gain factor is then applied to the audio signal to adjust the signal amplitude.
[0063] Secondly, the signal amplitude reflects the physical strength of the audio signal and can quickly respond to changes in the signal's intensity. The loudness value reflects the perceived loudness of the audio signal by the human ear. By combining the signal amplitude and the loudness value, the gain coefficient of the automatic gain control method is corrected, taking into account both the amplitude change and the perceived loudness of the audio signal, preventing distortion caused by excessive signal amplitude and avoiding excessive amplification or compression of the audio signal, thereby more comprehensively adjusting the quality of the audio signal output by the speaker.
[0064] Based on the above analysis, the corrected gain coefficient of the automatic gain control algorithm is determined by combining the signal amplitude and loudness value, specifically:
[0065] Calculating a gain coefficient corresponding to the signal amplitude at each moment in the audio signal based on the signal amplitude at each moment in the audio signal;
[0066] Calculating a gain coefficient corresponding to the loudness value at each moment in the audio signal based on the loudness value at each moment in the audio signal;
[0067] In this embodiment, a peak-based AGC algorithm is used to obtain a gain coefficient corresponding to the signal amplitude at each moment in the audio signal and a gain coefficient corresponding to the loudness value at each moment in the audio signal. The peak-based AGC algorithm is a well-known technology and will not be described in detail here.
[0068] The calculation formula for the corrected gain coefficient of the automatic gain control algorithm is:
[0069] Yz t =k×Yz f,t+(1-k)×Yz x,t
[0070] Among them, Yz t is the corrected gain coefficient of the audio signal at time t, Yz f,t Yz is the gain coefficient corresponding to the signal amplitude at time t in the audio signal, x,t is the gain coefficient corresponding to the loudness value at the tth moment in the audio signal, and k is the weight factor.
[0071] Furthermore, when modifying the gain coefficient, it is necessary to select appropriate weighting factors to find the best balance between quickly responding to signal changes and optimizing the auditory experience, that is, to achieve a balance between the signal amplitude and loudness value to ensure that it can quickly respond to dynamic changes in the audio signal while optimizing the auditory effect.
[0072] Based on the above analysis, the first correlation is calculated by the correlation between the gain coefficient corresponding to the signal amplitude in the audio signal and the signal amplitude. The flowchart of the step of the method for obtaining the first correlation of the audio signal provided in the embodiment of the present application is as follows: Figure 2 As shown, specifically:
[0073] The average of the differences between the gain coefficients corresponding to the signal amplitudes at each moment in the audio signal and its left and right adjacent moments is recorded as the relative gain difference;
[0074] In this embodiment, the average of the absolute values of the differences between the gain coefficients corresponding to the signal amplitudes at each moment in the audio signal and the signal amplitudes at its left and right adjacent moments is recorded as the relative gain difference.
[0075] The average of the differences between the signal amplitudes at each moment in the audio signal and its adjacent moments on the left and right is recorded as the relative amplitude difference;
[0076] In this embodiment, the average of the absolute values of the differences between the signal amplitudes at each moment and its left and right adjacent moments in the audio signal is recorded as the relative amplitude difference.
[0077] Recording the ratio of the relative gain difference to the relative amplitude difference at each moment in the audio signal as a first difference ratio at each moment in the audio signal;
[0078] Using an anomaly detection algorithm, perform anomaly detection on the first difference ratio at all moments in the audio signal, and obtain an anomaly score corresponding to the first difference ratio at each moment in the audio signal;
[0079] In this embodiment, a local outlier factor (LOF) algorithm is used for anomaly detection. The LOF algorithm is a well-known technology and will not be described in detail here.
[0080] Calculating the dispersion degree of the abnormality scores corresponding to the first difference ratios at all moments in the audio signal, recorded as a first dispersion degree;
[0081] In this embodiment, the degree of dispersion is measured by calculating the variance of the abnormality scores corresponding to the first difference ratios at all moments in the audio signal. As other implementation methods, the implementer may adopt other methods of the prior art, such as standard deviation, coefficient of variation, etc., and this embodiment does not impose any special restrictions on this.
[0082] It should be noted that if the abnormality score corresponding to the first difference ratio is greater than 1, it means that the first difference ratio at the corresponding moment is abnormal data; otherwise, it is normal data. Therefore, the larger the first discreteness, the more drastic the change in the first difference ratio, that is, the weaker the correlation between the change in the gain coefficient and the change in the signal amplitude.
[0083] Recording the moment when the anomaly score corresponding to the first difference ratio in the audio signal is greater than 1 as the abnormal amplitude moment;
[0084] Calculate the mean of the anomaly scores corresponding to the first difference ratios at all moments in the audio signal, and record it as a first anomaly mean;
[0085] Recording the sum of the differences between the anomaly scores corresponding to the first difference ratios at all abnormal amplitude moments in the audio signal and the first anomaly mean as a first relative deviation;
[0086] In this embodiment, the sum of the absolute values of the differences between the anomaly scores corresponding to the first differences at all abnormal amplitude moments in the audio signal and the first abnormal mean is recorded as the first relative deviation.
[0087] The first correlation of the audio signal is negatively correlated with the first dispersion and the first relative deviation respectively.
[0088] It should be noted that a negative correlation means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases.
[0089] In this embodiment, the calculation formula of the first correlation of the audio signal is: R1=exp(-σ1×P1), where R1 is the first correlation of the audio signal, σ1 is the first discreteness, P1 is the first relative deviation, and exp is an exponential function with a natural constant as the base.
[0090] It should be noted that the larger the first relative deviation, the greater the fluctuation of the gain coefficient change and the signal amplitude change, and the higher the degree of abnormality of the change between the gain coefficient and the signal amplitude; the smaller the obtained first correlation, the more inconsistent the change trend between the gain coefficient and the signal amplitude, and the weaker the correlation between the changes between the two. Conversely, the larger the obtained first correlation, the stronger the correlation between the gain coefficient and the signal amplitude, which means that when the audio signal undergoes a sudden change, the corresponding gain coefficient can also be changed in time. At this time, the gain coefficient corresponding to the signal amplitude is more reliable, and the weight factor should be larger.
[0091] At this point, the first correlation of the audio signal is obtained.
[0092] Step 3: Calculate a second correlation of the audio signal based on the abnormality of the relative change between the gain coefficient and the loudness value corresponding to the signal amplitude in the audio signal, and the deviation degree of the abnormal change.
[0093] Furthermore, by analyzing the correlation between the gain coefficient and the loudness value corresponding to the signal amplitude in the audio signal, a second correlation is calculated, specifically:
[0094] The average of the differences between the loudness values at each moment in the audio signal and its adjacent moments is recorded as the relative loudness difference;
[0095] In this embodiment, the average of the absolute values of the differences between the loudness values at each moment and its left and right adjacent moments in the audio signal is recorded as the relative loudness difference.
[0096] Recording the ratio of the relative gain difference to the relative loudness difference at each moment in the audio signal as a second difference ratio at each moment in the audio signal;
[0097] Using an anomaly detection algorithm, perform anomaly detection on the second difference ratio at all moments in the audio signal, and obtain an anomaly score corresponding to the second difference ratio at each moment in the audio signal;
[0098] In this embodiment, a local outlier factor (LOF) algorithm is used for anomaly detection. The LOF algorithm is a well-known technology and will not be described in detail here.
[0099] Calculating the dispersion degree of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, recorded as a second dispersion degree;
[0100] In this embodiment, the degree of dispersion is measured by calculating the variance of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal. As other implementation methods, the implementer may adopt other methods of the prior art, such as standard deviation, coefficient of variation, etc., and this embodiment does not impose any special restrictions on this.
[0101] It should be noted that if the anomaly score corresponding to the second difference ratio is greater than 1, it means that the second difference ratio at the corresponding moment is abnormal data; otherwise, it is normal data. Therefore, the larger the second dispersion, the more drastic the change in the second difference ratio, that is, the weaker the correlation between the change in the gain coefficient and the change in the loudness value.
[0102] Calculate the mean of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, and record it as a second anomaly mean;
[0103] Recording the moment when the anomaly score corresponding to the second difference ratio in the audio signal is greater than 1 as the abnormal loudness moment; and recording the sum of the differences between the anomaly scores corresponding to the second difference ratios of all abnormal loudness moments in the audio signal and the second anomaly mean as the second relative deviation;
[0104] In this embodiment, the sum of the absolute values of the differences between the anomaly scores corresponding to the second difference ratios of all abnormal loudness moments in the audio signal and the second anomaly mean is recorded as the second relative deviation.
[0105] The second correlation of the audio signal is negatively correlated with the second dispersion and the second relative deviation respectively.
[0106] It should be noted that a negative correlation means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases.
[0107] In this embodiment, the calculation formula for the second correlation of the audio signal is: R2=exp(-σ2×P2), where R2 is the second correlation of the audio signal, σ2 is the second discreteness, P2 is the second relative deviation, and exp() is an exponential function with a natural constant as the base.
[0108] It should be noted that, the larger the second relative deviation, the greater the fluctuation between the change in the gain coefficient corresponding to the signal amplitude and the change in the loudness value, and the higher the degree of abnormality in the change between the gain coefficient corresponding to the signal amplitude and the loudness value; the smaller the obtained second correlation, the more inconsistent the change trend between the gain coefficient corresponding to the signal amplitude and the loudness value, and the weaker the correlation between their changes; conversely, the larger the obtained second correlation, the stronger the correlation between the change in the gain coefficient corresponding to the signal amplitude and the loudness value, indicating that the gain coefficient corresponding to the signal amplitude can better reflect the change in the signal, and the larger the weight factor should be.
[0109] At this point, the second correlation of the audio signal is obtained.
[0110] Step 4: Analyze the deviation of the signal amplitude and loudness value at each moment in the audio signal, as well as the difference between the first correlation and the second correlation, to determine a correlation index between the loudness and amplitude of the audio signal; and determine the envelope smoothness of the audio signal based on a change trend of an envelope corresponding to the loudness values at all moments in the audio signal.
[0111] Furthermore, the loudness value and the signal amplitude are not linearly correlated. During the process of the speaker outputting the audio signal, the signal is random and unpredictable. Therefore, based on the first correlation and the second correlation, the changing relationship between the signal amplitude and the loudness value is analyzed, and a correlation index between the loudness and the amplitude is calculated, specifically:
[0112] The calculation formula for the correlation index between the loudness and amplitude of an audio signal is:
[0113]
[0114] Where Pv is the correlation index between the loudness and amplitude of the audio signal, R1 is the first correlation of the audio signal, R2 is the second correlation of the audio signal, and f i is the signal amplitude of the audio signal at the i-th moment, uf is the mean value of the signal amplitude of the audio signal at all moments, x i is the loudness value at the i-th moment in the audio signal, ux is the mean loudness value of all moments in the audio signal, N is the number of all moments in the audio signal, and exp() is an exponential function with a natural constant as the base.
[0115] It should be noted that the larger |R1-R2| is, the more inconsistent the gain coefficient corresponding to the signal amplitude is between the signal amplitude and the loudness value. The larger the value, the greater the difference between the deviation of the signal amplitude and the deviation of the loudness value at the same moment, and the less correlation there is between the changes in the signal amplitude and the loudness value. The smaller the correlation index between the loudness and the amplitude, the weaker the correlation between the signal amplitude and the loudness value in the audio signal. Conversely, the larger the correlation index between the loudness and the amplitude, the stronger the correlation between the signal amplitude and the loudness value in the audio signal. This indicates that by correcting the gain coefficient using the gain coefficient corresponding to the signal amplitude or loudness value, the quality of the audio signal can be adjusted. Existing methods are more likely to obtain the gain coefficient based on the signal amplitude. Therefore, the larger the correlation index between the loudness and the amplitude, the more biased it is towards the gain coefficient corresponding to the signal amplitude, that is, the larger the weight factor k should be.
[0116] Furthermore, based on the loudness values at all times in the audio signal, the smoothness of the upper and lower envelopes corresponding to the loudness values at all times is analyzed to evaluate the smoothness of the signal loudness, specifically:
[0117] Extracting the upper envelope curve and the lower envelope curve of the loudness value at all times in the audio signal;
[0118] It should be noted that the extraction of the upper envelope curve and the lower envelope curve is a well-known technology and will not be described in detail here.
[0119] Calculating the average of the mean absolute deviation of the loudness values at all times on the upper envelope curve and the mean absolute deviation of the loudness values at all times on the lower envelope curve, and recording the result as envelope fluctuation;
[0120] It should be noted that the calculation of the mean absolute deviation is a well-known technique and will not be described in detail here.
[0121] The envelope smoothness of the audio signal is negatively correlated with the envelope fluctuation;
[0122] In this embodiment, the calculation formula of the envelope smoothness of the audio signal is: Ph x =exp(-B), where Ph x is the envelope smoothness of the audio signal, B is the envelope fluctuation, and exp() is an exponential function with a natural constant as the base.
[0123] It should be noted that the greater the envelope fluctuation, the less smooth the change in the loudness value of the audio signal, and the smaller the resulting envelope smoothness. Conversely, the greater the envelope smoothness, the more gradual the change in the loudness value, and the change in the loudness value has less impact on the adjustment of the gain coefficient corresponding to the signal amplitude. Therefore, the weight factor k should be increased to make it rely more on the gain coefficient corresponding to the signal amplitude, thereby correcting the gain coefficient of the automatic gain control algorithm.
[0124] At this point, the correlation index between the loudness and amplitude of the audio signal and the envelope smoothness of the audio signal are obtained.
[0125] Step 5: Calculate a weight factor based on the first correlation, the second correlation, the correlation index, and the envelope smoothness; use the weight factor as a weight to perform a weighted summation of the gain coefficients corresponding to the signal amplitude and loudness value at each moment in the audio signal to obtain a corrected gain coefficient at each moment in the audio signal; and adjust the audio signal output by the speaker in real time in combination with an automatic gain control algorithm.
[0126] Furthermore, based on the correlation index and the envelope smoothness, a weight factor k is determined, specifically:
[0127] taking a normalized result of a product of the first correlation degree, the second correlation degree, the correlation index, and the envelope smoothness as the weight factor;
[0128] In this embodiment, the sigmoid function is used for normalization. As other implementations, the implementer may adopt other methods in the prior art, such as the tanh function, etc. This embodiment does not impose any special restrictions on this.
[0129] It should be noted that the greater the first and second correlations, the stronger the correlations between the gain coefficient corresponding to the signal amplitude and the signal amplitude and loudness value, respectively. Therefore, the weighting factor should be increased. The greater the correlation index, the stronger the correlation between the signal amplitude and the loudness value in the audio signal. By modifying a gain coefficient corresponding to the signal amplitude or loudness value, the quality of the audio signal can be adjusted. Therefore, if the gain coefficient corresponding to the signal amplitude is to be favored, the larger the weighting factor k should be selected. The greater the envelope smoothness, the smoother the change in loudness value, and the smaller the impact of the change in loudness value on the adjustment of the gain coefficient corresponding to the signal amplitude. Therefore, the weighting factor should be increased to make it more dependent on the gain coefficient corresponding to the signal amplitude.
[0130] Based on the weight factors, a corrected gain coefficient at each moment in the audio signal is obtained, and the corrected gain coefficient is used to adjust and control the audio signal in real time using an AGC algorithm, thereby improving the quality of the audio signal output by the speaker. The AGC algorithm is a well-known prior art.
[0131] Based on the same inventive concept as the above method, an embodiment of the present application further provides a gradual-change loudspeaker box, in which the control of the loudspeaker of the box is implemented by using any one of the above-mentioned gradual-change loudspeaker control methods.
[0132] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0133] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0134] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the present application. It should be noted that a person skilled in the art can make various modifications and improvements without departing from the spirit of the present application. Therefore, any simple modifications, equivalent variations, and modifications to the above embodiments made in accordance with the technical essence of the present application without departing from the content of the present application's technical solution fall within the scope of protection of the present application's technical solution.
Claims
1. A gradual change loudspeaker control method, characterized in that: The method comprises the following steps: Acquire an audio signal input to a speaker through a MEMS sensor, and determine a loudness value at each moment in the audio signal based on a signal amplitude at each moment in the audio signal; Based on the signal amplitude and loudness value at each moment in the audio signal, combined with the automatic gain control algorithm, the gain coefficient corresponding to the signal amplitude and the gain coefficient corresponding to the loudness value at each moment in the audio signal are obtained respectively; Calculating a first correlation and a second correlation of the audio signal based on the abnormal distribution and abnormal degree of relative changes between the gain coefficient corresponding to the signal amplitude in the audio signal and the signal amplitude and loudness value; Analyzing the deviation of the signal amplitude and loudness value at each moment in the audio signal, and the difference between the first correlation degree and the second correlation degree, to determine a correlation index between the loudness and amplitude of the audio signal; Determining the envelope smoothness of the audio signal based on a change trend of an envelope corresponding to the loudness values of the audio signal at all moments; Calculating a weight factor based on the first correlation, the second correlation, the correlation index, and the envelope smoothness; Using the weight factor as the weight, a weighted sum is performed on the gain coefficient corresponding to the signal amplitude and the gain coefficient corresponding to the loudness value at each moment in the audio signal to obtain the corrected gain coefficient at each moment in the audio signal, and the audio signal output by the speaker is adjusted in real time in combination with an automatic gain control algorithm; The correlation index between the loudness and amplitude of an audio signal The calculation formula is: ,in, is the first correlation, is the second correlation, The first The signal amplitude at time , is the mean value of the signal amplitude at all times in the audio signal, The first The loudness value at the moment, is the mean loudness value of the audio signal at all times, is the number of all moments in the audio signal, is an exponential function with a natural constant as its base; The weight factor is a normalized result of the product of the first correlation, the second correlation, the correlation index, and the envelope smoothness; The corrected gain coefficient of the audio signal at time t The calculation formula is: ,in, is the gain coefficient corresponding to the signal amplitude at time t in the audio signal, is the gain coefficient corresponding to the loudness value at the tth moment in the audio signal, is the weight factor.
2. A gradual change loudspeaker control method as claimed in claim 1, characterized in that: The calculating the first correlation of the audio signal includes: The average of the differences between the gain coefficients corresponding to the signal amplitudes at each moment in the audio signal and all adjacent moments is recorded as the relative gain difference; The average of the differences between the signal amplitudes at each moment in the audio signal and all its adjacent moments is recorded as the relative amplitude difference; Recording the ratio of the relative gain difference to the relative amplitude difference as a first difference ratio; Performing anomaly detection on the first difference ratio at all moments in the audio signal to obtain an anomaly score corresponding to the first difference ratio at each moment in the audio signal; Calculating the dispersion degree of the abnormality scores corresponding to the first difference ratios at all moments in the audio signal, recorded as a first dispersion degree; Analyze the deviation of the abnormality score corresponding to the first difference ratio at each moment in the audio signal to calculate a first relative deviation; The first correlation is negatively correlated with the first dispersion and the first relative deviation respectively.
3. A gradual change loudspeaker control method as claimed in claim 2, characterized in that: The calculating of the first relative deviation comprises: Recording the moment when the anomaly score corresponding to the first difference ratio in the audio signal is greater than 1 as the abnormal amplitude moment; Calculate the mean of the anomaly scores corresponding to the first difference ratios at all moments in the audio signal, and record it as a first anomaly mean; The first relative deviation is the sum of differences between the anomaly scores corresponding to the first difference ratios at all abnormal amplitude moments in the audio signal and the first anomaly mean.
4. The method for controlling a gradual loudspeaker according to claim 2, wherein: The calculation process of the second correlation is: The average of the differences between the loudness values of each moment in the audio signal and all its adjacent moments is recorded as the relative loudness difference; Recording the ratio of the relative gain difference to the relative loudness difference as a second difference ratio; Performing anomaly detection on the second difference ratio at all moments in the audio signal, and obtaining an anomaly score corresponding to the second difference ratio at each moment in the audio signal; Calculating the dispersion degree of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, recorded as a second dispersion degree; Analyze the deviation of the abnormality score corresponding to the second difference ratio at each moment in the audio signal to calculate a second relative deviation; The second correlation is negatively correlated with the second dispersion and the second relative deviation respectively.
5. A gradual change loudspeaker control method as claimed in claim 4, characterized in that: The calculating of the second relative deviation comprises: Calculate the mean of the anomaly scores corresponding to the second difference ratios at all moments in the audio signal, and record it as a second anomaly mean; Recording the moment when the abnormality score corresponding to the second difference ratio in the audio signal is greater than 1 as the abnormal loudness moment; The second relative deviation is the sum of differences between the anomaly scores corresponding to the second difference ratios of all abnormal loudness moments in the audio signal and the second anomaly mean.
6. The method for controlling a gradual loudspeaker according to claim 1, wherein: Determining the envelope smoothness of the audio signal includes: Extracting the upper envelope curve and the lower envelope curve of the loudness value at all times in the audio signal; Calculating the average of the mean absolute deviation of the loudness values at all times on the upper envelope curve and the mean absolute deviation of the loudness values at all times on the lower envelope curve, and recording the result as envelope fluctuation; The envelope smoothness is negatively correlated with the envelope fluctuation.
7. A gradual change loudspeaker box, characterized in that: The control of the speaker of the sound box is achieved by using a gradual speaker control method as described in any one of claims 1-6.
Citation Information
Patent Citations
Loudness-oriented high-efficient audio control method
CN108711435A
Automatic gain control method and control device for sound signal, and storage medium
CN110349595A