A method and device for adjusting volume of an external microphone
By determining the connection method and volume attenuation ratio of peripheral microphones on the Android system terminal, the problem that the native Android system cannot adjust the microphone volume is solved, volume adjustment and noise filtering are realized, and communication efficiency of video conferencing is improved.
Patent Information
- Application Number
- CN202211588531.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2042-12-09
AI Technical Summary
The terminal equipped with native Android system cannot adjust the volume of the microphone connected to it separately, resulting in excessive volume or noise amplification that will affect the communication effect of video conference.
By determining the connection method of the peripheral microphone of the Android system terminal and determining the volume attenuation ratio based on the audio it collects, the volume is adjusted using the extended Android system driver interface.
The volume adjustment of the peripheral microphone of the Android system terminal is realized, reducing the transmission of small amplitude noise, and improving the sound transmission quality and communication efficiency of the microphone.
Smart Images

Figure CN115942018B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic communication technology, and in particular to a method and device for adjusting the volume of an external microphone. Background Art
[0002] With the development and application of 5G communication technology, cloud computing, artificial intelligence, and high-definition codecs, remote collaboration and version sharing anytime and anywhere have become part of people's daily work and life, which has also prompted more and more companies and users to choose video conferencing for real-time communication. In the scenario of multi-person video conferencing, a large screen is usually required to unfold the conference. Customizing and developing conference-related applications on smart set-top boxes is a commonly used solution.
[0003] The current smart set-top boxes are widely equipped with the Android system, which includes the ability to drive commonly used peripheral hardware for conferences, such as cameras, microphones, speakers, and TVs. Therefore, it can support the use of peripheral hardware for various activities in large-screen conferences. However, since the Android system is designed based on mobile terminals, its driver for peripheral hardware devices has inherent defects. The audio management interface AudioManger of the native Android system does not support adjusting the microphone volume through applications, which results in the inability of terminals equipped with the native Android system to adjust the volume of the microphone connected to it. Therefore, due to the different hardware designs of the peripheral microphones, there may be some problems with the microphone volume being too loud, and when the microphone input volume is too loud, some of the noise will also be amplified, which will affect the communication effect of the meeting.
[0004] Therefore, how to adjust the volume of the external microphone of the Android system terminal is a technical problem to be solved. Summary of the invention
[0005] The main purpose of the present application is to provide a method and device for adjusting the volume of an external microphone, aiming to solve the technical problem that a terminal equipped with a native Android system cannot independently change the volume of a microphone connected thereto.
[0006] In a first aspect, the present application provides a method for adjusting the volume of an external microphone, the method comprising the following steps:
[0007] Determine the connection method of the external microphone of the Android terminal;
[0008] Determining a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone;
[0009] After determining that the volume adjustment function of the external microphone is started, the external microphone is driven to adjust the volume according to the volume attenuation ratio through an Android system driver interface extended with a volume adjustment function corresponding to the connection mode of the external microphone.
[0010] In a second aspect, the present application further provides a volume adjustment device for an external microphone, which is used to implement the volume adjustment method for the external microphone as described above, comprising:
[0011] A determination module, which is used to determine the connection mode of the external microphone of the Android system terminal;
[0012] A calculation module, which is used to determine a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone;
[0013] The driving module is used to drive the external microphone to adjust the volume according to the volume attenuation ratio through an Android system driving interface extended with a volume adjustment function corresponding to the connection mode of the external microphone after determining that the volume adjustment function of the external microphone is started.
[0014] The present application provides a method and device for adjusting the volume of an external microphone, by determining the connection mode of the external microphone of an Android system terminal; determining the volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone; after determining that the volume adjustment function of the external microphone is started, the external microphone is driven to adjust the volume according to the volume attenuation ratio through an Android system driver interface extended with a volume adjustment function corresponding to the connection mode of the external microphone. The volume of the external microphone of the Android system terminal is adjusted, and the volume adjustment according to the volume attenuation ratio can make the amplitude of small-amplitude noise after hardware attenuation unable to reach the amplitude threshold converted into a digital signal, thereby filtering small-amplitude noise, and the method effectively improves the sound transmission quality of the microphone and improves communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are 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.
[0016] Figure 1 A flow chart of a method for adjusting the volume of an external microphone provided in an embodiment of the present application;
[0017] Figure 2A specific flow chart of a method for determining a volume attenuation ratio;
[0018] Figure 3 A specific flow chart of a method for adjusting the volume of an external microphone;
[0019] Figure 4 A schematic block diagram of a volume adjustment device for an external microphone provided in an embodiment of the present application.
[0020] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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.
[0022] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0023] The embodiment of the present application provides a method and device for adjusting the volume of an external microphone, wherein the method for adjusting the volume of an external microphone can be applied to a computer device, which can be an Android system smart set-top box device or other Android system terminal.
[0024] The accompanying drawings provide detailed descriptions of some embodiments of the present application. In the absence of conflict, the following embodiments and features in the embodiments may be combined with each other.
[0025] Please refer to Figure 1 , Figure 1 A flow chart of a method for adjusting the volume of an external microphone provided in an embodiment of the present application.
[0026] like Figure 1 As shown, the method includes steps S101 to S103.
[0027] Step S101: Determine the connection mode of the external microphone of the Android system terminal.
[0028] It is worth noting that the external microphone is generally connected to the terminal via USB or Bluetooth, and the Android system terminal includes an Android system application downloaded in advance.
[0029] In some embodiments, determining the connection mode of an external microphone of an Android system terminal includes: after the external microphone is successfully connected, determining whether the external microphone is connected via USB or via Bluetooth through the application layer audio management interface AudioManager in the Android system that is extended with an external microphone connection mode judgment function and an external microphone volume adjustment function.
[0030] It is worth noting that when an external microphone is connected to an Android system terminal via USB or Bluetooth, a device node will be automatically generated in the terminal, and the device node has a fixed path and a fixed name. Therefore, the terminal itself can determine whether the external microphone is successfully connected to the terminal by detecting whether the device node exists. Then, the AudioManager interface, which is extended with the function of determining the connection mode of the external microphone, is used to obtain the connection mode of the microphone based on the device node path and name and other information, so as to determine whether the external microphone is connected via USB or Bluetooth.
[0031] Because the application layer Framework in the native Android system does not have an interface for adjusting the external microphone, this embodiment extends the relevant code of the Framework layer to expand the external microphone connection mode judgment function and the external microphone volume adjustment function for the AudioManager interface of the Framework layer, so as to achieve the implementation of external microphone volume adjustment in the application layer of the Android system, that is, the Framework layer. The specific method and relevant code for expanding the AudioManager interface function are well known to technicians related to Android system development, so they will not be repeated here.
[0032] Step S102: determining a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone.
[0033] Specifically, determine the maximum amplitude and minimum amplitude of the preset reference audio; determine the maximum amplitude and minimum amplitude of the collected audio, and determine the optimal amplitude of the collected audio according to the maximum amplitude and minimum amplitude of the collected audio; judge whether the maximum amplitude of the collected audio is higher than the maximum amplitude of the reference audio; if so, divide the maximum amplitude of the reference audio by the optimal amplitude of the collected audio to obtain a first amplitude ratio as the volume attenuation ratio, otherwise, judge whether the minimum amplitude of the collected audio is lower than the minimum amplitude of the reference audio; if so, divide the optimal amplitude of the collected audio by the maximum amplitude of the reference audio to obtain a second amplitude ratio, compare the second amplitude ratio with the first amplitude ratio, and use the amplitude ratio with a smaller value as the volume attenuation ratio, otherwise, use the preset parameter as the volume attenuation ratio.
[0034] Furthermore, determining the optimal amplitude of the collected audio specifically includes the following steps: subtracting the lowest amplitude of the collected audio from the highest amplitude of the collected audio to obtain an amplitude difference; and adding a preset ratio of the amplitude difference to the lowest amplitude of the collected audio to obtain the optimal amplitude of the collected audio.
[0035] For example, the highest amplitude of the collected audio is 50dB, and the lowest amplitude is 10dB. The calculated amplitude difference of the collected audio is 40dB. When the preset ratio is 50%, the optimal amplitude of the collected audio can be calculated to be 10dB+40dB*50%=30dB. When the highest amplitude of the reference audio is 24dB, the highest amplitude of the collected audio is higher than the highest amplitude of the reference audio. The volume attenuation ratio is 24dB / 30dB=80% obtained by dividing the highest amplitude of the reference audio by the optimal amplitude of the collected audio. When the original volume received by the external microphone is 40dB when in use, after controlling the external microphone to adjust the volume once, the original volume is attenuated to 80% of the original volume according to the volume attenuation ratio, which is 32dB.
[0036] It is worth noting that when determining the optimal amplitude of the collected audio, the preset ratio in the amplitude difference of the preset ratio can be set with the goal of making the audio amplitude close to the amplitude of the reference audio after adjusting the volume according to the attenuation ratio.
[0037] When obtaining reference audio, mainstream peripheral microphones on the market can be collected and connected to the terminal, and actual measurements can be performed using an Android system application, and the audio with the best sound effect can be used as the reference audio.
[0038] Exemplary, such as Figure 2 As shown, determining the volume attenuation ratio specifically includes the following steps:
[0039] Step S201: Determine the highest amplitude and the lowest amplitude of the reference audio.
[0040] Step S202, acquiring collected audio. Specifically, after the external microphone is successfully connected to the set-top box, the set-top box controls the external microphone to perform real-time audio recording and collection to obtain collected audio.
[0041] Step S203: Determine the highest amplitude, the lowest amplitude and the best amplitude of the collected audio. In some embodiments, the middle amplitude between the highest amplitude and the lowest amplitude of the collected audio can be used as the best amplitude of the collected audio.
[0042] Step S204: Determine a first amplitude ratio. Specifically, the first amplitude ratio is obtained by dividing the highest amplitude of the reference audio by the best amplitude of the collected audio.
[0043] Step S205, determine whether the maximum amplitude of the collected audio is higher than the maximum amplitude of the reference audio; if so, proceed to step S206; otherwise, proceed to step S207.
[0044] Step S206: Using the first amplitude ratio as the volume attenuation ratio.
[0045] Step S207, determine whether the minimum amplitude of the collected audio is lower than the minimum amplitude of the reference audio; if so, proceed to step S208; otherwise, proceed to step S210.
[0046] Step S208: Determine a second amplitude ratio. Specifically, the second amplitude ratio is obtained by dividing the best amplitude of the collected audio by the highest amplitude of the reference audio;
[0047] Step S209: Selecting the smaller amplitude ratio between the second amplitude ratio and the first amplitude ratio as the volume attenuation ratio.
[0048] Step S210: Using the preset parameter as the volume attenuation ratio.
[0049] Further, after determining the attenuation ratio of the microphone volume adjustment, the attenuation ratio is stored in a data storage unit for data sharing, so as to be called by the adev_set_voice_volume interface and the BluetoothSocket interface in the Android system that are extended with the peripheral microphone volume adjustment function. For example, the attenuation ratio can be stored or set in a system property that can be shared by different processes, so that the adev_set_voice_volume interface and the BluetoothSocket interface can access and call.
[0050] Step S103: after determining that the volume adjustment function of the external microphone is started, the external microphone is driven to adjust the volume according to the volume attenuation ratio through an Android system driver interface extended with a volume adjustment function corresponding to the connection mode of the external microphone.
[0051] If the external microphone is connected via USB, the audio device driver in the Android system is called through the hardware abstraction layer volume setting interface adev_set_voice_volume extended with the external microphone volume adjustment function, so as to drive the external microphone to adjust the volume according to the volume attenuation ratio.
[0052] The audio device driver may be inymix or a program with similar functions to inymix.
[0053] Preferably, the adev_set_voice_volume interface is further extended with a function of determining whether the volume adjustment flag of the external microphone is enabled. When the external microphone is connected via USB, determining whether the volume adjustment function of the external microphone is enabled includes: determining whether the preset volume adjustment flag of the external microphone is enabled through the adev_set_voice_volume interface; if the volume adjustment flag of the external microphone is enabled, determining that the volume adjustment function of the external microphone is enabled;
[0054] If the external microphone volume adjustment flag is in a not enabled state, it is determined that the external microphone volume adjustment function is not started.
[0055] In this embodiment, the hardware abstraction layer is the tinyhal layer. It is understandable that in this embodiment, the adev_set_voice_volume interface is extended to have two functions, one is to determine whether the external microphone volume adjustment flag is enabled, and the other is to adjust the external microphone volume. The specific method and related code for extending the adev_set_voice_volume interface function are well known to technicians related to Android system development, so they will not be repeated here.
[0056] It is worth noting that while expanding the functions of each interface, it also includes setting the microphone volume adjustment flag in the terminal. The setting of the flag can be achieved by storing a data structure of the flag in the terminal. After the microphone volume adjustment flag is set, the flag can be displayed on the screen of the terminal. The external microphone volume adjustment flag can be triggered to enter the enabled state by clicking the screen with a mouse or finger, or by an Android system application. The expanded adev_set_voice_volume interface can determine whether the external microphone volume adjustment flag is enabled. When the external microphone volume adjustment flag is enabled, it means that there is a need to adjust the volume of the external microphone, and the external microphone volume adjustment function is turned on.
[0057] After the adev_set_voice_volume interface is extended with the volume adjustment function of the external microphone, the Android system has completed the implementation of the volume adjustment of the external microphone. When the adev_set_voice_volume interface determines that the volume adjustment of the external microphone is enabled, it will obtain the pre-stored volume attenuation ratio, and call the audio device driver tinymix in the Android system, using the USB protocol of the tinymix program to establish communication with the external microphone, so as to send a volume adjustment instruction to the USB-connected external microphone, so that the microphone can adjust the volume according to the volume adjustment instruction and the volume attenuation ratio.
[0058] Further, if the external microphone is connected via Bluetooth, after determining that the volume adjustment function of the external microphone is started, the external microphone is driven to adjust the volume according to the volume attenuation ratio through an Android system driver interface corresponding to the connection mode of the external microphone and extended with a volume adjustment function, and further comprising:
[0059] After the volume adjustment flag of the external microphone is enabled, a Bluetooth communication object interface BluetoothSocket is created through a standard interface in the Android system, and the external microphone is connected through the BluetoothSocket interface; a Bluetooth AT command is sent to the external microphone through the BluetoothSocket interface to drive the microphone to adjust the volume according to the acquired volume attenuation ratio, wherein the Bluetooth AT command includes a volume adjustment command and a volume attenuation ratio.
[0060] It is worth noting that when the external microphone is connected by Bluetooth, the terminal can directly obtain the signal that the microphone volume adjustment flag is enabled. In this embodiment, the standard interface in the Android system is the createRfcommSocketToServiceRecord interface. The BluetoothSocket interface is a software interface for Bluetooth communication objects in the Android system. The Bluetooth AT command sent by the BluetoothSocket interface to the external microphone is a standard command name in the communications industry. VGM is a specific command in the AT command: it means adjusting the sound. After the BluetoothSocket interface sends the volume adjustment command AT and the volume attenuation ratio to the external microphone, the external microphone adjusts the volume according to the volume adjustment command AT and the volume attenuation ratio.
[0061] In the present embodiment, a volume attenuation ratio is sent to an external microphone connected to USB or an external microphone connected to Bluetooth, so that the microphone adjusts the volume according to the volume attenuation ratio. This can attenuate noise with a smaller amplitude at the external microphone end so that its amplitude cannot reach the amplitude threshold for conversion into a digital signal, thereby filtering out small-amplitude noise and improving the sound quality of the external microphone.
[0062] As a preferred implementation, after sending a volume adjustment instruction to a USB-connected external microphone or a Bluetooth-connected external microphone and driving the external microphone to adjust the volume according to the volume attenuation ratio, the terminal sets the microphone volume adjustment flag to a disabled state. Because the AudioManager interface and the adev_set_voice_volume interface were originally volume adjustment interfaces for external devices such as speakers, these interfaces were expanded to enable the adjustment of the volume of external microphones. Therefore, after completing the drive of the external microphone to adjust the volume, setting the microphone volume adjustment flag to a disabled state can avoid affecting the volume adjustment function of other devices (speakers and other external devices).
[0063] Exemplary, such as Figure 3 As shown, the volume adjustment method of the external microphone specifically includes the following steps:
[0064] Step S301, start the Android system application.
[0065] Step S302, detect whether the external microphone is successfully connected to the terminal; if so, proceed to step S303; otherwise, return to step S302.
[0066] Step S303: Control the microphone to collect audio to obtain collected audio.
[0067] Step S304: determine the volume attenuation ratio according to the collected audio and the preset reference audio, and store it.
[0068] Step S305, determine through the expanded AudioManager interface whether the microphone is connected via USB or via Bluetooth; if connected via USB, proceed to step S306; if connected via Bluetooth, proceed to step S309.
[0069] Step S306, determine whether the volume adjustment flag of the microphone is in the enabled state through the extended adev_set_voice_volume interface; if so, proceed to step S307; otherwise, return to step S306.
[0070] Step S307: Obtain the volume attenuation ratio through the extended adev_set_voice_volume interface, and call tinymix to send the volume adjustment instruction and volume attenuation ratio to the external microphone.
[0071] Step S308: Setting the microphone volume adjustment flag to a disabled state.
[0072] Step S309, directly determine whether the volume adjustment flag of the microphone is in an enabled state; if so, proceed to step S310; otherwise, return to step S309.
[0073] Step S310: Create a BluetoothSocket interface through the Android system standard interface to connect to the external microphone. The current external microphone is connected to the terminal through Bluetooth.
[0074] Step S311, obtain the volume attenuation ratio through the BluetoothSocket interface, and send a Bluetooth AT command to the external microphone. The Bluetooth AT command includes a VGM volume adjustment command and a volume attenuation ratio.
[0075] Step S312: Set the microphone volume adjustment flag to a disabled state.
[0076] The embodiment of the present application provides a method for adjusting the volume of an external microphone, by extending the microphone volume adjustment function through the AudioManager interface of the application layer in the Android system and the adev_set_voice_volume interface of the hardware abstraction layer, and driving the external microphone to adjust the volume according to the volume attenuation ratio through the corresponding interface according to the connection mode of the external microphone. If it is an external microphone connected by USB, the USB protocol of tinymix is called through the expanded adev_set_voice_volume interface, and the microphone peripheral is communicated with by executing the tinymix program, thereby changing the volume of the external microphone. If it is an external microphone connected by Bluetooth, the BluetoothSocket interface is combined with the Bluetooth AT command: AT+VGM to communicate with the Bluetooth peripheral to change the volume of the microphone peripheral connected by Bluetooth. It is realized that the Android system terminal and the application in the Android system can also adjust the volume of the external microphone in real time. And driving the external microphone to adjust the volume according to the volume attenuation ratio can borrow the hardware of the microphone peripheral to filter small noises, and will not increase the CPU resource occupation. This method effectively improves the transmission quality of the microphone sound and improves the communication efficiency.
[0077] like Figure 4 As shown, the embodiment of the present application also provides a volume adjustment device for an external microphone, the device comprising:
[0078] A determination module, which is used to determine the connection mode of the external microphone of the Android system terminal;
[0079] A calculation module, which is used to determine a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone;
[0080] The driving module is used to drive the external microphone to adjust the volume according to the volume attenuation ratio through an Android system driving interface extended with a volume adjustment function corresponding to the connection mode of the external microphone after determining that the volume adjustment function of the external microphone is started.
[0081] Wherein, the determining module is also used for:
[0082] After the external microphone is successfully connected, the application layer audio management interface AudioManager, which is extended with the external microphone connection mode determination function and the external microphone volume adjustment function in the Android system, determines whether the external microphone is connected via USB or via Bluetooth.
[0083] Wherein, the driving module is also used for:
[0084] If the external microphone is connected via USB, the audio device driver in the Android system is called through the hardware abstraction layer volume setting interface adev_set_voice_volume extended with the external microphone volume adjustment function, so as to drive the external microphone to adjust the volume according to the volume attenuation ratio.
[0085] Wherein, the driving module is also used for:
[0086] Through the adev_set_voice_volume interface, determine whether the preset external microphone volume adjustment flag is in the enabled state;
[0087] If the external microphone volume adjustment flag is in an enabled state, determining that the external microphone volume adjustment function is started;
[0088] If the external microphone volume adjustment flag is in a not enabled state, it is determined that the external microphone volume adjustment function is not started.
[0089] Wherein, the driving module is also used for:
[0090] If the external microphone is connected via Bluetooth, after the volume adjustment flag of the external microphone is enabled, a Bluetooth communication object interface BluetoothSocket is created through a standard interface in the Android system, and the external microphone is connected through the BluetoothSocket interface;
[0091] A Bluetooth AT command is sent to the external microphone through the Bluetooth Socket interface to drive the microphone to adjust the volume according to the acquired volume attenuation ratio, wherein the Bluetooth AT command includes a VGM volume adjustment command and a volume attenuation ratio.
[0092] The device is also used for:
[0093] After driving the external microphone to adjust the volume according to the volume attenuation ratio, setting the microphone volume adjustment flag to a disabled state.
[0094] Wherein, the calculation module is also used for:
[0095] Determine the highest amplitude and the lowest amplitude of the preset reference audio;
[0096] Determine the highest amplitude and the lowest amplitude of the collected audio, and determine the optimal amplitude of the collected audio according to the highest amplitude and the lowest amplitude of the collected audio;
[0097] Determining whether the maximum amplitude of the collected audio is higher than the maximum amplitude of the reference audio;
[0098] If yes, dividing the highest amplitude of the reference audio by the best amplitude of the collected audio to obtain a first amplitude ratio is used as the volume attenuation ratio; otherwise, determining whether the lowest amplitude of the collected audio is lower than the lowest amplitude of the reference audio;
[0099] If so, divide the optimal amplitude of the collected audio by the highest amplitude of the reference audio to obtain a second amplitude ratio, and compare the second amplitude ratio with the first amplitude ratio, and take the amplitude ratio with a smaller value as the volume attenuation ratio; otherwise, use the preset parameter as the volume attenuation ratio.
[0100] Wherein, the calculation module is also used for:
[0101] Subtract the lowest amplitude of the collected audio from the highest amplitude of the collected audio to obtain an amplitude difference;
[0102] The minimum amplitude of the collected audio is added to the amplitude difference of a preset ratio to obtain the optimal amplitude of the collected audio.
[0103] Wherein, the calculation module is also used for:
[0104] The attenuation ratio is stored in a data storage unit for data sharing, so as to be called by an adev_set_voice_volume interface and a BluetoothSocket interface in an Android system that are extended with a volume adjustment function for an external microphone.
[0105] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned embodiments and will not be repeated here.
[0106] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0107] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for adjusting the volume of an external microphone, characterized in that: include: Determine the connection method of the external microphone of the Android terminal; Determining a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone; After determining that the volume adjustment function of the external microphone is started, driving the external microphone to adjust the volume according to the volume attenuation ratio through an Android system driver interface extended with a volume adjustment function corresponding to the connection mode of the external microphone; Determining the connection mode of the external microphone of the Android system terminal includes: After the external microphone is successfully connected, determine whether the external microphone is connected via USB or Bluetooth through the application layer audio management interface AudioManager extended with external microphone connection mode determination function and external microphone volume adjustment function in the Android system; The method drives the external microphone to adjust the volume according to the volume attenuation ratio through an Android system driver interface with an extended volume adjustment function corresponding to the connection mode of the external microphone, including: If the external microphone is connected via USB, the audio device driver in the Android system is called by extending the hardware abstraction layer volume setting interface adev_set_voice_volume with the external microphone volume adjustment function to drive the external microphone to adjust the volume according to the volume attenuation ratio; If the external microphone is connected via Bluetooth, after the volume adjustment flag of the external microphone is enabled, a Bluetooth communication object interface BluetoothSocket is created through a standard interface in the Android system, and the external microphone is connected through the BluetoothSocket interface; Sending a Bluetooth AT command to the external microphone through the BluetoothSocket interface to drive the microphone to adjust the volume according to the acquired volume attenuation ratio, wherein the Bluetooth AT command includes a VGM volume adjustment command and a volume attenuation ratio; Determining a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone includes: Determine the highest amplitude and the lowest amplitude of the preset reference audio; Determine the highest amplitude and the lowest amplitude of the collected audio, and determine the optimal amplitude of the collected audio according to the highest amplitude and the lowest amplitude of the collected audio; Determining whether the maximum amplitude of the collected audio is higher than the maximum amplitude of the reference audio; If yes, dividing the highest amplitude of the reference audio by the best amplitude of the collected audio to obtain a first amplitude ratio is used as the volume attenuation ratio; otherwise, determining whether the lowest amplitude of the collected audio is lower than the lowest amplitude of the reference audio; If yes, then the best amplitude of the collected audio is divided by the highest amplitude of the reference audio to obtain a second amplitude ratio, and the second amplitude ratio is compared with the first amplitude ratio, and the amplitude ratio with a smaller value is used as the volume attenuation ratio; otherwise, the preset parameter is used as the volume attenuation ratio; The step of determining the optimal amplitude of the collected audio according to the highest amplitude and the lowest amplitude of the collected audio comprises: Subtract the lowest amplitude of the collected audio from the highest amplitude of the collected audio to obtain an amplitude difference; The minimum amplitude of the collected audio is added to the amplitude difference of a preset ratio to obtain the optimal amplitude of the collected audio.
2. The volume adjustment method of an external microphone according to claim 1, characterized in that: The adev_set_voice_volume interface is further extended with a function of determining whether the volume adjustment flag of an external microphone is enabled. When the external microphone is connected via USB, it is determined whether the volume adjustment function of the external microphone is enabled, including: Through the adev_set_voice_volume interface, determine whether the preset external microphone volume adjustment flag is in the enabled state; If the external microphone volume adjustment flag is in an enabled state, determining that the external microphone volume adjustment function is started; If the external microphone volume adjustment flag is in a not enabled state, it is determined that the external microphone volume adjustment function is not started.
3. The volume adjustment method of an external microphone according to claim 1 or 2, characterized in that: After driving the external microphone to adjust the volume according to the volume attenuation ratio, the method further includes: The microphone volume adjustment flag is set to a disabled state.
4. The volume adjustment method of an external microphone according to claim 1, characterized in that: After determining the attenuation ratio, the method further includes: The attenuation ratio is stored in a data storage unit for data sharing, so as to be called by an adev_set_voice_volume interface and a BluetoothSocket interface in an Android system that are extended with a volume adjustment function for an external microphone.
5. A volume adjustment device for an external microphone, characterized in that: The method for adjusting the volume of an external microphone according to any one of claims 1 to 4 comprises: A determination module, which is used to determine the connection mode of the external microphone of the Android system terminal; A calculation module, which is used to determine a volume attenuation ratio when adjusting the volume of the external microphone according to the collected audio of the external microphone; The driving module is used to drive the external microphone to adjust the volume according to the volume attenuation ratio through an Android system driving interface extended with a volume adjustment function corresponding to the connection mode of the external microphone after determining that the volume adjustment function of the external microphone is started.
Citation Information
Patent Citations
Audio system and audio control method
CN108337604A
Parameter adjustment method and electronic equipment
CN112527230A