A method, a mixer, a storage medium and an electronic device for automatic mixing

By configuring activation and release times in the mixer to process sample values ​​in the audio stream in real time, the problems of high memory consumption and noise interference are solved, achieving efficient signal gain control and clear audio output.

CN115862663BActive Publication Date: 2026-03-27NINGBO SOUNDKING ELECTRONICS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing technologies for automatic gain compensation suffer from high memory consumption and noise interference, especially in the process of identifying and adjusting signal levels, where it is difficult to control the activation and release times, leading to noise interference.

Method used

By pre-configuring activation and release times in the mixer, sample values ​​in the audio stream are acquired in real time. Based on the comparison between the input and stored values, the output value after gain is calculated and output. Activation or release is performed during the recursive process to eliminate noise interference.

Benefits of technology

It effectively reduces memory consumption, minimizes noise interference, achieves rapid response to signal levels, and ensures clear audio signal output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115862663B_ABST
    Figure CN115862663B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of mixing sound, in particular to a kind of automatic mixing method, mixer, storage medium and electronic equipment, comprising the following steps: step S1, obtain the i-th sample value;Step S2, obtain input value;Step S3, compare input value and storage value, judge the size of input value and storage value;Step S4, obtain the first output value, and replace storage value with the first output value;Step S5, obtain the second output value, and replace storage value with the second output value;Step S6, the first output value or the second output value is output to external sound box to make external sound box output sound, control acquisition module to collect the i+1-th sample value of next moment;Square is carried out directly to single sample value and is output, reduce the loss to memory, repeatedly call output value in the process of running, make it as storage value in the calculation of next sample value, recursive process is realized, and noise interference is eliminated by controlling the activation and release of sample value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of audio mixing technology, and more specifically, to an automatic audio mixing method, a mixer, a storage medium, and an electronic device. Background Technology

[0002] Systems that implement automatic gain compensation (also known as automatic gain control) receive variable signal levels as input and provide adjusted signal levels as output; typically, automatic gain compensation has the effect of reducing strong signals and amplifying weak signals.

[0003] Chinese patent CN111541981B discloses an audio processing method, apparatus, storage medium, and terminal. It obtains digital audio signals by performing A / D conversion on the audio signal using a sound card, then repeatedly acquires a preset amount of digital signal each time, followed by calculation and analysis. This calculation and analysis typically involves squaring each preset amount of digital signal, calculating the average of the squared signals, and finally taking the root of the average to obtain the effective value for output. However, averaging the squared digital signals increases memory consumption due to the large amount of preset data. Furthermore, in signal level recognition, a faster response to rising signal levels is needed to avoid missing important parts of the signal, while a slower response to falling signal levels is acceptable because these parts are masked by the psychological model of hearing. Therefore, activation and release times need to be added during the gain process of the digital signal to eliminate noise interference from "clicks" and "pops." However, this method does not set these two time parameters, making it difficult to control the activation and release times of the output effective value, which easily leads to noise interference. Summary of the Invention

[0004] To address the above problems, this invention provides an automatic mixing method that reduces memory power consumption and eliminates noise interference.

[0005] An automatic mixing method, wherein the mixer is pre-configured with stored values ​​and time data, the time data including activation and release times, includes the following steps:

[0006] Step 1: Control the mixer to acquire the i-th sample value in the audio stream in real time;

[0007] Step 2: Squaring the i-th sample value to obtain the corresponding input value;

[0008] Step 3: Compare the input value and the stored value. If the input value is greater than the stored value, proceed to step 4; if the input value is less than or equal to the stored value, proceed to step 5.

[0009] Step 4: Calculate the first time coefficient based on the activation time, and calculate the first output value based on the input value, the first time coefficient, and the stored value. Replace the stored value with the first output value and proceed to step 6.

[0010] Step 5: Calculate the second time coefficient based on the release time, calculate the second output value based on the input value, the second time coefficient, and the stored value, and replace the stored value with the second output value, then proceed to step 6;

[0011] Step 6: Output the first output value or the second output value to an external speaker to make the external speaker output sound. At the same time, control the mixer to obtain the (i+1)th sample value in the audio stream at the next moment, replace the i-th sample value with the (i+1)th sample value, and return to step 1.

[0012] Preferably, before step 1, the total number of sample values ​​within a predetermined time range is obtained, and the specific process of step 4 includes the following steps:

[0013] Step 41: Calculate the first time coefficient based on the total quantity and the activation time;

[0014] Step 42: Calculate the first output value based on the input value, the first time coefficient, and the stored value;

[0015] Step 43: Replace the stored value with the first output value and proceed to step 6.

[0016] Preferably, step 5 includes the following steps:

[0017] Step 51: Calculate the second time coefficient based on the total quantity and the release time;

[0018] Step 52: Calculate the second output value based on the input value, the second time coefficient, and the stored value;

[0019] Step 53: Replace the stored value with the second output value and proceed to step 6.

[0020] Preferably, the activation time is longer than the release time.

[0021] Preferably, step 6 includes the following steps:

[0022] Step 61: Take the square root of the first output value to obtain the first RMS value, or take the square root of the second output value to obtain the second RMS value;

[0023] Step 62: Output the first RMS value or the second RMS value to the external speaker to make the external speaker output sound. At the same time, control the mixer to obtain the (i+1)th sample value in the audio stream at the next moment, replace the i-th sample value with the (i+1)th sample value, and return to step 1.

[0024] A mixer includes a storage module, an acquisition module, a preprocessing module, a judgment module, a first processing module, a second processing module, and an output module;

[0025] The storage module is electrically connected to the first processing module, the second processing module, and the judgment module, respectively, and is used to store a pre-configured storage value, activation time, and release time, and to transmit the activation time and the storage value to the first processing module, the release time and the storage value to the second processing module, and the storage value to the judgment module.

[0026] The acquisition module is electrically connected to the external microphone and the preprocessing module. The acquisition module is used to control the mixer to acquire the i-th sample value in the audio stream transmitted by the external microphone in real time and transmit the i-th sample value to the preprocessing module.

[0027] The preprocessing module is electrically connected to the judgment module and is used to square the i-th sample value to obtain the corresponding input value, and transmit the input value to the judgment module;

[0028] The judgment module is electrically connected to both the first processing module and the second processing module, and is used to compare the input value and the stored value. If the input value is greater than the stored value, the input value is transmitted to the first processing module; if the input value is less than or equal to the stored value, the input value is transmitted to the second processing module.

[0029] The first processing module is electrically connected to the output module and is used to calculate the first time coefficient based on the activation time, and to calculate the first output value based on the input value, the first time coefficient and the stored value, and to transmit the first output value to the storage module and the output module respectively.

[0030] The first processing module is electrically connected to the output module and is used to calculate the second time coefficient based on the release time, and to calculate the second output value based on the input value, the second time coefficient and the stored value, and to transmit the second output value to the storage module and the output module respectively.

[0031] The output module is electrically connected to the external speaker and the acquisition module respectively, and is used to output the first output value or the second output value to the external speaker so that the external speaker outputs sound, while controlling the acquisition module to acquire the (i+1)th sample value.

[0032] Preferably, in the storage module, the activation time and the release time are preset, and the activation time is greater than the storage time.

[0033] A storage medium storing a computer program that, when executed by a processor, implements the steps of the method described above.

[0034] An electronic device, comprising:

[0035] A memory on which computer programs are stored;

[0036] A processor for executing the computer program in the memory to implement the method described above.

[0037] This application reduces memory consumption by directly squaring a single sample value to obtain a first or second output value after gain, and then applying gain to the first or second output value. This is different from the method of squaring each preset digital signal, calculating the average value, and finally applying gain processing to the average value. Furthermore, the obtained first or second output value replaces the stored value, and the system then controls the acquisition of the next sample value. This stored value is called during gain calculation, meaning the system repeatedly calls itself during operation, implementing a recursive process. Preset activation and release times are incorporated into this recursive process, and the sample value is activated or released by comparing the input value with the stored value, thus eliminating noise interference. Attached Figure Description

[0038] Figure 1 This is a flowchart of the method of the present invention;

[0039] Figure 2 This is a detailed flowchart of step S4 of the method of the present invention;

[0040] Figure 3 This is a detailed flowchart of step S5 of the method of the present invention;

[0041] Figure 4 This is a detailed flowchart of step S6 of the method of the present invention;

[0042] Figure 5 This is a schematic diagram of the mixer of the present invention. Detailed Implementation

[0043] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0044] Combination Figure 1 As shown, an automatic mixing method, in which the mixer is pre-configured with stored values ​​and time data, including activation and release times, includes the following steps:

[0045] Step 1: Control the mixer to acquire the i-th sample value in the audio stream in real time;

[0046] Step 2: Squaring the i-th sample value to obtain the corresponding input value;

[0047] Step 3: Compare the input value and the stored value. If the input value is greater than the stored value, proceed to step 4; if the input value is less than or equal to the stored value, proceed to step 5.

[0048] Step 4: Calculate the first time coefficient based on the activation time, and calculate the first output value based on the input value, the first time coefficient, and the stored value. Replace the stored value with the first output value and proceed to step 6.

[0049] Step 5: Calculate the second time coefficient based on the release time, calculate the second output value based on the input value, the second time coefficient, and the stored value, and replace the stored value with the second output value, then proceed to step 6.

[0050] Step 6: Output the first output value or the second output value to the external speaker to make the external speaker output sound. At the same time, control the mixer to obtain the (i+1)th sample value in the audio stream at the next moment, replace the i-th sample value with the (i+1)th sample value, and return to step 1.

[0051] Combination Figure 2 As shown, before step 1, the total number of sample values ​​within a predetermined time range is obtained. The specific process of step 4 includes the following steps:

[0052] Step 41: Calculate the first time coefficient based on the total quantity and activation time;

[0053] Step 42: Calculate the first output value based on the input value, the first time coefficient, and the stored value;

[0054] Step 43: Replace the stored value with the first output value and proceed to step 6.

[0055] Specifically, by substituting the total quantity and activation time into the following formula, the first time coefficient is calculated:

[0056]

[0057] Among them, t d The first time coefficient;

[0058] t a Activation time;

[0059] f s This represents the total quantity.

[0060] Combined with appendix Figure 3 As shown, step 5 includes the following steps:

[0061] Step 51: Calculate the second time coefficient based on the total quantity and release time;

[0062] Step 52: Calculate the second output value based on the input value, the second time coefficient, and the stored value;

[0063] Step 53: Replace the stored value with the second output value and proceed to step 6.

[0064] Specifically, by substituting the total quantity and release time into the following formula, the second time coefficient is calculated:

[0065]

[0066] Among them, t e This is the second time coefficient;

[0067] t b For release time;

[0068] f s This represents the total quantity.

[0069] In a preferred embodiment of the present invention, the activation time is greater than the release time.

[0070] Specifically, the sample values ​​are squared:

[0071] X 2 ;

[0072] X≥0;

[0073] Where X is the sample value.

[0074] Specifically, the first output value is calculated by substituting the input value, the first time coefficient, and the stored value into the following formula;

[0075] OUT d =X 2 ×t d +Z×(1-t d );

[0076] Among them, OUT d This is the first output value;

[0077] X represents the sample value;

[0078] X 2 Input value;

[0079] t d The first time coefficient;

[0080] Z is the stored value.

[0081] Substitute the input value, the second time coefficient, and the stored value into the following formula to calculate the second output value; OUT e =X 2 ×t e +Z×(1-t e );

[0082] Among them, OUT e This is the second output value;

[0083] X represents the sample value;

[0084] X 2 For input values;

[0085] t e This is the second time coefficient;

[0086] Z is the stored value.

[0087] Specifically, the activation time can be set to 0.01s and the release time to 0.1s.

[0088] Because t is calculated by the above formula d and t e The gain is quite small, which results in almost the last stored value plus a new sample value, with the amount of gain depending on whether it's the activation or release time. In the activation time case, the amount of gain in the new input value is 10 times that in the release time case, causing the release time to reach a new equilibrium value much faster. This output value can be described as the average energy of the input signal over a specific time, where the average time corresponds to the activation and release time time constants.

[0089] By applying activation and release times to the method of this application, the output can respond differently to rising signal levels (e.g., a person begins to speak) and falling signal levels (e.g., a person stops speaking). Generally, the response to rising signal levels (activation time) needs to be faster to avoid missing important parts of the signal (such as the first syllable), while the response to falling signal levels can be slower because this part will be masked by the psychoacoustic model of hearing anyway. The activation time is set to 0.01s and the release time is set to 0.1s, which is 10 times different, which is sufficient to store whether the signal level needs to be amplified (i.e., the response is sped up) or canceled (i.e., the response is slowed down).

[0090] Combination Figure 4 As shown, in a preferred embodiment of the present invention, step 6 includes the following steps:

[0091] Step 61: Take the square root of the first output value to obtain the first RMS value, or take the square root of the second output value to obtain the second RMS value;

[0092] Step 62: Output the first RMS value or the second RMS value to the external speaker so that the external speaker outputs sound. At the same time, control the mixer to obtain the (i+1)th sample value in the audio stream at the next moment, replace the i-th sample value with the (i+1)th sample value, and return to step 1.

[0093] Specifically, the first RMS value is obtained by taking the square root of the first output value:

[0094]

[0095] in, The first RMS value;

[0096] OUT d This is the first output value.

[0097] Specifically, the first RMS value is obtained by taking the square root of the first output value:

[0098]

[0099] in, The first RMS value;

[0100] OUT e This is the first output value.

[0101] Specifically, the activation time is set to 0.01s (i.e., 10ms), the release time is set to 0.1s (i.e., 100ms), and the initial value of the stored value is set to 0; the collected sample values ​​are sequentially collected as 1, 1.2, 1.5... n, with a quantity of 48000;

[0102] The first time coefficient obtained is 0.0046, and the second time coefficient is 0.00046;

[0103] 1. The first sample value is 1. The input value is 1 after squaring the sample value.

[0104] Since the input value is greater than the stored value, the calculated first output value is 0.0046, and the first output value replaces the stored value. The first RMS value is 0.068, and the output is sent to the external speaker.

[0105] 2. Replace the stored value with the most recent first output value, which is 0.0046;

[0106] The second sample value is 1.2. After squaring the sample value, the input value is 1.44.

[0107] Since the input value is greater than the stored value, the calculated first output value is 0.0112, and the first output value replaces the stored value. The first RMS value is 0.11, and the output is sent to the external speaker.

[0108] 3. Replace the stored value with the most recent first output value, which is 0.0112;

[0109] The second sample value is 1.5. Squaring the sample value gives the input value of 2.25.

[0110] Since the input value is greater than the stored value, the calculated first output value is 0.0214, and the first output value replaces the stored value. The first RMS value is 0.15, and the output is sent to the external speaker.

[0111] Since subsequent sample values ​​are also calculated and output in the same way described above, the calculation of subsequent sample values ​​will not be elaborated on here.

[0112] Combination Figure 5 As shown, a mixer includes a storage module, a acquisition module, a preprocessing module, a judgment module, a first processing module, a second processing module, and an output module;

[0113] The storage module is electrically connected to the first processing module, the second processing module, and the judgment module respectively. It is used to store the pre-configured storage value, activation time, and release time, and to transmit the activation time and storage value to the first processing module, the release time and storage value to the second processing module, and the storage value to the judgment module.

[0114] The acquisition module is electrically connected to the external microphone and the preprocessing module. The acquisition module is used to control the mixer to acquire the i-th sample value in the audio stream transmitted by the external microphone in real time and transmit the i-th sample value to the preprocessing module.

[0115] The preprocessing module is electrically connected to the judgment module and is used to square the i-th sample value to obtain the corresponding input value, and then transmit the input value to the judgment module.

[0116] The judgment module is electrically connected to the first processing module and the second processing module respectively, and is used to compare the input value and the stored value. If the input value is greater than the stored value, the input value is transmitted to the first processing module; if the input value is less than or equal to the stored value, the input value is transmitted to the second processing module.

[0117] The first processing module is electrically connected to the output module and is used to calculate the first time coefficient based on the activation time, and to calculate the first output value based on the input value, the first time coefficient and the stored value, and to transmit the first output value to the storage module and the output module respectively.

[0118] The first processing module is electrically connected to the output module and is used to calculate the second time coefficient based on the release time, and to calculate the second output value based on the input value, the second time coefficient and the stored value, and to transmit the second output value to the storage module and the output module respectively.

[0119] The output module is electrically connected to the external speaker and the acquisition module respectively. It is used to output the first output value or the second output value to the external speaker so that the external speaker outputs sound, and at the same time control the acquisition module to acquire the (i+1)th sample value.

[0120] In a preferred embodiment of the present invention, an activation time and a release time are preset in the storage module, and the activation time is longer than the storage time.

[0121] A storage medium storing a computer program that, when executed by a processor, implements the steps of the method described above.

[0122] An electronic device, comprising:

[0123] A memory on which computer programs are stored;

[0124] A processor is used to execute computer programs stored in memory to achieve the above method.

[0125] This application reduces memory consumption by directly squaring a single sample value to obtain a first or second output value after gain, and then applying gain to the first or second output value. This is different from the method of squaring each preset digital signal, calculating the average value, and finally applying gain processing to the average value. Furthermore, the obtained first or second output value replaces the stored value, and the system then controls the acquisition of the next sample value. This stored value is called during gain calculation, meaning the system repeatedly calls itself during operation, implementing a recursive process. Preset activation and release times are incorporated into this recursive process, and the sample value is activated or released by comparing the input value with the stored value, thus eliminating noise interference.

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method of automatic mixing, characterized by, The mixer is pre-configured with a storage value and time data, the time data includes an activation time and a release time, and the total number of sample values in a predetermined time range is pre-acquired, including the following steps: Step 1, control the mixer to acquire the i-th sample value in the audio stream in real time; Step 2, square the i-th sample value to obtain the corresponding input value; Step 3, compare the input value with the storage value, if the input value is greater than the storage value, go to step 4; if the input value is less than or equal to the storage value, go to step 5; Step 4, calculate a first time coefficient according to the total number and the activation time, calculate a first output value according to the input value, the first time coefficient and the storage value, and replace the storage value with the first output value, and go to step 6; Step 5, calculate a second time coefficient according to the total number and the release time, calculate a second output value according to the input value, the second time coefficient and the storage value, and replace the storage value with the second output value, and go to step 6; Step 6, output the first output value or the second output value to the external sound box to make the external sound box output sound, and control the mixer to acquire the i+1-th sample value in the audio stream at the next time, replace the i-th sample value with the i+1-th sample value, and return to step 1.

2. The method of automatic mixing of claim 1, wherein, The specific process of step 4 includes the following steps: Step 41, calculate the first time coefficient according to the total number and the activation time; Step 42, calculate a first output value according to the input value, the first time coefficient and the storage value; Step 43, replace the storage value with the first output value, and go to step 6.

3. The method of automatically mixing audio of claim 2, wherein, The specific process of step 5 includes the following steps: Step 51, calculate the second time coefficient according to the total number and the release time; Step 52, calculate a second output value according to the input value, the second time coefficient and the storage value; Step 53, replace the storage value with the second output value, and go to step 6.

4. The method of automatic mixing of claim 1, wherein, The activation time is greater than the release time.

5. The method of automatic mixing of claim 1, wherein, The specific process of step 6 includes the following steps: Step 61, square the first output value to obtain a first RMS value, or square the second output value to obtain a second RMS value; Step 62, output the first RMS value or the second RMS value to the external sound box to make the external sound box output sound, and control the mixer to acquire the i+1-th sample value in the audio stream at the next time, replace the i-th sample value with the i+1-th sample value, and return to step 1.

6. A sound mixer characterized by comprising: It includes a storage module, an acquisition module, a preprocessing module, a judgment module, a first processing module, a second processing module and an output module; The storage module is electrically connected with the first processing module, the second processing module and the judging module, and is configured to store a pre-configured storage value, an activation time and a release time, and transmit the activation time and the storage value to the first processing module, transmit the release time and the storage value to the second processing module, and transmit the storage value to the judging module. The collection module is electrically connected with an external microphone and the preprocessing module, and is configured to control a mixer to acquire an i-th sample value in an audio stream transmitted by the external microphone in real time, and transmit the i-th sample value to the preprocessing module. The preprocessing module is electrically connected with the judging module, and is configured to square the i-th sample value to obtain a corresponding input value, and transmit the input value to the judging module. The judging module is electrically connected with the first processing module and the second processing module, and is configured to compare the input value with the storage value, transmit the input value to the first processing module if the input value is greater than the storage value, and transmit the input value to the second processing module if the input value is less than or equal to the storage value. The first processing module is electrically connected with the output module, and is configured to calculate a first time coefficient according to the activation time, calculate a first output value according to the input value, the first time coefficient and the storage value, and transmit the first output value to the storage module and the output module. The first processing module is electrically connected with the output module, and is configured to calculate a second time coefficient according to the release time, calculate a second output value according to the input value, the second time coefficient and the storage value, and transmit the second output value to the storage module and the output module. The output module is electrically connected with an external speaker and the collection module, and is configured to output the first output value or the second output value to the external speaker to make the external speaker output sound, and control the collection module to acquire an i+1-th sample value.

7. The sound mixer of claim 6, wherein, In the storage module, the activation time and the release time are pre-configured, and the activation time is greater than the release time.

8. A storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the steps of the method in any one of claims 1-5.

9. An electronic device, comprising: The program is executed by the processor to implement the steps of the method in any one of claims 1-5. The program is executed by the processor to implement the steps of the method in any one of claims 1-5. The program is executed by the processor to implement the steps of the method in any one of claims 1-5.

Citation Information

Patent Citations

  • Audio processing methods, devices, storage media and terminals

    CN111541981B

  • Sound mixing processing method and system

    CN104469032A

  • Audio classifier

    CN106409312A