Volume adjustment method, device, electronic device and storage medium

By using microphones and speakers in electronic devices, collecting ambient audio data and calculating noise energy values, and automatically adjusting the volume level of the speakers, the inconvenient volume adjustment problem in the prior art is solved and the user's listening experience is improved.

CN115361461BActive Publication Date: 2025-03-14GEER TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210998322.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-19
Publication Date
2025-03-14
Estimated Expiration
2042-08-19

AI Technical Summary

Technical Problem

When playing audio, it is difficult for existing electronic devices to automatically adjust the volume, resulting in too loud sound in a quiet environment or too low sound in a noisy environment, affecting the user's listening effect.

Method used

By setting the microphone and speaker in the electronic device, collecting ambient audio data using the microphone, calculating the ambient noise energy value in combination with the microphone's compensation factor, and determining the target volume level of the speaker based on this value, and performing volume adjustment.

Benefits of technology

It realizes automatic adjustment of the volume of electronic devices, dynamically adjusts the volume according to environmental noise, and improves the user's listening effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115361461B_ABST
    Figure CN115361461B_ABST
Patent Text Reader

Abstract

The present application discloses a volume adjustment method, device, electronic device and storage medium, and the technical field to which it belongs is the technical field of audio playback control. The volume adjustment method comprises: if an automatic volume adjustment instruction is received, the microphone is used to collect environmental audio data; the compensation factor of the microphone is read, and the environmental noise energy value is calculated according to the compensation factor of the microphone and the environmental audio data; the target volume level of the speaker is determined according to the environmental noise energy value, and the volume adjustment operation is performed according to the target volume level. The present application can automatically adjust the volume of the electronic device to improve the user's listening effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of audio playback control, and in particular to a volume adjustment method, device, electronic device and storage medium. Background Art

[0002] With the development of technology, electronic devices with audio playback functions such as Bluetooth headsets, smart speakers, and smart phones are increasingly used. When electronic devices play audio, the user's listening effect is affected by the ambient noise, resulting in the electronic devices playing louder sounds in quieter environments and quieter sounds in noisier environments.

[0003] Therefore, how to automatically adjust the volume of an electronic device to improve the user's listening experience is a technical problem that those skilled in the art currently need to solve. Summary of the invention

[0004] The purpose of the present application is to provide a volume adjustment method, device, electronic device and storage medium, which can automatically adjust the volume of an electronic device to improve the user's listening experience.

[0005] In order to solve the above technical problems, the present application provides a volume adjustment method, which is applied to an electronic device provided with a microphone and a speaker, and the volume adjustment method comprises:

[0006] If an automatic volume adjustment instruction is received, the microphone is used to collect ambient audio data;

[0007] Reading a compensation factor of the microphone, and calculating an ambient noise energy value according to the compensation factor of the microphone and the ambient audio data;

[0008] A target volume level of the speaker is determined according to the environmental noise energy value, and a volume adjustment operation is performed according to the target volume level.

[0009] Optionally, the ADC chip of the electronic device includes a plurality of microphone channels, and each of the microphone channels is connected to one of the microphones;

[0010] Accordingly, calculating the ambient noise energy value according to the compensation factor of the microphone and the ambient audio data includes:

[0011] The energy correction value corresponding to the microphone is calculated using the first formula; wherein the first formula is g i =ce i ×F i , g i represents the energy correction value corresponding to the i-th microphone, ce i represents the energy value of the ambient audio data collected by the i-th microphone, Fi represents the compensation factor of the i-th microphone;

[0012] An average value of the energy correction values ​​corresponding to all the microphones is set as the environmental noise energy value.

[0013] Optionally, before reading the compensation factor of the microphone, the method further includes:

[0014] Playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value;

[0015] The compensation factor F of the microphone is calculated using the second formula i ; Wherein, the second formula is F i =sqrt(E / e i ), sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e i represents the test collection energy value of the i-th microphone;

[0016] The inference threshold of the microphone is calculated using the third formula; wherein the third formula is FF i =round(F i ×α), FF i represents the inference threshold of the i-th microphone, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip;

[0017] Determining whether the inference thresholds of the microphones are all within a preset range;

[0018] If so, the compensation factor of the microphone is written into the memory of the electronic device.

[0019] Optionally, determining a target volume level of the speaker according to the ambient noise energy value includes:

[0020] Determine the current volume adjustment mode;

[0021] If the volume adjustment mode is the tracking adjustment mode, an energy level difference is calculated according to the energy value of the ambient noise and the energy value of the current audio data played by the speaker, and a target volume level of the speaker is determined according to the energy level difference; wherein the energy level difference is used to describe the degree of energy difference between the ambient noise and the audio played by the speaker;

[0022] If the volume adjustment mode is an adaptive adjustment mode, the target volume level of the speaker is determined according to the ambient noise energy value.

[0023] Optionally, calculating the energy level difference according to the energy value of the ambient noise and the energy value of the current audio data played by the speaker includes:

[0024] Calculate the energy level difference EDIFF according to the fourth formula;

[0025] Wherein, the fourth formula is EDIFF=EA-se×F' j , EA represents the environmental noise energy value, F' j represents the compensation factor of the jth speaker, and se represents the energy value of the speaker playing the current audio data.

[0026] Optionally, before calculating the energy level difference EDIFF according to the fourth formula, the method further includes:

[0027] Playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value;

[0028] The compensation factor of the speaker is calculated using the fifth formula; wherein the fifth formula is F' j =sqrt(E / e' j ), F' j represents the compensation factor of the j-th speaker, sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e' j represents the test playback energy value of the jth speaker;

[0029] The inference threshold of the speaker is calculated using the sixth formula; wherein the sixth formula is FF' j =round(F' j ×α), FF' j represents the inference threshold of the j-th speaker, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip;

[0030] Determining whether the inference thresholds of the speakers are all within a preset range;

[0031] If so, the compensation factor of the speaker is written into the memory of the electronic device.

[0032] Optionally, performing a volume adjustment operation according to the target volume level includes:

[0033] Calculate the total sound energy value according to the ambient noise energy value and the target volume level;

[0034] Determining whether the total energy value of the sound is greater than a preset energy value;

[0035] If yes, lower the target volume level, and perform the volume adjustment operation according to the lowered target volume level;

[0036] If not, the volume adjustment operation is performed according to the target volume level.

[0037] The present application also provides a volume adjustment device, which is applied to an electronic device provided with a microphone and a speaker, and the volume adjustment device comprises:

[0038] An ambient sound collection module, for collecting ambient audio data using the microphone if an automatic volume adjustment instruction is received;

[0039] A noise energy calculation module, used for reading the compensation factor of the microphone, and calculating the environmental noise energy value according to the compensation factor of the microphone and the environmental audio data;

[0040] The adjustment module is used to determine the target volume level of the speaker according to the environmental noise energy value, and perform a volume adjustment operation according to the target volume level.

[0041] The present application also provides a storage medium on which a computer program is stored. When the computer program is executed, the steps of the volume adjustment method are implemented.

[0042] The present application also provides an electronic device, including a microphone, a speaker, a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned volume adjustment method when calling the computer program in the memory.

[0043] The present application provides a volume adjustment method, which is applied to an electronic device provided with a microphone and a speaker. The volume adjustment method comprises: if an automatic volume adjustment instruction is received, using the microphone to collect environmental audio data; reading a compensation factor of the microphone, and calculating an environmental noise energy value according to the compensation factor of the microphone and the environmental audio data; determining a target volume level of the speaker according to the environmental noise energy value, and performing a volume adjustment operation according to the target volume level.

[0044] When receiving an automatic volume adjustment instruction, the present application uses a microphone to collect ambient audio data, and calculates the ambient noise energy value in combination with the microphone's compensation factor and the ambient audio data. The present application determines the target volume level of the speaker based on the ambient noise energy value, so as to adjust the volume of the current audio played by the speaker according to the target volume level. The above scheme calculates the ambient noise energy value based on the data collected by the microphone, and then adjusts the volume level of the speaker according to the ambient noise energy value, so that the volume of the audio played by the electronic device changes dynamically with the ambient noise. Therefore, the present application can automatically adjust the volume of the electronic device and improve the user's listening experience. The present application also provides a volume adjustment device, a storage medium and an electronic device, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0046] Figure 1 A flow chart of a volume adjustment method provided in an embodiment of the present application;

[0047] Figure 2 A flow chart of a method for calculating compensation factors of a microphone and a speaker provided in an embodiment of the present application;

[0048] Figure 3 A flow chart of a volume adjustment method of a smart speaker provided in an embodiment of the present application;

[0049] Figure 4 A schematic diagram of the structure of a volume adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0051] See below Figure 1 , Figure 1 A flow chart of a volume adjustment method provided in an embodiment of the present application.

[0052] Specific steps may include:

[0053] S101: If an automatic volume adjustment instruction is received, using the microphone to collect ambient audio data;

[0054] Among them, this embodiment can be applied to electronic devices equipped with microphones and speakers, such as headphones, smart phones, smart speakers, VR helmets, AR glasses, etc. The automatic volume adjustment instruction can be an instruction transmitted by other devices in a wired or wireless manner, or an instruction input by the user through the touch screen or buttons of the electronic device, or a voice instruction input by the user.

[0055] Based on the automatic volume adjustment, this embodiment can start the microphone to collect environmental audio data. This embodiment does not limit the number of microphones. A single microphone can be used to collect environmental audio data, or multiple microphones can be used to collect environmental audio data.

[0056] S102: reading a compensation factor of the microphone, and calculating an ambient noise energy value according to the compensation factor of the microphone and the ambient audio data;

[0057] Among them, there is a difference between the actual noise energy in the environment and the noise energy that can be collected by the microphone, so the present application can read the compensation factor of the microphone and use the compensation factor to compensate for the above difference, that is, calculate the environmental noise energy value based on the compensation factor of the microphone and the environmental audio data. The environmental noise energy value is used to describe the volume of the environmental noise.

[0058] As a feasible implementation method, if the electronic device includes multiple microphones, each microphone has its corresponding compensation factor, and the ambient audio data collected by each microphone is also different, so the energy correction value calculated by each microphone can be calculated based on the compensation factor corresponding to the same microphone and the ambient audio data, and the ambient noise energy value can be obtained by combining the energy correction values ​​corresponding to all microphones.

[0059] S103: Determine a target volume level of the speaker according to the environmental noise energy value, and perform a volume adjustment operation according to the target volume level.

[0060] The electronic device may pre-store the correspondence between the ambient noise energy value and the volume level to be achieved by the speaker, and determine the target volume level of the speaker based on the correspondence. The volume level is used to describe the volume of the speaker when playing audio. After obtaining the target volume level, the speaker may be adjusted according to the target volume level so that the speaker plays audio at the target volume level.

[0061] When receiving the automatic volume adjustment instruction, this embodiment uses the microphone to collect environmental audio data, and calculates the environmental noise energy value in combination with the microphone compensation factor and the environmental audio data. This embodiment determines the target volume level of the speaker according to the environmental noise energy value, so as to adjust the volume of the current audio played by the speaker according to the target volume level. The above scheme calculates the environmental noise energy value based on the data collected by the microphone, and then adjusts the volume level of the speaker according to the environmental noise energy value, so that the volume of the audio played by the electronic device changes dynamically with the environmental noise. Therefore, this embodiment can automatically adjust the volume of the electronic device and improve the user's listening effect.

[0062] As a feasible implementation, an ADC (Analog-to-Digital Converter) chip of an electronic device may include multiple microphone channels, each of which is connected to a microphone. The ADC may also include any number of speaker channels, each of which is connected to a speaker.

[0063] On this basis, the environmental noise energy value can be calculated in the following way:

[0064] The energy correction value corresponding to the microphone is calculated using the first formula; and the average value of the energy correction values ​​corresponding to all the microphones is set as the environmental noise energy value EA. i =ce i ×F i , g i represents the energy correction value corresponding to the i-th microphone, ce i represents the energy value of the ambient audio data collected by the i-th microphone, F i represents the compensation factor of the i-th microphone.

[0065] Taking three microphones as an example, the compensation factors of each microphone are F1, F2 and F3 respectively; the energy values ​​of the ambient audio data collected by each microphone are ce1, ce2 and ce3 respectively; the energy value calculation process of the ambient audio data collected by each microphone is: g1 = ce1 × F1, g2 = ce2 × F2, g3 = ce3 × F3, and the final calculated ambient noise energy value is:

[0066] EA=(g1+g2+g3) / 3=(ce1×F1+ce2×F2+ce3×F3) / 3.

[0067] The installation positions and installation angles of the microphones in the above embodiments may be different, thereby improving the accuracy of calculating the environmental noise energy value.

[0068] As a further introduction to the above embodiment, before reading the compensation factor of the microphone, the compensation factor of the microphone may also be obtained in the following manner, which specifically includes the following steps:

[0069] Step A1: Playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value. The energy value of the preset audio data played by the speaker can be determined according to the frequency response function and gain value of the currently played audio.

[0070] Step A2: Calculate the compensation factor F of the microphone using the second formula i ;

[0071] Wherein, the second formula is F i =sqrt(E / e i ), sqrt represents the square root function, and E represents all the energy values ​​collected by the test e i and the test playback energy value e' j The sum of i Represents the test collection energy value of the i-th microphone. e' j Represents the test collection energy value of the jth speaker.

[0072] Step A3: Calculate the inference threshold of the microphone using the third formula;

[0073] Wherein, the third formula is FF i =round(F i ×α), FF i represents the inference threshold of the i-th microphone, round represents the rounding calculation function, α represents the maximum value of the sampling bit number of the ADC chip, and taking the sampling bit number of 32 bits as an example, α is 1073741824.

[0074] Taking three microphones as an example, the inference threshold calculation process of each microphone is as follows:

[0075] FF1 = round(F1 × α);

[0076] FF2 = round(F2 × α);

[0077] FF3=round(F3×α).

[0078] Step A4: Determine whether the inference thresholds of the microphones are all within a preset range; if so, proceed to step A5; if not, proceed to step A6;

[0079] The above preset interval may be an empirical value obtained from experiments, such as [536870912, 2147483647].

[0080] Step A5: writing the compensation factor of the microphone into the memory of the electronic device.

[0081] Step A6: Remind the user to repair the microphone.

[0082] As a feasible implementation mode, when reminding the user to repair the microphone, the ID information of the microphone that does not meet the preset range may be prompted.

[0083] As a feasible implementation method, Figure 1 In the process of determining the target volume level of the speaker, the corresponding embodiment can determine the corresponding target volume level in combination with the current volume adjustment mode of the electronic device. The above volume adjustment modes include tracking adjustment mode, adaptive adjustment mode and manual volume adjustment mode. The corresponding process of determining the target volume level of the speaker includes the following steps:

[0084] Step B1: Determine the current volume adjustment mode;

[0085] Step B2: if the volume adjustment mode is the tracking adjustment mode, an energy level difference is calculated according to the ambient noise energy value and the energy value of the current audio data played by the speaker, and a target volume level of the speaker is determined according to the energy level difference;

[0086] The energy level difference is used to describe the energy difference between the ambient noise and the audio played by the speaker;

[0087] Step B3: If the volume adjustment mode is an adaptive adjustment mode, determining the target volume level of the speaker according to the ambient noise energy value.

[0088] Specifically, in the above step B2, the energy level difference can be calculated in the following manner: the energy level difference EDIFF is calculated according to the fourth formula; wherein the fourth formula is EDIFF=EA-se×F' j , EA represents the environmental noise energy value, F' j represents the compensation factor of the jth speaker, and se represents the energy value of the speaker playing the current audio data.

[0089] As a further introduction to the above embodiment, before calculating the energy level difference EDIFF, the compensation factor of the speaker can also be obtained in the following manner, which specifically includes the following steps:

[0090] Step C1: playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value;

[0091] Step C2: Calculate the compensation factor of the speaker using the fifth formula;

[0092] Wherein, the fifth formula is F' j =sqrt(E / e' j ), F' j represents the compensation factor of the j-th speaker, sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e' j Represents the test playback energy value of the jth speaker.

[0093] Step C3: Calculate the inference threshold of the speaker using the sixth formula; wherein the sixth formula is FF' j =round(F' j ×α), FF' j represents the inference threshold of the j-th speaker, round represents the rounding calculation function, α represents the maximum value of the sampling bit number of the ADC chip, and taking the sampling bit number of 32 bits as an example, α is 1073741824.

[0094] Taking two speakers (i.e., the left speaker and the right speaker) as an example, the inference threshold calculation process of each speaker is as follows:

[0095] FF'1 = round(F'1 × α);

[0096] FF'2 = round(F'2 × α);

[0097] Step C4: Determine whether the inference thresholds of the speakers are all within a preset range; if so, proceed to step C5; if not, proceed to step C6;

[0098] Step C5: writing the compensation factor of the speaker into the memory of the electronic device.

[0099] Step C6: Remind the user to repair the speaker.

[0100] As a feasible implementation, when reminding the user to repair the speaker, the ID information of the speaker that does not meet the preset range may be prompted.

[0101] In addition, in the manual volume adjustment mode, the electronic device can determine the target volume level according to the volume value input by the user.

[0102] As a feasible implementation method, this embodiment can also perform volume adjustment operations in combination with the user's hearing tolerance. Therefore, the process of performing the volume adjustment operation according to the target volume level is as follows: calculate the total sound energy value according to the ambient noise energy value and the target volume level; determine whether the total sound energy value is greater than the preset energy value; if so, lower the target volume level and perform the volume adjustment operation according to the lowered target volume level; if not, perform the volume adjustment operation according to the target volume level.

[0103] The above-mentioned preset energy value is the audio energy value corresponding to the user's maximum hearing tolerance. After determining the target volume level, if the total sound energy value is greater than the preset energy value, it means that the user's hearing will be damaged and the audio playback volume should be lowered; if the total sound energy value is less than or equal to the preset energy value, it means that there is no damage to the user's hearing, and the volume adjustment operation can be performed directly according to the target volume level.

[0104] The process described in the above embodiment is explained below through an embodiment in actual application.

[0105] At present, the smart speakers in the related technology cannot automatically adjust the volume according to the ambient sound. During use, the sound is often too loud and deafening when there are few people and quiet, or too quiet and unclear when there are many people having a meal or children are noisy. In view of the above problems, this embodiment provides a solution for a smart speaker to automatically adjust the playback volume. The smart speaker includes 3 microphones and 1 speaker. In order to enable the smart speaker to automatically adjust the playback volume according to the ambient noise, the ADC chip of the smart speaker includes Channel 1, Channel 2, Channel 3 and Channel 4. Among them, Channel 1, Channel 2, and Channel 3 are connected to microphones, and Channel 4 is connected to speakers.

[0106] See also Figure 2 , Figure 2 This is a flow chart of a method for calculating the compensation factor of a microphone and a speaker provided in an embodiment of the present application. The specific process is as follows:

[0107] S201: Playing preset audio data in a factory pseudo-noise environment;

[0108] S202: Calculate the inference thresholds FF1, FF2, FF3, FF'1 and the compensation factors F1, F2, F3, F'1 according to the calculation formula, and send them to the factory management module for inference judgment.

[0109] The process of calculating the inference threshold and compensation factor is as follows:

[0110] Determine the energy values ​​e1, e2 and e3 of the audio data collected by each microphone and the energy value e'1 of the audio played by the speaker, and calculate the ambient noise energy value E, E=(e1+e2+e3+e'1) / 4.

[0111] The process of calculating the coefficient R is as follows:

[0112] R1=e1 / E, R2=e2 / E, R3=e3 / E, R4=e'1 / E;

[0113] F1 = sqrt(1 / R1);

[0114] F2 = sqrt(1 / R2);

[0115] F3 = sqrt(1 / R3);

[0116] F'1 = sqrt(1 / R4);

[0117] If the maximum number of ADC chip sampling bits is 1073741824, the inference threshold is calculated as follows:

[0118] FF1=round(F1×1073741824);

[0119] FF2=round(F2×1073741824);

[0120] FF3=round(F3×1073741824);

[0121] FF'1=round(F'1×1073741824).

[0122] S203: Determine whether FF1, FF2, FF3 and FF'1 pass the inference logic; if so, proceed to S204; if not, proceed to S205;

[0123] The process of judging whether the reasoning logic is passed is as follows:

[0124] The judgment process for FF1 is:

[0125] Determine whether (FF1>=536870912)&&(FF1<=2147483647) is satisfied;

[0126] The judgment process for FF2 is:

[0127] Determine whether (FF2>=536870912)&&(FF2<=2147483647) is satisfied;

[0128] The judgment process for FF3 is:

[0129] Determine whether (FF3>=536870912)&&(FF3<=2147483647) is satisfied;

[0130] The judgment process for FF'1 is:

[0131] Determine whether (FF'1>=536870912)&&(FF'1<=2147483647) is satisfied;

[0132] If the above four judgments are all passed, the process proceeds to S204 , otherwise, the process proceeds to S205 .

[0133] S204: Writing the compensation factors F1, F2, F3, and F'1 into the non-volatile storage medium of the smart speaker;

[0134] S205: The device ID, microphone number, and speaker number are sent to the production server for tracking management, and a set prompt sound signal is played to remind manual maintenance processing.

[0135] See also Figure 3 , Figure 3 The flow chart of a volume adjustment method of a smart speaker provided in an embodiment of the present application specifically includes the following process:

[0136] Step S301: The audio management module determines the volume adjustment mode selected by the user;

[0137] Step S302: If it is the tracking adjustment mode (i.e., the speaker tracking volume automatic adjustment mode), the energy level difference EDIFF is calculated according to the calculation formula, and the EDIFF value is sent to the audio management module to query the corresponding target volume level;

[0138] Specifically, the audio management module can obtain the energy values ​​ce1, ce2, ce3 and se of the audio data collected by Channel 1, Channel 2, Channel 3 and Channel 4 from the voice collection module, and calculate the energy level difference EDIFF using the following formula:

[0139] EDIFF=(ce1×F1+ce2×F2+ce3×F3) / 3–se×F'1;

[0140] Step S303: If it is the adaptive adjustment mode (ie, the EA volume automatic adjustment mode), the ambient noise energy value EA is calculated according to the calculation formula, and the ambient noise energy value EA is sent to the audio management module to query the corresponding target volume level;

[0141] Specifically, the audio management module can obtain the energy values ​​ce1, ce2, ce3 of the audio data collected by Channel1, Channel2 and Channel3 from the voice collection module, and calculate the energy average EA using the following formula: EA = (ce1×F1+ce2×F2+ce3×F3) / 3.

[0142] Step S304: if the volume is in manual volume adjustment mode, the volume value input by the user is obtained and converted into a volume level corresponding to the audio management module;

[0143] Step S305: the audio management module performs a volume adjustment operation according to the target volume level.

[0144] The Speaker tracking volume automatic adjustment mode and EA volume automatic adjustment mode provided in this embodiment have good intelligent volume adjustment functions, which can meet the needs of the smart speaker to obtain a good voice playback experience in noisy, quiet and normal usage environments.

[0145] See also Figure 4 , Figure 4 This is a structural schematic diagram of a volume adjustment device provided in an embodiment of the present application. The device can be applied to an electronic device provided with a microphone and a speaker. The volume adjustment device includes:

[0146] The ambient sound collection module 401 is used to collect ambient audio data using the microphone if an automatic volume adjustment instruction is received;

[0147] A noise energy calculation module 402 is used to read the compensation factor of the microphone and calculate the environmental noise energy value according to the compensation factor of the microphone and the environmental audio data;

[0148] The adjustment module 403 is used to determine the target volume level of the speaker according to the environmental noise energy value, and perform a volume adjustment operation according to the target volume level.

[0149] When receiving the automatic volume adjustment instruction, this embodiment uses the microphone to collect environmental audio data, and calculates the environmental noise energy value in combination with the microphone compensation factor and the environmental audio data. This embodiment determines the target volume level of the speaker according to the environmental noise energy value, so as to adjust the volume of the current audio played by the speaker according to the target volume level. The above scheme calculates the environmental noise energy value based on the data collected by the microphone, and then adjusts the volume level of the speaker according to the environmental noise energy value, so that the volume of the audio played by the electronic device changes dynamically with the environmental noise. Therefore, this embodiment can automatically adjust the volume of the electronic device and improve the user's listening effect.

[0150] Furthermore, the ADC chip of the electronic device includes a plurality of microphone channels, each of the microphone channels is connected to one of the microphones;

[0151] Correspondingly, the process of the noise energy calculation module 402 calculating the ambient noise energy value according to the compensation factor of the microphone and the ambient audio data includes: using a first formula to calculate the energy correction value corresponding to the microphone; wherein the first formula is gi=cei×Fi, gi represents the energy correction value corresponding to the i-th microphone, cei represents the energy value of the ambient audio data collected by the i-th microphone, and Fi represents the compensation factor of the i-th microphone; and setting the average value of the energy correction values ​​corresponding to all the microphones as the ambient noise energy value.

[0152] Furthermore, it also includes:

[0153] The first compensation factor determination module is used to play preset audio data before reading the compensation factor of the microphone, set the energy value of the preset audio data collected by the microphone as the test collection energy value, and set the energy value of the preset audio data played by the speaker as the test playback energy value; it is also used to calculate the compensation factor Fi of the microphone using a second formula; wherein the second formula is Fi=sqrt(E / ei), sqrt represents the square root function, E represents the sum of all the test collection energy values ​​and the test playback energy values, and ei represents the test collection energy value of the i-th microphone; it is also used to calculate the inference threshold of the microphone using a third formula; wherein the third formula is FFi=round(Fi×α), FFi represents the inference threshold of the i-th microphone, round represents the rounding calculation function, and α represents the maximum value of the sampling bits of the ADC chip; it is also used to determine whether the inference thresholds of the microphones are all within a preset range; if so, the compensation factors of the microphones are written into the memory of the electronic device.

[0154] Furthermore, the process of the adjustment module 403 determining the target volume level of the speaker according to the ambient noise energy value includes: determining the current volume adjustment mode; if the volume adjustment mode is a tracking adjustment mode, calculating the energy level difference according to the ambient noise energy value and the energy value of the current audio data played by the speaker, and determining the target volume level of the speaker according to the energy level difference; wherein the energy level difference is used to describe the degree of energy difference between the ambient noise and the audio played by the speaker; if the volume adjustment mode is an adaptive adjustment mode, determining the target volume level of the speaker according to the ambient noise energy value.

[0155] Furthermore, the process of the adjustment module 403 calculating the energy level difference according to the ambient noise energy value and the energy value of the current audio data played by the speaker includes: calculating the energy level difference EDIFF according to the fourth formula; wherein the fourth formula is EDIFF=EA-sel×F'j, EA represents the ambient noise energy value, F'j represents the compensation factor of the jth speaker, and sel represents the energy value of the current audio data played by the speaker.

[0156] Furthermore, it also includes:

[0157] The second compensation factor determination module is used to play preset audio data before calculating the energy level difference EDIFF according to the fourth formula, set the energy value of the preset audio data collected by the microphone as the test collection energy value, and set the energy value of the preset audio data played by the speaker as the test playback energy value; it is also used to calculate the compensation factor of the speaker using the fifth formula; wherein the fifth formula is F'j=sqrt(E / e'j), F'j represents the compensation factor of the j-th speaker, sqrt represents the square root function, E represents the sum of all the test collection energy values ​​and the test playback energy values, and e'j represents the test playback energy value of the j-th speaker; it is also used to calculate the inference threshold of the speaker using the sixth formula; wherein the sixth formula is FF'j=round(F'j×α), FF'j represents the inference threshold of the j-th speaker, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip; it is also used to determine whether the inference thresholds of the speakers are all within a preset range; if so, the compensation factor of the speaker is written into the memory of the electronic device.

[0158] Furthermore, the process of the adjustment module 403 performing a volume adjustment operation according to the target volume level includes: calculating a total sound energy value according to the ambient noise energy value and the target volume level; determining whether the total sound energy value is greater than a preset energy value; if so, lowering the target volume level, and performing a volume adjustment operation according to the lowered target volume level; if not, performing a volume adjustment operation according to the target volume level.

[0159] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0160] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0161] The present application also provides an electronic device, which may include a microphone, a speaker, a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.

[0162] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

[0163] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A volume adjustment method, characterized in that: Applied to an electronic device provided with a microphone and a speaker, the volume adjustment method comprises: If an automatic volume adjustment instruction is received, the microphone is used to collect ambient audio data; Reading a compensation factor of the microphone, and calculating an ambient noise energy value according to the compensation factor of the microphone and the ambient audio data; Determining a target volume level of the speaker according to the ambient noise energy value, and performing a volume adjustment operation according to the target volume level; Wherein, the ADC chip of the electronic device includes a plurality of microphone channels, each of the microphone channels is connected to one of the microphones; Accordingly, before reading the compensation factor of the microphone, the method further includes: Playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value; The compensation factor F of the microphone is calculated using the second formula i ; Wherein, the second formula is F i =sqrt(E / e i ), sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e i represents the test collection energy value of the i-th microphone; The inference threshold of the microphone is calculated using the third formula; wherein the third formula is FF i =round(F i ×α), FF i represents the inference threshold of the i-th microphone, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip; Determining whether the inference thresholds of the microphones are all within a preset range; If so, the compensation factor of the microphone is written into the memory of the electronic device.

2. The volume adjustment method according to claim 1, characterized in that: Calculating the ambient noise energy value according to the compensation factor of the microphone and the ambient audio data includes: The energy correction value corresponding to the microphone is calculated using the first formula; wherein the first formula is g i =ce i ×F i , g i represents the energy correction value corresponding to the i-th microphone, ce i represents the energy value of the ambient audio data collected by the i-th microphone, F i represents the compensation factor of the i-th microphone; An average value of the energy correction values ​​corresponding to all the microphones is set as the environmental noise energy value.

3. The volume adjustment method according to claim 1, characterized in that: Determining a target volume level of the speaker according to the environmental noise energy value includes: Determine the current volume adjustment mode; If the volume adjustment mode is the tracking adjustment mode, an energy level difference is calculated according to the energy value of the ambient noise and the energy value of the current audio data played by the speaker, and a target volume level of the speaker is determined according to the energy level difference; wherein the energy level difference is used to describe the degree of energy difference between the ambient noise and the audio played by the speaker; If the volume adjustment mode is an adaptive adjustment mode, the target volume level of the speaker is determined according to the ambient noise energy value.

4. The volume adjustment method according to claim 3, characterized in that: Calculating the energy level difference according to the energy value of the ambient noise and the energy value of the current audio data played by the speaker includes: Calculate the energy level difference EDIFF according to the fourth formula; Wherein, the fourth formula is EDIFF=EA-se×F' j , EA represents the environmental noise energy value, F' j represents the compensation factor of the jth speaker, and se represents the energy value of the speaker playing the current audio data.

5. The volume adjustment method according to claim 4, characterized in that: Before calculating the energy level difference EDIFF according to the fourth formula, the method further includes: Playing preset audio data, setting the energy value of the preset audio data collected by the microphone as a test collection energy value, and setting the energy value of the preset audio data played by the speaker as a test playback energy value; The compensation factor of the speaker is calculated using the fifth formula; wherein the fifth formula is F' j =sqrt(E / e' j ), F' j represents the compensation factor of the j-th speaker, sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e' j represents the test playback energy value of the jth speaker; The inference threshold of the speaker is calculated using the sixth formula; wherein the sixth formula is FF' j =round(F' j ×α), FF' j represents the inference threshold of the j-th speaker, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip; Determining whether the inference thresholds of the speakers are all within a preset range; If so, the compensation factor of the speaker is written into the memory of the electronic device.

6. The volume adjustment method according to any one of claims 1 to 5, characterized in that: Performing a volume adjustment operation according to the target volume level includes: Calculate the total sound energy value according to the ambient noise energy value and the target volume level; Determining whether the total energy value of the sound is greater than a preset energy value; If yes, lower the target volume level, and perform the volume adjustment operation according to the lowered target volume level; If not, the volume adjustment operation is performed according to the target volume level.

7. A volume adjustment device, characterized in that: Applicable to an electronic device provided with a microphone and a speaker, the volume adjustment device comprises: An ambient sound collection module, for collecting ambient audio data using the microphone if an automatic volume adjustment instruction is received; A noise energy calculation module, used for reading the compensation factor of the microphone, and calculating the environmental noise energy value according to the compensation factor of the microphone and the environmental audio data; an adjustment module, configured to determine a target volume level of the speaker according to the ambient noise energy value, and perform a volume adjustment operation according to the target volume level; Wherein, the ADC chip of the electronic device includes a plurality of microphone channels, each of the microphone channels is connected to one of the microphones; The first compensation factor determination module is used to play preset audio data before reading the compensation factor of the microphone, set the energy value of the preset audio data collected by the microphone to a test collection energy value, and set the energy value of the preset audio data played by the speaker to a test playback energy value; and is also used to calculate the compensation factor F of the microphone using the second formula i ; Wherein, the second formula is F i =sqrt(E / e i ), sqrt represents the square root function, E represents the sum of all the test acquisition energy values ​​and the test playback energy values, e i represents the test collection energy value of the i-th microphone; and is also used to calculate the inference threshold of the microphone using a third formula; wherein the third formula is FF i =round(F i ×α), FF i represents the inference threshold of the i-th microphone, round represents the rounding calculation function, and α represents the maximum value of the sampling bit number of the ADC chip; it is also used to determine whether the inference thresholds of the microphones are all within the preset range; if so, the compensation factor of the microphone is written into the memory of the electronic device.

8. An electronic device, characterized in that: The method comprises a microphone, a speaker, a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the volume adjustment method according to any one of claims 1 to 6 when calling the computer program in the memory.

9. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the volume adjustment method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Volume adjustment method, earphone and storage medium

    CN109688498A