Audio acquisition method, audio playing method and electronic equipment
By detecting conflicting scenes and speaker occupation status, and adjusting the audio playback and acquisition methods, the interference problem caused by the audio recording of audio playback applications in multi-window mode is solved, and the quality of voice recording is improved.
Patent Information
- Application Number
- CN202310834087.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2025-01-07
AI Technical Summary
In multi-window mode, the audio from the audio playback application may be recorded in another application, resulting in poor voice recording and interference.
Reduce interference by detecting conflicting scenes and speaker occupancy status, reducing or pausing the speaker's playback volume, collecting audio through the microphone, or playing audio through the speaker at a lower volume.
It effectively reduces the interference of audio playback on audio acquisition and improves the quality and effect of sound recording.
Smart Images

Figure CN119271165A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic technology, and in particular to an audio acquisition method and electronic device, and an audio playback method and electronic device. Background Art
[0002] Some electronic devices have a multi-window display function, which can display two or more windows on the display screen at the same time. Different windows can display different application contents respectively.
[0003] Take the example of a display screen displaying two different windows at the same time, where the application displayed in the first window is playing a short video, and the application displayed in the second window has a voice recording requirement, such as sending a voice message. At this time, the sound of the short video played in the first window may be recorded into the voice recorded by the application displayed in the second window. As a result, the audio played by the application displayed in the first window interferes with the sound recording of the application displayed in the second window, resulting in unsatisfactory voice recording effect. Summary of the invention
[0004] The embodiments of the present application provide an audio acquisition method, an audio playback method and an electronic device, which are used to reduce the interference of audio played by an application displayed in one window on the sound recording of an application displayed in another window in a multi-window mode, thereby improving the effect of sound recording.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, an audio acquisition method is provided, the method being applied to an electronic device including a microphone and a speaker, the method comprising:
[0007] The electronic device displays a first interface of a first application and a second interface of a second application. When the first interface is displayed, the first application plays audio through a speaker. The second interface includes a first control for triggering the recording of audio. When a first trigger operation on the first control displayed on the second interface is detected, it indicates that the second application has a need to collect audio using a microphone. At this time, if it is detected that the electronic device is in a preset conflict scenario and the speaker is occupied, the electronic device lowers the playback volume of the speaker, or the electronic device pauses the speaker from playing audio and collects audio through the microphone. The electronic device is in a preset conflict scenario, including: the electronic device runs multiple applications in the foreground, and multiple applications belong to preset applications. In this way, the interference and influence of the audio played by the first application through the speaker on the audio collected by the second application using the microphone can be reduced or avoided.
[0008] In a possible implementation of the first aspect, the first control is also used to trigger the stop of audio recording, and in the case where the playback volume of the speaker is lowered in response to the first trigger operation on the first control, the method further includes: in response to the second trigger operation on the first control, stop collecting audio through the microphone, and increase the playback volume of the speaker. Alternatively, the second interface also includes a second control for triggering the stop of audio recording; in the case where the playback volume of the speaker is lowered in response to the first trigger operation on the first control, the method further includes: in response to the third trigger operation on the second control, stop collecting audio through the microphone, and increase the playback volume of the speaker.
[0009] In this solution, when the playback volume of the speaker is lowered in response to the first trigger operation, if the second application stops recording audio, the volume of the first application played through the speaker can be increased, ensuring that the first application can play normally in a scenario without conflict.
[0010] In a possible implementation of the first aspect, the first control is also used to trigger the stop of audio recording, and in response to the first trigger operation on the first control, when the speaker is paused from playing audio, the above method further includes: in response to the second trigger operation on the first control, resuming the speaker from playing audio, and stopping the audio collection through the microphone. Alternatively, the second interface also includes a second control for triggering the stop of audio recording; in response to the first trigger operation on the first control, when the speaker is paused from playing audio, the above method further includes: in response to the third trigger operation on the second control, resuming the speaker from playing audio, and stopping the audio collection through the microphone.
[0011] In this solution, when the speaker is paused from playing audio in response to the first trigger operation, if the second application stops recording audio, the audio played by the first application through the speaker can be resumed, ensuring that the first application can play normally in a scenario without conflict.
[0012] In a possible implementation of the first aspect, the electronic device may determine whether the first application meets a preset pause condition in a conflict scenario. If the first application meets the preset pause condition, then as a response to the first trigger operation, the electronic device may pause the audio playback of the speaker. If the first application does not meet the preset pause condition, then as a response to the first trigger operation, the electronic device reduces the playback volume of the speaker. The preset pause condition includes at least one of the following: whether the interface currently displayed by the application includes a dynamic picture, whether the application belongs to a local application, or whether the application belongs to a preset pause whitelist.
[0013] In this solution, different processing can be done for different situations of applications occupying the speaker in a conflict scenario. Specifically, if the application meets the preset pause condition, the application speaker can be paused from playing audio in a conflict scenario and when the speaker is occupied. On the contrary, if the application does not meet the preset pause condition, the electronic device can reduce the volume of the audio played by the speaker in a conflict scenario and when the speaker is occupied. In this way, a more appropriate method can be selected to process audio collection and audio playback in a conflict scenario, thereby better reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0014] In a possible implementation of the first aspect, the framework layer of the electronic device includes a scene recognition module; the above method also includes: the scene recognition module obtains window mode information, and the application identifier of the first application and the application identifier of the second application. Afterwards, the scene recognition module can determine whether the electronic device is in a preset conflict scenario based on the window mode information, and the application identifier of the first application and the application identifier of the second application. Wherein, when the window mode information indicates that the electronic device is running multiple applications in the foreground, and based on the application identifier of the first application and the application identifier of the second application, it is determined that the first application and the second application belong to preset applications, it is determined that the electronic device is in a preset conflict scenario.
[0015] In this solution, a scene recognition module arranged in the framework layer of the electronic device judges the scene in which the current electronic device is located to determine whether the current electronic device is in a preset conflict scene. The scene recognition module can recognize a variety of different preset conflict scenes, and when a preset conflict scene is detected and the speaker is occupied, and there is a need for the microphone to collect audio, the audio played by the speaker of the electronic device can be processed, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0016] In a possible implementation of the first aspect, the framework layer of the electronic device includes a scene recognition module; before reducing the playback volume of the speaker or pausing the speaker from playing audio, the method further includes: the scene recognition module detects the speaker and obtains a detection result that the speaker is occupied. Further, the scene recognition module determines, based on the first trigger operation and the detection result, that there is a need for the application to collect audio through a microphone when the speaker is occupied.
[0017] In this solution, a scene recognition module disposed in the frame layer of the electronic device detects the occupied state of the speaker to determine whether the speaker is currently occupied. In this way, the scene recognition module can process the audio played by the speaker of the electronic device in a variety of different preset conflict scenarios when the speaker is occupied and there is a need for the microphone to collect audio, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0018] In a possible implementation of the first aspect, the framework layer of the electronic device includes a conflict handling module; in response to a first trigger operation on a first control, when the speaker is paused from playing audio, pausing the speaker from playing audio may specifically include: the conflict handling module sending a first instruction to the first application. In response to the first instruction, the first application pauses playing and stops sending audio to the speaker.
[0019] In this solution, when it is detected that the electronic device is in a preset conflict scenario and the speaker is occupied, and the second application has a need to collect audio through the microphone, the conflict processing module set in the framework layer of the electronic device controls the first application that is playing audio through the speaker to make the first application pause playing audio. This avoids the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0020] In a possible implementation of the first aspect, the framework layer of the electronic device also includes a conflict handling module; in response to a first trigger operation on a first control to reduce the playback volume of the speaker, reducing the playback volume of the speaker may specifically include: the conflict handling module sends a second instruction to the speaker; in response to the second instruction, the speaker reduces the playback volume.
[0021] In this solution, when it is detected that the electronic device is in a preset conflict scenario and the speaker is occupied, and the second application has a need to collect audio through the microphone, the conflict processing module set in the framework layer of the electronic device controls the volume played by the speaker to make the speaker reduce the playback volume, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0022] In a possible implementation of the first aspect, the above-mentioned display of the first interface of the first application and the second interface of the second application may specifically include: displaying the first interface and the second interface in a split screen; or, displaying the second interface, displaying the first interface in the form of a floating window; or, displaying the second interface, displaying the first interface in the form of a floating ball. In this way, for a variety of display modes such as split-screen display mode, floating window display mode, and floating ball display mode, the electronic device can identify whether it is in a preset conflict scenario. Moreover, in any of the above display modes, when the speaker is occupied and there is a need to collect audio through a microphone, the electronic device can reduce the playback volume of the speaker or pause the speaker from playing audio. Thereby reducing or avoiding the interference and influence of the audio played by the first application through the speaker on the audio collected by the second application using the microphone.
[0023] In a second aspect, an audio playback method is also provided, which is applied to an electronic device including a microphone and a speaker. The method includes: the electronic device displays a first interface of a first application and a second interface of a second application. Among them, the first interface includes a first control for triggering the playback of audio. When the second interface is displayed, the second application collects audio through the microphone. When a trigger operation on the first control displayed on the first interface is detected, it means that the first application has a need to use the speaker to play audio. At this time, if the electronic device is in a preset conflict scenario and the microphone is occupied, the electronic device responds to the trigger operation on the first control and plays the audio from the first application through the speaker at a preset volume. Among them, the preset volume is lower than the preset volume threshold. The electronic device is in a preset conflict scenario, including: the electronic device runs multiple applications in the foreground, and the multiple applications belong to preset applications.
[0024] In this way, if the electronic device detects that the microphone is occupied in a preset conflict scenario and there is a need to play audio through the speaker, the speaker is controlled to play the audio at a lower volume. In this way, the interference and influence of the audio played through the speaker on the audio collected by the microphone can be reduced.
[0025] In a possible implementation of the second aspect, the framework layer of the electronic device includes a scene recognition module; the above-mentioned audio playback method may also include: the scene recognition module obtains window mode information, and the application identifier of the first application and the application identifier of the second application. The scene recognition module determines whether the electronic device is in a preset conflict scene based on the window mode information, and the application identifier of the first application and the application identifier of the second application. Wherein, when the window mode information indicates that the electronic device is running multiple applications in the foreground, and based on the application identifier of the first application and the application identifier of the second application, it is determined that the first application and the second application belong to preset applications, it is determined that the electronic device is in a preset conflict scene.
[0026] In this solution, a scene recognition module arranged in the framework layer of the electronic device judges the scene in which the current electronic device is located to determine whether the current electronic device is in a preset conflict scene. The scene recognition module can recognize a variety of different preset conflict scenes, and when a preset conflict scene is detected and the microphone is occupied, and there is a need for the speaker to play audio, the volume played by the speaker of the electronic device can be controlled, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0027] In a possible implementation of the second aspect, the framework layer of the electronic device includes a scene recognition module; the framework layer of the electronic device includes a scene recognition module; before playing the audio from the first application at a preset volume through the speaker, the method further includes: the scene recognition module detects the microphone and obtains a detection result that the microphone is occupied. The scene recognition module determines, based on the triggering operation of the first control and the detection result, that there is a need for the application to play audio through the speaker when the microphone is occupied.
[0028] In this solution, a scene recognition module disposed in the frame layer of the electronic device detects the occupancy state of the microphone to determine whether the microphone is currently in an occupied state. In this way, the scene recognition module can control the volume played by the speaker of the electronic device in a variety of different preset conflict scenarios when the speaker is occupied and there is a need for the speaker to play audio, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0029] In a possible implementation of the second aspect, the framework layer of the electronic device includes a conflict handling module, and the above-mentioned playing of the audio from the first application at a preset volume through the speaker may specifically include: the conflict handling module sends a first instruction to the speaker; in response to the first instruction and the triggering operation of the first control, the speaker plays the audio from the first application at a preset volume.
[0030] In this solution, when it is detected that the electronic device is in a preset conflict scenario and the microphone is occupied, and the second application has a need to play audio through the speaker, the conflict processing module set in the framework layer of the electronic device controls the volume played by the speaker to make the speaker reduce the playback volume, thereby reducing the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0031] In a possible implementation of the second aspect, the above-mentioned display of the first interface of the first application and the second interface of the second application may specifically include: displaying the first interface and the second interface in a split screen; or, displaying the second interface, displaying the first interface in the form of a floating window; or, displaying the second interface, displaying the first interface in the form of a floating ball. In this way, for a variety of display modes such as split-screen display mode, floating window display mode, and floating ball display mode, the electronic device can identify whether it is in a preset conflict scenario. Moreover, in any of the above display modes, when the microphone is occupied and there is a need to play audio through a speaker, the electronic device can play the audio from the first application through the speaker at a lower preset volume. Thereby reducing or avoiding the interference and influence of the audio played through the speaker on the audio collected by the microphone.
[0032] In a third aspect, an electronic device is provided, including: a processor, a memory, a display screen, a microphone, and a speaker. The memory, the display screen, the microphone, and the speaker are coupled to the processor respectively. The display screen is used to display the interface of the electronic device; the microphone is used to collect audio data; the speaker is used to play audio; the memory is used to store computer-executable instructions, and when the electronic device is running, the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the audio collection method and the audio playback method as described in any one of the first aspects above.
[0033] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer can execute the audio acquisition method and the audio playback method of any one of the above-mentioned first aspects.
[0034] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute the audio acquisition method and audio playback method of any one of the above-mentioned first aspects.
[0035] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.
[0036] Among them, the technical effects brought about by any design method in the third to sixth aspects can refer to the technical effects brought about by different design methods in the first and second aspects, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1A schematic diagram of a display interface of an electronic device provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of a display interface of an electronic device provided in an embodiment of the present application;
[0039] Figure 3 A schematic diagram of a display interface of an electronic device provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0041] Figure 5 A software architecture diagram of an electronic device provided in an embodiment of the present application;
[0042] Figure 6 A flowchart of an audio acquisition method provided in an embodiment of the present application;
[0043] Figure 7 A structural block diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] Some electronic devices have a multi-window display function, which can display two or more windows on the display screen at the same time. Different windows can display different contents respectively.
[0045] Please refer to Figure 1 , the display screen of the mobile phone displays two different windows at the same time. The first window displays the short video application interface 101, which is playing a short video. The second window displays the chat application interface 102, in which the user can trigger the mobile phone to collect and send voice messages.
[0046] In some examples, in response to a user's long press operation on a voice input control 103 in a chat application interface 102, the chat application may collect audio data. Exemplarily, after receiving a user's long press operation on a voice input control 103, the mobile phone may collect audio data and may also display a floating prompt message 104 of "speaking" on the interface. When an operation of the user's finger being moved away from the screen is detected, a voice message is generated and sent based on the collected audio data, and a chat message corresponding to the sent voice message, such as a chat message 105, may be displayed on the interface for the user to view.
[0047] It should be noted that the application involved in the embodiments of the present application collects (or records) audio data, which may specifically refer to the application triggering the microphone of the mobile phone to collect (or record) audio data.
[0048] Since the short video application displayed in the first window is playing a short video while the chat application is collecting audio data, the audio played by the short video application may be recorded in the voice message recorded by the chat application using a microphone. The voice message recorded by the chat application contains the sound of the short video, which will interfere with the user's voice input through the chat application, resulting in unsatisfactory voice message recording effect of the chat application.
[0049] In other examples, such as Figure 2 As shown, the mobile phone also displays a first window and a second window at the same time. Among them, the first window is a floating window, which displays a music playing application interface 201, and the music playing application is playing audition music. The second window displays a chat application interface 202. In the chat application interface 202, the mobile phone will collect audio data in response to the user's voice input operation. Similarly, at this time, the mobile phone will also collect the music sound played by the music playing application into the audio data collected by the chat application, which will interfere with and affect the audio data collected by the chat application.
[0050] Or, in other examples, Figure 3 This is the interface diagram of the foldable screen mobile phone. On the foldable screen mobile phone, different windows can be displayed on the display screen at the same time, and different application contents can be displayed in different windows. Figure 3 In the example shown, when the application displayed in the first window is playing audio, when the application displayed in the second window collects audio data, it may also collect the audio played by the application displayed in the first window.
[0051] Based on this, an embodiment of the present application provides an audio collection method, which can be applied to an electronic device including a microphone and a speaker. In this scheme, the electronic device displays a first interface of a first application, and when the first interface is displayed, the first application plays audio through a speaker. The electronic device also displays a second interface of a second application, and the second interface includes a first control for triggering the recording of audio. In response to the first trigger operation for the first control, the electronic device reduces the playback volume of the speaker or pauses the speaker from playing audio when it detects that the electronic device is in a preset conflict scenario and the speaker is occupied, and collects audio through a microphone. Among them, the preset conflict scenario corresponds to an electronic device running multiple applications in the foreground, and multiple applications belong to preset applications. In this way, when the electronic device runs multiple applications in the foreground at the same time, and multiple applications belong to preset applications, and the speaker is occupied, if there is a need for the microphone to collect audio, it can avoid or reduce the interference of audio played by other applications through the speaker on the audio data collected by the audio collection application, thereby improving the collection effect of audio data.
[0052] In other embodiments, the embodiments of the present application also provide an audio playback method, wherein the electronic device displays a first interface of a first application, and the first interface includes a first control for triggering the playback of audio. The electronic device also displays a second interface of a second application, and when the second interface is displayed, the second application is collecting audio through a microphone. In response to a trigger operation on the first control, if it is detected that the electronic device is in a preset conflict scenario and the microphone is occupied, the audio from the first application is played through the speaker at a lower volume. In this way, the audio played by the first application through the speaker can be minimized, and the interference with the audio data collected by the second application through the microphone can be improved, thereby improving the effect of audio data collection.
[0053] It should be noted that the audio output channels of electronic devices generally include output channels such as speakers, telephone receivers, wired headsets, and Bluetooth A2DP speakers. The audio played by the electronic device through the speaker may be collected by the microphone of the electronic device. Therefore, in an embodiment of the present application, in a preset conflict scenario, if it is detected that the speaker is occupied, it is determined as a scenario where conflict processing needs to be performed; the playback volume of the speaker is reduced or the audio is paused. Alternatively, in a preset conflict scenario, if it is detected that the microphone is occupied, it is also determined as a scenario where conflict processing needs to be performed; for example, the audio is played at a lower volume.
[0054] The audio acquisition method and audio playback method provided in the embodiments of the present application can be applied to an electronic device 100 including a microphone and a speaker. The electronic device may include a display screen, and the above method may be applied to scenes of display modes such as split-screen display mode, floating window, and floating ball. The electronic device may also include two display screens, such as a folding screen electronic device, and the above method may be applied to scenes where the two screens of the folding screen electronic device display different contents at the same time.
[0055] For example, the electronic device 100 may be a mobile phone (eg Figure 1As shown), tablet computers, personal computers (PC), smart screens, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (UMPC), netbooks, smart watches and other wearable devices, artificial intelligence (AI) speakers and vehicle-mounted devices, can also be various teaching aids (such as learning machines, early education machines), smart toys, portable robots, personal digital assistants (PDA), augmented reality (AR)\virtual reality (VR) devices, media players and other devices, can also be devices with mobile office functions, devices with smart home functions, devices with audio and video entertainment functions, devices that support smart travel, etc. The embodiments of the present application do not impose any special restrictions on the specific form of the device.
[0056] like Figure 4 The figure shows a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a microphone 170B, a receiver 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, a camera 192, a display screen 193, and a subscriber identification module (SIM) card interface 194, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.
[0057] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0058] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the audio acquisition method and the audio playback method in the embodiments of the present application.
[0059] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0060] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0061] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.
[0062] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0063] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and an application required for at least one function (such as a sound playback function, an image playback function, etc.).
[0064] In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0065] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
[0066] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 193, the camera 192, and the wireless communication module 160.
[0067] In some other embodiments, the power management module 141 may also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
[0068] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0069] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0070] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0071] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0072] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.
[0073] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.
[0074] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0075] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0076] Microphone 170B, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170B to input the sound signal into microphone 170B. The electronic device 100 can be provided with at least one microphone 170B. In other embodiments, the electronic device 100 can be provided with two microphones 170B, which can not only collect audio signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170B to collect audio signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0077] The receiver 170C, also called a "handset", is used to convert audio electrical signals into sound signals.
[0078] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0079] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 193. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 193, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.
[0080] The touch sensor 180B is also called a "touch panel". The touch sensor 180B can be arranged on the display screen 193, and the touch sensor 180B and the display screen 193 form a touch screen, also called a "touch screen". The touch sensor 180B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 193. In other embodiments, the touch sensor 180B can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 193.
[0081] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0082] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
[0083] The camera 192 is used to capture still images or videos. In some embodiments, the electronic device 100 may include 1 or N cameras 192, where N is a positive integer greater than 1.
[0084] The electronic device 100 implements the display function through a GPU, a display screen 193, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 193 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0085] The display screen 193 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 193 , where N is a positive integer greater than 1.
[0086] The SIM card interface 194 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting or removing the SIM card interface 194. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0087] The audio collection method and the audio playback method in the following embodiments can be implemented in the electronic device 100 having the above hardware structure.
[0088] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0089] Figure 5 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0090] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime, ART), native C / C++ library (native layer), hardware abstraction layer (HAL) and kernel layer.
[0091] The application layer can include a series of application packages.
[0092] like Figure 5 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, game, music, video, chat, etc.
[0093] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0094] like Figure 5 As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, an input manager, a package manager, a scene recognition module, and a conflict handling module, etc.
[0095] The scene recognition module is used to recognize the preset conflict scene. The conflict handling module is used to perform audio conflict operations under the preset conflict scene.
[0096] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
[0097] The Package Manager Service (PMS) is responsible for installing, managing, and uninstalling applications on Android devices. When a new application is installed, the PMS will identify all components of the application and assign corresponding permissions to these components. At the same time, the PMS also monitors the status of installed applications to ensure the integrity and security of the applications.
[0098] Content providers are used to store and retrieve data and make it accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0099] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0100] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0101] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0102] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.
[0103] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.
[0104] The Android runtime includes the core library and the Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly uses the ahead of time (AOT) compilation technology and the just in time (JIT) compilation technology.
[0105] The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks, etc. The core library provides an API for users to develop Android applications.
[0106] The native C / C++ library can include multiple functional modules, such as surface manager, media framework, audio codec module, libc, OpenGL ES, SQLite, Webkit, etc.
[0107] Among them, the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The audio codec module is used to encode and decode audio. OpenGL ES provides drawing and operation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 100.
[0108] The hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer. Among them, the audio module in the HAL layer encapsulates the audio driver in the kernel layer.
[0109] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver. The audio driver in the kernel layer is Figure 4 The driver corresponding to the audio module 170 shown is used to implement communication between the system of the electronic device and the audio module 170 .
[0110] The audio acquisition method and the audio playback method provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0111] Please refer to Figure 6 , which shows a flow chart of the audio acquisition method proposed in some embodiments of the present application.
[0112] The mobile phone can display a first interface of a first application and a second interface of a second interface on a display screen. When the mobile phone displays the first interface of the first application, the first application is playing audio through the speaker of the mobile phone. The second interface of the second application includes a first control for triggering audio recording. Figure 1 In the example shown, the mobile phone displays a first interface and a second interface of a first application in split screen; wherein, in the first interface, the first application is playing a short video, and the second interface includes a voice input control 103 (ie, a first control) for triggering audio recording.
[0113] In some embodiments, some mobile phones support displaying multiple application interfaces simultaneously in a multi-window mode. For example, the mobile phone can display a first window and a second window on the display screen. Further, the mobile phone can display the first interface of the first application in the first window and the second interface of the second application in the second window.
[0114] The mobile phone can display the first window and the second window in response to a preset operation, wherein the preset operation is used to trigger the mobile phone to display multiple windows.
[0115] In some examples, the mobile phone may enter the split-screen display mode in response to the user turning on the split-screen switch. In this example, the preset operation corresponds to the turning on operation of the split-screen switch. In other examples, the mobile phone may enter the split-screen display mode when a preset split-screen gesture is detected. In this example, the preset operation corresponds to the detection of a preset split-screen gesture.
[0116] In other examples, the mobile phone can also display some applications that have obtained floating window display permission in a floating window when the application is exited in a specific scenario. For example, a video player application of the mobile phone is playing a video. At this time, the mobile phone receives an operation such as "return to the desktop", then the mobile phone can display the video being played by the video player application in the floating window and display the desktop at the same time. In this example, the above preset operation corresponds to the exit operation of the application in a preset specific scenario, etc.
[0117] by Figure 1 Taking the scenario shown as an example, the first application may be a short video application, and the second application may be a chat application. The mobile phone may obtain application information that the mobile phone is running in the foreground. For example, the mobile phone may obtain the number of applications running in the foreground of the mobile phone and the application identifiers of each application running in the foreground through a scene recognition module provided in the framework layer. Furthermore, the scene recognition module interface determines whether the current mobile phone is running multiple applications in the foreground based on the information obtained, and whether the multiple applications running in the foreground belong to preset applications. In some embodiments, the mobile phone may mark a scenario in which multiple applications are running in the foreground and the multiple applications running in the foreground belong to preset applications as a preset conflict scenario.
[0118] When a mobile phone runs an application in the foreground, the interface of the running application is usually displayed on the interface. That is to say, when the mobile phone displays multiple windows, each window may correspond to an application interface. Therefore, when the mobile phone displays multiple windows, the mobile phone may be running multiple applications in the foreground at the same time. Therefore, in some embodiments, the mobile phone can also obtain window mode information to help determine the number of applications running in the foreground of the mobile phone, so as to determine whether the mobile phone is currently running multiple applications in the foreground. For example, the scene recognition module of the mobile phone can obtain window mode information through the WMS of the mobile phone, and determine whether it is currently in multi-window mode based on the window mode information.
[0119] In some embodiments, the window mode information may include a single screen display mode, a split screen display mode (such as Figure 1 As shown), floating window display mode (as shown Figure 2 As shown) or floating ball display mode. It can be understood that the above split screen display mode, floating window display mode and floating ball display mode all belong to multi-window mode. In multi-window mode, the mobile phone may run multiple applications in the foreground.
[0120] The mobile phone can determine whether the application running in the foreground belongs to the preset application by obtaining the application ID of the application currently running in the foreground. For example, the scene recognition module of the mobile phone can obtain the application ID of the application currently running in the foreground through the PMS, and identify whether the application running in the foreground belongs to the preset application according to the application ID.
[0121] Furthermore, the preset applications can be divided into preset audio playback applications and preset audio collection applications. Among them, the preset audio playback application can include any one of a video playback application, a short video playback application, a music playback application, a live broadcast application or a game application, and the preset audio collection application can include a chat application, a screen recording application or an office application. In some embodiments, the mobile phone identifies whether the application running in the foreground belongs to the preset application based on the application identifier, which can specifically include: the mobile phone identifies that at least one application of the applications running in the foreground belongs to the preset audio playback application, and at least one application belongs to the preset audio collection application based on the application identifier.
[0122] In some embodiments, the mobile phone can pre-define a preset conflict scenario in the scenario recognition module. The preset conflict scenario is defined as shown in Table 1:
[0123] Table 1
[0124]
[0125]
[0126] In some embodiments, when the audio acquisition application is a screen recording application, the mobile phone can perform audio conflict processing in the following circumstances: the mobile phone runs multiple applications in the foreground, one of which is a screen recording application and the other belongs to an audio playback application. In addition, the audio playback application is using a speaker to play audio, the screen recording application has a need to use a microphone to collect audio, and the screen recording application performs screen recording for the interface of the application in which it is located. Taking the split-screen display mode as an example, the mobile phone displays the interface of the screen recording application and the interface of the audio playback application in the split screen. Among them, the audio playback application is using a speaker to play audio. When the screen recording application has a need to perform screen recording on one of the split-screen interfaces, the mobile phone can control the speaker to lower the playback volume or the speaker to pause the audio. If the screen recording application records the interface of the split screen in which it is located, the user usually hopes to only record the audio played by the speaker of the split-screen interface. If in the split-screen display mode, the screen recording application performs screen recording on the interfaces of two split screens, it may be necessary to record audio. Therefore, in the embodiment of the present application, when the screen recording application only records the interface where the screen recording application is located, the mobile phone can reduce the volume of the audio played by the speaker of the application displayed on another interface, or pause the audio played by the speaker from the application displayed on another interface. Thus, the screen recording can better meet the needs of users and improve the recording effect.
[0127] Furthermore, for different combinations of conflict scenarios, corresponding unique identifiers can be predefined in the scene recognition module. Exemplarily, for a split-screen display mode, a window displays a video playback application, and another window displays a chat application. The corresponding identifier can be defined as 0x01. In this way, when the scene recognition module recognizes that the current scene belongs to one of the preset conflict scenarios, it can determine the unique identifier of the specific corresponding preset conflict scenario. Afterwards, the scene recognition module can carry the unique identifier in the notification message sent to the conflict handling module, so that the conflict handling module can better perform audio conflict handling operations.
[0128] In some embodiments, the above application identifier may specifically refer to the application package name. Figure 1 In the example shown, the mobile phone displays the first interface of the first application and the second interface of the second application at the same time, so the scene recognition module can obtain the first application package name of the first application and the second application package name of the second application from the PMS. Figure 1 The first application in the example is a short video application, so the application corresponding to the first application package name belongs to the preset audio playback application; the second application is a chat application, so the application corresponding to the second application package name belongs to the preset audio collection application.
[0129] In addition, after the mobile phone recognizes that the mobile phone is currently in a preset conflict scenario, the mobile phone can also detect the usage of the speaker. For example, the scene recognition module of the mobile phone detects the usage of the speaker to obtain a detection result.
[0130] In some examples, the scene recognition module can directly apply to obtain the usage of the speaker. Specifically, the scene recognition module can send a first query request to the first application, and the first application responds to the first query request and returns the usage of the speaker by the first application to the scene recognition module. The scene recognition module can send a second query request to the second application, and the second application responds to the second query request and returns the usage of the speaker by the second application to the scene recognition module. Among them, the usage of the speaker by the application can specifically represent whether the application is using the speaker to play audio.
[0131] In other examples, the scene recognition module can also obtain the usage of the speaker by the first application and the second application through the audio codec module in the native layer. Exemplarily, the scene recognition module sends a third query request to the audio codec module, and the audio module obtains and sends the usage of the speaker to the scene recognition module in response to the third query request. The scene recognition module can determine whether the current speaker is occupied based on the usage of the speaker. Among them, the usage of the speaker may specifically include the usage status of the speaker (including occupied status and idle status). When the speaker is in an occupied state, the usage of the speaker may also include the current user of the speaker, such as the first application.
[0132] In some embodiments, the mobile phone can simultaneously determine whether the mobile phone is in a preset conflict scenario and the occupancy status of the speaker. In other embodiments, the mobile phone can also first identify whether the mobile phone is in a preset conflict scenario. After determining that the current mobile phone is in a preset conflict scenario, the occupancy status of the speaker is detected. Alternatively, in other embodiments, the mobile phone can also first detect whether the speaker is occupied, and then determine whether the mobile phone is in a preset conflict scenario. In the embodiments of the present application, the order of detecting the preset conflict scenario and the occupancy status of the speaker is not limited.
[0133] From the above description, it can be seen that the second interface of the second application displayed on the mobile phone includes a first control for triggering the recording of audio. If the mobile phone receives a first trigger operation for the first control, it means that the second application of the mobile phone has a need to collect audio through the microphone. In addition, the current mobile phone also displays the first interface of the first application, and the picture displayed on the first interface indicates that the first application is playing audio through the speaker. Therefore, in order to reduce and avoid the interference and influence of the audio played by the speaker on the audio collected by the microphone, while collecting audio in response to the above-mentioned first trigger operation, the mobile phone can control and adjust the audio played by the speaker. Figure 1 In the example shown, when the mobile phone receives the first trigger operation for the voice input control 103, it can be determined that it is currently in a preset conflict scenario and the speaker is occupied by the short video application (corresponding to the first application), and the audio played by the speaker can be controlled at this time. Specifically, in the above scenario, the playback volume of the speaker can be reduced or the speaker can be paused from playing audio.
[0134] When it is detected that the phone is currently in a preset conflict scenario and the speaker is occupied, in response to a first trigger operation on the first control, the scene recognition module of the phone can send a notification message to the conflict processing module of the phone to notify the conflict processing module to process the audio conflict.
[0135] In other embodiments, the scene recognition module may not detect the first trigger operation for the first control, but the second application is already collecting audio through the microphone. In this case, conflict handling can also be performed. In this embodiment, the scene recognition module can send a notification message to the conflict handling module when a preset conflict scene is detected, and the speaker is occupied by one of the applications and the microphone is occupied by another application. The conflict handling module then responds to the notification message and performs conflict handling.
[0136] In some embodiments, the conflict handling module handles the audio conflict, and specifically can control the speaker to reduce the playback volume. In this way, reducing the playback volume of the speaker can reduce the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0137] Further, in some embodiments, after receiving the notification message, the conflict handling module can send a first instruction to the application that is playing the audio (hereinafter referred to as the audio playing application, i.e., the first application in this embodiment) in response to the notification message. The audio playing application responds to the first instruction to pause the playing and stop sending the audio to the speaker. In this way, the first application stops sending the audio to the speaker, so that the speaker can pause playing the audio from the first application.
[0138] In other embodiments, the conflict handling module handles the audio conflict and can also control the speaker to pause playing the audio. In this way, pausing the audio played by the speaker can avoid the interference and influence of the audio played by the speaker on the audio collected by the microphone.
[0139] Furthermore, the conflict handling module may send a second instruction to the speaker to instruct the speaker to lower the playback volume of the audio playback application, so as to reduce the interference and influence of the audio played by the audio playback application on the audio data collected by the audio collection application, and improve the effect of audio collection by the audio collection application.
[0140] In some embodiments, after receiving the notification message from the scene recognition module, the conflict handling module can first determine whether the audio playback application meets the preset pause condition in response to the notification message. Then determine the way to perform audio conflict handling according to the judgment result. It can be understood that if the audio playback application meets the preset pause condition, the conflict handling module can control the application to pause playing audio through the speaker. If the audio playback application does not meet the preset pause condition, the conflict handling module can reduce the playback volume of the application through the speaker.
[0141] In some embodiments, the preset pause condition may specifically refer to whether the application content displayed by the audio playback application includes a dynamic picture. Figure 1 In the example shown, the first application is playing a short video, and the application content displayed in the first window includes a dynamic video screen, that is, a dynamic screen. Therefore, in this example, the audio playback application does not meet the preset pause condition.
[0142] In some other embodiments, the preset pause condition may also refer to whether the audio playback application is a local application. It should be noted that the local application supports the conflict handling module to control its pause playback. In some embodiments, the local application may refer to the application installed by the mobile phone when it leaves the factory; the non-local application may refer to a third-party application installed by the mobile phone. Figure 1 In the example shown, the first application is a short video application, which is a third-party application and not a local application. Therefore, in this example, the audio playback application does not meet the preset pause condition.
[0143] Or, in other embodiments, the mobile phone can pre-set applications that are allowed to be suspended, such as setting a preset suspension whitelist, and setting the applications that are allowed to be suspended in the preset suspension whitelist. For example, the identification of the application that is allowed to be suspended is added to the preset suspension whitelist. When the conflict handling module identifies whether the audio playback application meets the preset suspension condition, it can be determined whether the current audio playback application belongs to the whitelist, such as querying whether the identification of the current audio playback application is included in the preset suspension whitelist. If the current audio playback application belongs to the preset suspension whitelist, it means that the audio playback application is allowed to be suspended. That is to say, the current audio playback application meets the preset suspension condition. At this time, the conflict handling module can decide the audio conflict handling method executed on the audio playback application according to the judgment result.
[0144] Alternatively, in some other embodiments, the preset pause condition may also include: whether the application content of the audio playback application includes dynamic images, and whether the audio playback application is a local application. In this embodiment, the mobile phone may determine that the audio playback application meets the preset pause condition when the audio playback application is a local application and the application content displayed by the audio playback application does not include dynamic images.
[0145] Alternatively, in other embodiments, the preset pause condition may also include whether the application content of the audio playback application includes dynamic images and whether the audio playback application belongs to the preset pause whitelist. In this embodiment, the mobile phone may determine that the audio playback application meets the preset pause condition when the application content displayed by the audio playback application does not include dynamic images and the audio playback application belongs to the preset pause whitelist.
[0146] In the example where the scene recognition module labels the identified conflict scenes with unique identifiers, since various preset conflict scenes are pre-defined in the scene recognition module, the audio playback applications belonging to the preset conflict scenes are also defined. Usually, when an audio playback application plays audio through a speaker, whether the audio playback application meets the preset pause condition is fixed. Therefore, in some embodiments, the mobile phone can also define in the conflict handling module which audio playback applications in the preset conflict scenes meet the preset pause condition when the speaker is playing audio. In this way, after receiving the notification message from the scene recognition module, the conflict handling module can identify the scene identifier from the notification message, and then determine whether the audio playback application in the corresponding preset conflict scene meets the preset pause condition based on the scene identifier.
[0147] Exemplarily, after the scene recognition module recognizes that the current display mode is split-screen, one window displays a video playback application, and the other window displays a chat application, it determines that the corresponding scene identifier is 0x01. And when it is determined that the speaker is occupied, the scene recognition module can send a notification message carrying 0x01 to the conflict handling module. After receiving the notification message, the conflict handling module parses the notification message to obtain the scene identifier 0x01. The conflict handling module determines through matching that the audio playback application corresponding to the scene identifier is a video playback application, and determines whether the video playback application meets the preset pause condition. Taking the preset pause condition including whether the interface currently displayed by the application includes a dynamic picture as an example, since the video playback application is playing audio through the speaker, the conflict handling module can determine that the video playback application is playing a video picture, and thus does not meet the preset pause condition.
[0148] Afterwards, the conflict handling module can directly determine the way to perform audio conflict handling based on the matching result. Since the audio playback application corresponding to the scene identifier 0x01 is specifically a video playback application, the video playback application does not meet the preset pause condition when playing audio using the speaker, so the conflict handling module can control the speaker to reduce the playback volume.
[0149] In other embodiments, if the conflict handling module determines based on the scene identifier that the audio playback application corresponding to the current scene meets the preset pause condition when playing audio using the speaker, the conflict handling module can control the speaker to pause playing the audio from the audio playback application.
[0150] It can be understood that the above-mentioned preset pause conditions are only examples. In other embodiments, the preset pause conditions can also be set to other judgment conditions according to actual conditions.
[0151] In the technical solution provided in the embodiment of the present application, the mobile phone can determine whether the audio playback application meets the preset pause condition in different ways under the preset conflict scenario and the speaker is occupied, so that a better way to handle the audio conflict can be selected for different situations in the future.
[0152] Furthermore, if the audio playback application meets the preset pause condition, it means that the audio playback application allows the audio playback application to be paused. Therefore, the conflict handling module can send a first instruction to the audio playback application to instruct the audio playback application to pause the playback. This is to avoid the interference and influence of the audio played by the speaker on the audio data collected by the application (hereinafter referred to as the audio collection application) that is collecting audio with the microphone, and improve the effect of the audio collected by the audio collection application.
[0153] Specifically, taking the case where the preset pause condition includes whether the application content of the audio playback application includes dynamic images, when the audio playback application satisfies the preset pause condition, the conflict handling module sends a first instruction to the audio playback application. In response to the first instruction, the audio playback application pauses playing the audio and stops sending audio to the speaker. Since the application content displayed by the audio playback application does not include dynamic images, the audio played by the audio playback application is paused, and the audio playback application will not have the problem of audio and video being out of sync. In addition, pausing the audio played by the audio playback application can also avoid the interference and influence of the audio played by the audio playback application on the audio data collected by the audio acquisition application, thereby improving the effect of the audio collected by the audio acquisition application.
[0154] If the audio playback application does not meet the preset pause condition, it means that the audio playback application is not allowed to be paused. Therefore, the conflict handling module can send a second instruction to the speaker to instruct the speaker to lower the playback volume. Figure 1 , taking the example of whether the preset pause condition includes whether the application content of the audio playback application includes dynamic pictures. Figure 1 In the example shown, the audio playback application is the first application, and the audio acquisition application is the second application. Since the first application includes a dynamic picture, that is, the first application does not meet the preset pause condition. Therefore, in this example, the conflict handling module sends a second instruction to the speaker to instruct the speaker to reduce the playback volume of the audio from the first application.
[0155] Further, after the conflict handling module performs the processing operation of the audio conflict, the scene recognition module can also continue to monitor the use of the microphone and the speaker by the audio playback application and the audio collection application. When it is detected that the audio collection application stops using the microphone, it means that the audio collection application no longer needs to collect audio data. In other words, the conflict between audio playback and audio collection has ended, and the conflict handling module can revoke the audio conflict processing at this time. Specifically, in an embodiment in which the audio playback application is controlled to pause playing audio in response to a first trigger operation, the mobile phone can restore the audio played by the audio playback application (i.e., the first application) through the speaker when detecting a sound reception exit event for the audio collection application. In an embodiment in which the playback volume of the audio playback application is reduced in response to the first trigger operation control, the mobile phone can increase the playback volume of the audio played by the audio playback application (i.e., the first application) through the speaker when detecting a sound reception exit event for the audio collection application, for example, and restore it to the original volume.
[0156] In some examples, when the conflict handling module responds to the first trigger operation on the first control and pauses the speaker from playing audio, when the scene recognition module detects a sound exit event for the second application, the conflict handling module of the mobile phone can be notified to send a third instruction to the first application to instruct the first application to resume playing. Alternatively, when the conflict handling module responds to the first trigger operation on the first control and lowers the playback volume of the speaker, when the scene recognition module detects a sound exit event for the second application, the conflict handling module can be notified to send a fourth instruction to the speaker to instruct the speaker to increase the playback volume of the first application. In some examples, the speaker can restore the playback volume to the original volume in response to the fourth instruction. In this way, it can be ensured that after the audio conflict in multi-window mode ends, the first application can resume the effect of playing audio through the speaker normally.
[0157] In some embodiments, the first control of the second interface can also be used to trigger the stop of audio recording. In this embodiment, the audio recording exit event can specifically correspond to the second trigger operation of the first control.
[0158] In some other embodiments, the second interface may further include a second control for triggering to stop recording audio. In this embodiment, the above-mentioned audio recording exit event may specifically correspond to a third trigger operation for the second control.
[0159] In other embodiments, the mobile phone may also monitor the occupancy of the microphone after lowering the playback volume of the speaker or pausing the speaker from playing audio in response to the first trigger operation. For example, when the scene recognition module detects that the occupancy of the microphone has changed from occupied to released, it indicates that the audio collection application has exited the use of the microphone and no longer collects audio through the microphone. In this embodiment, the above-mentioned sound collection exit event may also correspond to the microphone being released.
[0160] In some embodiments, the mobile phone runs multiple applications in the foreground, and it is also possible to display only the interface of one of the applications. For example, the mobile phone runs a music player application and a chat application in the foreground. And the music player application is playing audio through a speaker. It can be seen from the description of the above embodiment that the music player application and the chat application are both preset applications. In other words, the current scene belongs to the preset conflict scene, and the speaker is occupied by the music player application. Therefore, in this scenario, if the mobile phone detects a first trigger operation on the first control for triggering audio recording in the corresponding interface of the chat application, in response to the first trigger operation, the playback volume of the speaker can also be reduced or the speaker can be paused from playing audio.
[0161] In the technical solution provided in the embodiment of the present application, when it is detected that the mobile phone is in a preset conflict scenario and the speaker is occupied by an application, if a trigger operation of another application to collect audio through a microphone is detected, then for the trigger operation of collecting audio, the mobile phone can reduce the playback volume of the speaker or pause the speaker from playing audio. In this way, multiple applications can be run in the foreground of the mobile phone, reducing the interference and influence of the audio being played by one application through the speaker on the audio collected by another application through the microphone, thereby improving the audio collection effect. In addition, since the embodiment of the present application adds a scene recognition module and a conflict processing module to the framework layer, it belongs to a system-level processing solution under a preset conflict scenario, which can identify a variety of different preset conflict scenarios and better protect the effect of audio collection under the preset conflict scenario.
[0162] It can be understood that the audio collection method described in the above embodiment is aimed at handling the problem of audio conflict when the first application of the mobile phone is playing audio through the speaker and detects that the second application has the need to collect audio through the microphone. In other embodiments, the mobile phone may also detect that the first application has the need to play audio through the speaker while the second application is continuously collecting audio through the microphone.
[0163] In some examples, the second application can specifically be a screen recording application. In response to a screen recording trigger operation displayed for the second application, the mobile phone can start recording the screen image of the interface of the second application. When recording the screen image, the screen recording application can choose to record the audio played by the mobile phone. Still taking the first application as an example of a video playback application, in some scenarios, it is possible that the interface displayed by the second application is recording the screen, and the user wants to play the video through the first application. That is, while the interface displayed by the second application is recording the screen, in response to a trigger operation (i.e., a video playback operation) for a first control displayed by the first application for triggering video playback, the mobile phone can start displaying the video image on the interface of the second application. It can be understood that if the played video has sound, the mobile phone will also play the audio synchronously.
[0164] It can be seen from the above description that when multiple applications are running in the foreground of the mobile phone, the audio played by one of the audio playback applications may be collected into the audio data by the audio collection application, thereby interfering with and affecting the sound collection. Therefore, when it is detected that the application displayed in the second window is collecting audio, in response to the video playback operation for the application displayed in the first window, the mobile phone can play the audio in the video through the speaker at a lower preset volume. Among them, the preset volume is lower than the preset volume threshold, and the preset volume threshold can be set to a lower value. In this way, the interference and influence of the audio played in the first window on the audio data collected by the screen recording application in the second window can be reduced under the premise of satisfying the user's intention to play the video (audio) in the first window.
[0165] In some embodiments, the above-mentioned audio playback method can also be detected by the scene recognition module whether the current mobile phone is in a preset conflict scene, and detect the occupancy of the microphone. Further, when it is detected that the current scene is in a preset conflict scene and the microphone is occupied by the second application, the scene recognition module can send a notification message to the conflict handling module in response to the triggering operation of the first control of the first application. In some embodiments, after receiving the notification message, the conflict handling module can send a first instruction to the speaker in response to the notification message. In response to the first instruction, the speaker plays the audio played by the first application at a preset volume.
[0166] It should be noted that the specific implementation of the above audio playback method involving the process of identifying whether it is in a preset conflict scene, detecting the occupancy status of the microphone and the speaker, etc., can be specifically referred to the description of the embodiment of the above audio acquisition method.
[0167] Some other embodiments of the present application provide an electronic device, which may be the above-mentioned mobile phone. The electronic device may include: a processor, a memory, a display screen, a microphone and a speaker. Among them, the memory, the display screen, the microphone and the speaker are respectively coupled to the processor. The display screen is used to display the interface of the electronic device; the microphone is used to collect audio data; the speaker is used to play audio. The memory is also used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various functions or steps executed by the mobile phone in the above-mentioned method embodiment. The structure of the electronic device can refer to Figure 4 The structure of the electronic device 100 is shown.
[0168] The present application also provides a chip system, such as Figure 7As shown, the chip system 70 includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 can be interconnected via lines. For example, the interface circuit 702 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 702 can be used to send signals to other devices (such as processor 701). Exemplarily, the interface circuit 702 can read instructions stored in the memory and send the instructions to the processor 701. When the instruction is executed by the processor 701, the electronic device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0169] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as a mobile phone), the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.
[0170] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment. The computer may be an electronic device, such as a mobile phone.
[0171] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0172] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0173] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0174] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0175] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0176] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. An audio acquisition method, characterized in that: The method is applied to an electronic device, wherein the electronic device includes a microphone and a speaker; the method includes: displaying a first interface of a first application and a second interface of a second application, wherein the second interface includes a first control for triggering recording audio; when the first interface is displayed, the first application plays audio through the speaker; In response to a first trigger operation on the first control, if the electronic device is in a preset conflict scenario and the speaker is occupied, lowering the playback volume of the speaker or pausing the speaker from playing audio, and collecting audio through the microphone; The electronic device being in the preset conflict scenario includes: the electronic device running multiple applications in the foreground, and the multiple applications are preset applications.
2. The method according to claim 1, characterized in that In the case where the playback volume of the speaker is reduced in response to the first triggering operation on the first control, the method further includes: The first control is also used to trigger the stop of audio recording, and in response to a second trigger operation on the first control, stop collecting audio through the microphone and increase the playback volume of the speaker; Alternatively, the second interface also includes a second control for triggering the stop of audio recording; in response to a third trigger operation on the second control, the audio collection through the microphone is stopped, and the playback volume of the speaker is increased.
3. The method according to claim 1, characterized in that In response to a first trigger operation on the first control, in a case where the speaker is paused from playing audio, the method further includes: The first control is also used to trigger the stop of audio recording, and in response to a second trigger operation on the first control, stop collecting audio through the microphone and resume playing audio through the speaker; or, The second interface also includes a second control for triggering the stop of audio recording; in response to a third trigger operation on the second control, the audio collection through the microphone is stopped, and the audio playing through the speaker is resumed.
4. The method according to any one of claims 1 to 3, characterized in that When the first application meets a preset pause condition, as a response to the first trigger operation, pausing the speaker from playing audio; or, In a case where the first application does not satisfy the preset pause condition, as a response to the first trigger operation, reducing the playback volume of the speaker; The preset pause condition includes at least one of the following: whether the interface currently displayed by the application includes a dynamic picture, whether the application is a local application, or whether the application belongs to a preset pause whitelist.
5. The method according to any one of claims 1 to 4, characterized in that The framework layer of the electronic device includes a scene recognition module; the method further includes: The scene recognition module acquires window mode information, an application identifier of the first application, and an application identifier of the second application; The scene recognition module determines whether the electronic device is in the preset conflict scene according to the window mode information, the application identifier of the first application, and the application identifier of the second application; Among them, when the window mode information indicates that the electronic device is running multiple applications in the foreground, and based on the application identifier of the first application and the application identifier of the second application, it is determined that the first application and the second application belong to the preset application, it is determined that the electronic device is in the preset conflict scenario.
6. The method according to any one of claims 1 to 4, characterized in that The framework layer of the electronic device includes a scene recognition module; before reducing the playback volume of the speaker or pausing the speaker from playing audio, the method further includes: The scene recognition module detects the speaker and obtains a detection result that the speaker is occupied; The scene recognition module determines, according to the first trigger operation and the detection result, that there is an application that needs to collect audio through the microphone when the speaker is occupied.
7. The method according to any one of claims 1 to 6, characterized in that The framework layer of the electronic device includes a conflict handling module; In the case where the speaker is paused from playing audio in response to a first trigger operation on the first control, the step of pausing the speaker from playing audio includes: The conflict handling module sends a first instruction to the first application; In response to the first instruction, the first application pauses playing and stops sending audio to the speaker.
8. The method according to any one of claims 1 to 6, characterized in that The framework layer of the electronic device also includes a conflict handling module; In the case where the playback volume of the speaker is reduced in response to a first trigger operation on the first control, reducing the playback volume of the speaker includes: The conflict handling module sends a second instruction to the speaker; In response to the second instruction, the speaker reduces the playback volume.
9. The method according to any one of claims 1 to 8, characterized in that The displaying of the first interface of the first application and the second interface of the second application includes: Displaying the first interface and the second interface on a split screen; Alternatively, the second interface is displayed, and the first interface is displayed in a floating window; Alternatively, the second interface is displayed, and the first interface is displayed in the form of a floating ball.
10. An audio playing method, characterized in that: The method is applied to an electronic device, wherein the electronic device includes a microphone and a speaker; the method includes: Displaying a first interface of a first application and a second interface of a second application, wherein the first interface includes a first control for triggering audio playback; when the second interface is displayed, the second application collects audio through the microphone; In response to a triggering operation on the first control, if the electronic device is in a preset conflict scenario and the microphone is occupied, playing the audio from the first application through the speaker at a preset volume; the preset volume is lower than a preset volume threshold; The electronic device being in the preset conflict scenario includes: the electronic device running multiple applications in the foreground, and the multiple applications are preset applications.
11. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, a display screen, a microphone and a speaker; the memory, the display screen, the microphone and the speaker are respectively coupled to the processor; The display screen is used to display the interface of the electronic device; the microphone is used to collect audio data; the speaker is used to play audio; the memory stores computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-10.
12. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 10.