Audio playing method, device and computer readable storage medium
Patent Information
- Application Number
- CN202111287915.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2041-11-02
AI Technical Summary
[0003]然而,用户在直播过程中经常会出现声音闪避的情况,声音闪避是当前直播应用在使用麦克风时,系统会压低其他应用的系统音量的现象
[0017]This application embodiment acquires system audio data input from the system audio input component; when the virtual audio driver in the system starts, it intercepts the system audio data input from the system audio input component; it processes the audio parameters of the intercepted system audio data to obtain processed audio data; and it sends the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. In this way, by intercepting and processing the system audio data input from the system audio input component through the virtual audio driver, and then sending the processed audio data to the system audio output component for playback, the sound ducking phenomenon that occurs in the prior art is avoided, ensuring normal playback of audio data and thus improving the efficiency of audio data playback.
Smart Images

Figure CN116074688B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, specifically to an audio playback method, apparatus, and computer-readable storage medium. Background Technology
[0002] With the rapid development of internet technology, live streaming scenarios based on the internet are becoming increasingly common in users' daily lives, such as online teaching through live streaming applications.
[0003] However, users often experience audio ducking during live streams. Audio ducking occurs when the live streaming application lowers the system volume of other applications while the microphone is being used. This ducking prevents users from properly accessing the system audio from other applications, affecting the normal playback of system audio data during the live stream and resulting in lower audio playback efficiency. Summary of the Invention
[0004] This application provides an audio playback method, apparatus, and computer-readable storage medium, which can ensure the normal playback of system audio data during live streaming, thereby improving the efficiency of audio playback.
[0005] This application provides an audio playback method, including: Acquire system audio data input from the system audio input component, wherein the system audio input component is the audio input component currently used by the system; When the virtual audio driver in the system starts, it intercepts the system audio data input by the system audio input component. The virtual audio driver is a pre-created audio driver. The audio parameters of the intercepted system audio data are processed to obtain the processed audio data; The processed audio data is sent to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. The system audio output component is the audio output component currently used by the system.
[0006] Accordingly, embodiments of this application provide an audio playback device, including: The acquisition unit is used to acquire system audio data input by the system audio input component, wherein the system audio input component is the audio input component currently used by the system. An interception unit is used to intercept system audio data input by the system audio input component when the virtual audio driver in the system starts, wherein the virtual audio driver is a pre-created audio driver. The processing unit is used to process the audio parameters of the intercepted system audio data to obtain processed audio data. The sending unit is used to send the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. The system audio output component is the audio output component currently used by the system.
[0007] In one embodiment, the interception unit includes: The switching subunit is used to switch the audio output component currently used by the system to the virtual audio driver. A subunit is created to create a virtual audio component through the virtual audio driver, wherein the virtual audio component is a component of an analog audio device; The interception subunit is used to intercept system audio data input by the system audio input component based on the virtual audio component.
[0008] In one embodiment, the processing unit includes: The calling sub-unit is used to call the attribute parameter retrieval interface and process the attribute based on the retrieval result. The adjustment subunit is used to adjust the audio parameters of the intercepted system audio data according to the parameter processing attributes to obtain processed audio data.
[0009] In one embodiment, the adjustment subunit includes: The configuration module is used to configure the attributes of the virtual audio component according to the parameter processing attributes; The audio parameter adjustment module is used to adjust the audio parameters of the intercepted system audio data through the configured virtual audio component to obtain processed audio data.
[0010] In one embodiment, the audio playback device further includes: The determining unit is used to obtain the initial volume value of the system audio output component before the virtual audio driver is started, and to determine the target volume value based on the initial volume value; The playback unit is used to play the processed audio data based on the target volume value.
[0011] In one embodiment, the determining unit includes: The comparison subunit is used to compare the initial volume value with a preset volume threshold, and determine the system volume value and the drive volume value based on the comparison result. The calculation subunit is used to calculate the target volume value based on the system volume value and the drive volume value.
[0012] In one embodiment, the audio playback device further includes: The acquisition unit is used to acquire external input audio data when it receives an audio mixing request for the processed audio data; The preprocessing unit is used to preprocess the processed audio data to obtain target system audio data, and to preprocess the external input audio data to obtain target external audio data. The synthesis unit is used to synthesize the target system audio data and the target external audio data to obtain mixed audio data, and to push the mixed audio data.
[0013] In one embodiment, the data preprocessing unit includes: The caching subunit is used to cache the processed audio data and the externally input audio data into the audio data storage pool, respectively. The first adjustment subunit is used to adjust the processed audio data in the audio data storage pool according to preset processing parameters to obtain the target system audio data. The second adjustment subunit is used to adjust the external input audio data in the audio data storage pool according to preset processing parameters to obtain the target external audio data.
[0014] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the audio playback methods provided in embodiments of this application.
[0015] Furthermore, this application also provides a computer device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the audio playback method provided in this application.
[0016] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the audio playback method provided in this application.
[0017] This application embodiment acquires system audio data input from the system audio input component; when the virtual audio driver in the system starts, it intercepts the system audio data input from the system audio input component; it processes the audio parameters of the intercepted system audio data to obtain processed audio data; and it sends the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. In this way, by intercepting and processing the system audio data input from the system audio input component through the virtual audio driver, and then sending the processed audio data to the system audio output component for playback, the sound ducking phenomenon that occurs in the prior art is avoided, ensuring normal playback of audio data and thus improving the efficiency of audio data playback. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram illustrating an implementation scenario of an audio playback method provided in this application. Figure 2 This is a flowchart illustrating an audio playback method provided in an embodiment of this application; Figure 3 This is a schematic diagram illustrating the implementation process of a virtual audio driver for an audio playback method provided in an embodiment of this application; Figure 4 This is a schematic diagram of the target volume value determination process of an audio playback method provided in an embodiment of this application; Figure 5a This is a schematic diagram of the audio mixing process of an audio playback method provided in an embodiment of this application; Figure 5b This is a schematic diagram of mixed audio data sharing in an audio playback method provided in an embodiment of this application; Figure 6 This is another schematic flowchart of an audio playback method provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of the audio playback device provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] This application provides an audio playback method, apparatus, and computer-readable storage medium. The audio playback apparatus can be integrated into a computer device, which may be a server or a terminal, etc.
[0022] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or other device capable of audio playback, but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this connection.
[0023] For better illustration of the embodiments of this application, please refer to the following terms: Driver: A computer software term referring to a program that drives the software in a computer. A driver, or device driver, is a special program added to the operating system that contains information about a hardware device. This information enables the computer to communicate with the corresponding device. Drivers are configuration files written by hardware manufacturers according to the operating system; without drivers, the hardware in a computer cannot function.
[0024] Audio driver: An audio device is a driver program on a computer, mainly including sound cards, audio decoders, CD drives, etc. For these devices to function properly, drivers are required, collectively called audio device drivers. Their main function is to ensure sound is produced when users listen to music, watch movies, or play audio / video discs on their computers.
[0025] Please see Figure 1 Taking the integration of audio playback devices into electronic devices as an example, Figure 1This is a schematic diagram of an implementation scenario for the audio playback method provided in this application. The electronic device can be a terminal, which can acquire system audio data input by the system audio input component. When the virtual audio driver in the system is started, the virtual audio driver is used to intercept the system audio data input by the system audio input component. The audio parameters of the intercepted system audio data are processed to obtain processed audio data. The processed audio data is sent to the system audio output component via the virtual audio driver so that the system audio output component can play the processed audio data.
[0026] It should be noted that, Figure 1 The illustrated implementation environment scenario of the audio playback method is merely an example. The implementation environment scenario of the audio playback method described in this application embodiment is for the purpose of more clearly illustrating the technical solution of this application embodiment and does not constitute a limitation on the technical solution provided in this application embodiment. Those skilled in the art will understand that with the evolution of audio playback and the emergence of new business scenarios, the technical solution provided in this application is also applicable to similar technical problems.
[0027] With the rapid development of internet technology, live streaming has become increasingly common in users' daily lives. For example, streamers can promote activities and sell various products online, teachers can conduct online classes, and students can attend classes online. With the diversification of social situations, such as the pandemic, online education has become increasingly important.
[0028] However, users often experience audio ducking during live streaming. Audio ducking occurs when the live streaming application lowers the system volume of other applications while using the microphone. This phenomenon prevents users from properly acquiring system audio from other applications during live streaming, failing to meet the needs of scenarios where users require simultaneous audio from the microphone and other applications. This affects the normal playback of system audio data during live streaming, resulting in low audio playback efficiency. To address these issues, this application provides an audio playback method that intercepts system audio data to avoid the audio ducking phenomenon found in existing technologies, ensuring normal audio playback and thus improving audio playback efficiency.
[0029] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0030] This embodiment will be described from the perspective of an audio playback device, which can be integrated into a computer device, which can be a terminal, and this application does not limit it.
[0031] Please see Figure 2 , Figure 2 This is a flowchart illustrating the audio playback method provided in an embodiment of this application. The audio playback method includes: In step 101, the system audio data input by the system audio input component is obtained.
[0032] The system audio input component can be the currently used audio input component of the system, used to acquire and play system audio data. Correspondingly, the system also has a system audio output component, which can play the system audio data acquired and input by the system audio input component. The system audio input and output components can be integrated into a single audio device or into different audio devices. For example, the system audio input and output components can be the audio input module and audio output module of an audio output device. The system audio output device can be a device that converts audio data stored on a computer device into sound after digital-to-analog conversion and noise filtering, and is used to play the system audio data. The system audio output device can include an audio input component and an audio output component; the audio input component is used to acquire system audio data, and the audio output component is used to play the system audio data acquired and input by the audio input component.
[0033] The system can be an operating system such as macOS, which can be a graphical operating system based on a hybrid kernel of the Darwin OS (XNU).
[0034] The system audio data can be acquired internally by the system and provided to at least one application installed on the system, or it can be provided to the system from external or internal storage devices; there is no limitation on this. The system audio data can generate system sounds, such as sounds generated by playing music or video through applications on the system, message notification sounds when applications receive messages, or prompt sounds generated by the system in response to user-triggered actions. For example, if a user adjusts the volume of the system speaker via a terminal, the system can generate and play a prompt sound to acknowledge the completion of the adjustment.
[0035] Therefore, to achieve audio data playback, the system audio data obtained from the system audio input component can be used to obtain the system audio data input to the system audio input component. In one specific implementation, the system audio data input to the system audio input component can be filtered according to different data sources. For example, when the system audio data includes audio data from multiple applications, the audio data from different applications can be filtered according to actual needs. For instance, assuming the system audio data includes audio data from applications A, B, and C, when it is necessary to play the audio data from applications A and C, the audio data from applications A and C can be filtered out according to the source of the audio data for subsequent playback.
[0036] In step 102, when the virtual audio driver in the system starts, the virtual audio driver is used to intercept the system audio data input by the system audio input component.
[0037] The virtual audio driver can be a pre-created audio driver (Device) that can be pre-installed on the system. This installed virtual audio driver can create virtual devices and use these virtual devices to simulate audio devices, thereby intercepting system audio data.
[0038] Optionally, the implementation process of this virtual audio driver can be referenced. Figure 3 , Figure 3 This is a schematic diagram illustrating the implementation flow of a virtual audio driver for an audio playback method provided in this application embodiment. The method utilizes the system's underlying Application Programming Interface (API) to execute interface functions such as Create Device, Start IO, Will Do IO, Begin IO, End IO, Stop IO, and Destroy Device. Repeated input / output operations are performed between the Start and End IO operations to acquire system audio data. This allows the virtual audio driver to create a virtual device to intercept system audio data. The virtual device can then simulate an audio device based on the capabilities provided by these interface functions.
[0039] In this embodiment, a virtual audio driver can be created in the system in advance, and then the virtual audio driver can be used to intercept the system audio data input by the system audio input component when the virtual audio driver starts in the system.
[0040] Optionally, the system's currently used audio output component can be switched to a pre-created virtual audio driver to intercept system audio data input from the system audio input component that was originally intended for transmission to the system audio output component. Specifically, a virtual device created by the virtual audio driver can be used to acquire system audio data. The system's currently used audio output component can be switched to a virtual audio driver, which can then create a virtual audio component. This virtual audio component can be a component simulating an audio device for acquiring system audio data. The virtual audio component can be a virtual device created by the virtual audio driver. Specifically, a virtual audio component, or virtual device, can be created by the virtual audio driver. This virtual device can then perform a polling message loop between the start and end of input / output operations to continuously intercept, acquire, and process the system audio data that needs to be routed for transmission.
[0041] In step 103, the audio parameters of the intercepted system audio data are processed to obtain processed audio data.
[0042] The audio parameters can include information such as sampling rate, bit rate, number of audio tracks, and volume. In order to enable normal playback of the intercepted audio data, the audio parameters of the intercepted system audio data can be processed to obtain the processed audio data.
[0043] Optionally, an attribute parameter retrieval interface can be called, and parameter processing attributes can be obtained based on the call result. These attribute processing attributes can then be used to adjust the audio parameters of the intercepted system audio data to obtain processed audio data. This attribute parameter retrieval interface can be a pre-configured interface based on requirements. Calling this interface retrieves parameter processing attributes, which can be set by technical personnel according to actual needs, provided by the system, or adjusted in real-time as needed. There are no limitations on this; it can be used to adjust the audio parameters of the system audio data to ensure proper playback.
[0044] Specifically, the virtual audio component can be configured based on this parameter processing attribute. The configured virtual audio component can then determine the target audio parameters of the system audio data. These target audio parameters can then be used to adjust the audio parameters of the intercepted system audio data to obtain processed audio data. For example, assuming the requirement is to set the sampling rate of the system audio data to 'a' and the number of audio tracks to 'b', the virtual audio component can be configured with these parameter processing attributes. This allows the virtual audio component to adjust the sampling rate and number of audio tracks of the intercepted system audio data to obtain processed audio data.
[0045] In step 104, the processed audio data is sent to the system audio output component via the virtual audio driver.
[0046] The system's audio output component can play system audio data acquired and input by the audio input component. Specifically, after acquiring system audio data intercepted by a virtual device created by the virtual audio driver, and processing the intercepted system audio data, the processed audio data can be sent to the system audio output component via the virtual audio driver for playback. This avoids the problem in existing technologies where the system lowers the volume of acquired system audio data when a user speaks through a microphone during live streaming, affecting the user's normal access to system audio. This ensures normal playback of system audio data and improves playback efficiency.
[0047] The system's audio output component can be the audio output component currently used by the system, or the audio output component used by the system before the virtual audio driver intercepts the system's audio data. Optionally, before intercepting the system's audio data through the virtual audio driver, the system's currently used audio output component can be obtained and recorded through the Musical Instrument Digital Interface (MIDI). Then, when the processed audio data is obtained, the processed audio data can be routed and transmitted to the pre-recorded audio output component for playback.
[0048] In one embodiment, since the volume of system audio data can be determined by combining the volume settings of the system audio output component and the virtual audio component, failure to adjust the volume of the system audio data may lead to abnormal playback. To ensure that the final playback volume of the system audio data can be played normally at an appropriate volume, the final playback volume of the system audio data can be maintained at a state equal to the initial volume value set by the system.
[0049] Therefore, a volume adjustment strategy can be developed to adjust the volume of the system audio data so that the volume of the processed audio data during playback is equal to the system's initial volume setting. Please refer to [reference needed]. Figure 4 , Figure 4 This is a schematic diagram illustrating the target volume value determination process of an audio playback method according to an embodiment of this application. Specifically, after the virtual audio driver starts, the initial volume value of the system's audio output component before the virtual audio driver starts can be obtained, or the initial volume value of the system's audio output component before the virtual audio driver starts can be obtained before the virtual audio driver starts. A target volume value can be determined based on this initial volume value, and then the volume of the system's audio output component can be set based on the target volume value, so that the processed audio data can be played according to the audio output component with the set volume. The initial volume value can be the volume value of the system's audio output component before the virtual audio driver starts, i.e., the initial volume value of the system. The target volume value can be the volume value used to play the processed audio data, or it can be the volume value determined based on the initial volume value, i.e., it can be the volume value obtained after adjustment according to an adjustment strategy. The target volume value can be the initial volume value.
[0050] In one embodiment, the initial volume value can be compared with a preset volume threshold. Based on the comparison result, the system volume value and the driver volume value are determined. Then, the target volume value can be calculated based on the system volume value and the driver volume value. The preset volume threshold can be a pre-set critical value. When the volume value equals this critical value, the sound effect perceived by the user is considered suitable. This critical value can be determined based on experience. When the volume value is greater than this critical value, the user may perceive it as too loud; when the volume value is less than this critical value, the user may perceive it as too quiet. Therefore, the target volume value can be determined based on the comparison result between the initial volume value and the preset volume threshold. Furthermore, the preset volume threshold can be a value set to ensure that the final target volume value is the same as the initial volume value. The system volume value can be the volume value of the system audio output component, and the driver volume value can be the volume value of the virtual audio driver, i.e., the volume value of the virtual audio component.
[0051] Therefore, the system volume value and the driver volume value can be determined based on the comparison between the initial volume value and the preset volume threshold. Optionally, when the initial volume value is greater than the preset volume threshold, a preset system volume value can be obtained. This preset system volume value can be a pre-set parameter value. By introducing this parameter value, the target volume value can be set appropriately, and the preset system volume value can be used as the system volume value. The driver volume value to be determined can be assigned based on the initial volume value to obtain the driver volume value. When the initial volume value is not greater than the preset volume threshold, the preset volume threshold can be used as the system volume value, and the value of preset system volume value ÷ (preset volume threshold ÷ initial volume value) can be determined as the driver volume value.
[0052] The target volume value can be calculated based on the system volume value and the driver volume value. This can be achieved by multiplying the system volume value by the driver volume value and then dividing the product by the preset system volume value. For example, assuming an initial volume value of 50, a preset volume threshold of 80, and a preset system volume value of 100, the initial volume value of 50 is less than the preset volume threshold of 80, so the system volume value is 80. The driver volume value is 100 ÷ (80 ÷ 50) = 62.5, and the target volume value is 80 × 62.5 ÷ 100 = 50, which is equal to the initial volume value. As another example, assuming an initial volume value of 90, a preset volume threshold of 80, and a preset system volume value of 100, the initial volume value of 90 is greater than the preset volume threshold of 80, so the system volume value is 100. The driver volume value is 90, and the target volume value is 100 × 90 ÷ 100 = 90, which is also equal to the initial volume value.
[0053] Therefore, by using the above adjustment strategies, the target volume value can be adjusted to be equal to the initial volume value, so that the processed audio data can be played at a suitable volume.
[0054] In one embodiment, to enable the sharing of audio captured by the microphone and system audio from other applications during live streaming, allowing other users in the live stream to hear both the microphone's audio and the system audio from the user at the microphone's location, the audio data captured by the microphone during live streaming can be mixed with system audio data from other applications. Please refer to [reference needed]. Figure 5a , Figure 5aThis is a schematic diagram of an audio mixing process for an audio playback method provided in this application embodiment. Specifically, when an audio mixing request for the processed audio data is received, external input audio data can be acquired using an audio acquisition device. For example, external input audio data can be acquired using a microphone device. This external input audio data can be audio data input by a user through a microphone. The processed audio data can then be preprocessed to obtain target system audio data, and the external input audio data can be preprocessed to obtain target external audio data. The target system audio data and the target external audio data can then be sent to a pulse code modulation buffer for synthesis processing to obtain mixed audio data, which is then pushed. The synthesized mixed audio data can be sent to a server, and the server can then distribute the mixed audio data to associated clients, such as the clients of other users in the same live streaming room. Optionally, please refer to... Figure 5b , Figure 5b This is a schematic diagram of a mixed audio data sharing method provided in an embodiment of this application, wherein the mixed audio data can be sent from the server to the associated client through the share button in the live streaming application.
[0055] The data preprocessing can include resampling the processed audio data and the external input audio data, data format conversion, and data size adjustment to enable audio mixing. Specifically, it can resample the processed audio data and the external input audio data according to the required sampling rate, convert the data format according to the required data format, and adjust the data size according to the required data size, etc.
[0056] In one embodiment, a producer-consumer model can be used to cache processed audio data and externally input audio data for data preprocessing. Specifically, the processed audio data and the externally input audio data can be cached in an audio data storage pool respectively. Then, the processed audio data in the audio data storage pool can be adjusted according to preset processing parameters to obtain the target system audio data. Simultaneously, the externally input audio data in the audio data storage pool can be adjusted according to preset processing parameters to obtain the target external audio data. These preset processing parameters may include parameters such as sampling rate, data format, and data size, which are pre-set according to actual conditions and can be determined based on specific circumstances.
[0057] As described above, this embodiment of the application acquires system audio data input from the system audio input component; when the virtual audio driver in the system starts, it intercepts the system audio data input from the system audio input component using the virtual audio driver; it processes the audio parameters of the intercepted system audio data to obtain processed audio data; and it sends the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. In this way, by intercepting the system audio data input from the system audio input component using the virtual audio driver, processing the intercepted system audio data, and then sending the processed audio data to the system audio output component for playback via the virtual audio driver, the sound ducking phenomenon in the prior art is avoided, ensuring normal playback of audio data and thus improving the efficiency of audio data playback.
[0058] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0059] In this embodiment, the audio playback device will be specifically integrated into a computer device as an example for explanation. The audio playback method will be specifically described with the terminal as the executing entity.
[0060] For a better description of the embodiments of this application, please refer to Figure 6 , Figure 6 Another flowchart illustrating the audio playback method provided in this application embodiment is shown below. In step 201, the terminal obtains the system audio data input by the system audio input component. When the virtual audio driver in the system starts, the audio output component currently used by the system is switched to the virtual audio driver. A virtual audio component is created through the virtual audio driver, and the system audio data input by the system audio input component is intercepted based on the virtual audio component.
[0061] The system's audio input component is used to acquire and play system audio data. To play the audio, the terminal can obtain the system audio data input by the audio input component. Simultaneously, the system's currently used audio output component can be switched to a virtual audio driver. This virtual audio driver can then create a virtual audio component, which can be used to intercept the system audio data input by the audio input component. This virtual audio component can be a component simulating an audio device for acquiring system audio data. Specifically, the terminal can create a virtual audio component (i.e., a virtual device) through the virtual audio driver. This virtual device can then perform a polling message loop between the start and end of input / output operations to continuously intercept, acquire, and process the system audio data that needs to be routed and transmitted.
[0062] In step 202, the terminal calls the attribute parameter acquisition interface and obtains the parameter processing attribute according to the call result. Based on the parameter processing attribute, the virtual audio component is configured. After configuration, the virtual audio component adjusts the audio parameters of the intercepted system audio data to obtain the processed audio data.
[0063] To ensure proper playback of system audio data, the terminal can call an attribute parameter retrieval interface and obtain parameter processing attributes based on the call result. These attributes can then be used to adjust the audio parameters of the intercepted system audio data, resulting in processed audio data. This attribute parameter retrieval interface can be a pre-configured interface based on requirements. Calling this interface retrieves parameter processing attributes, which can be set by technical personnel according to actual needs, provided by the system, or adjusted in real-time as needed. No specific limitations are imposed here; the interface is used to adjust the audio parameters of the system audio data to ensure proper playback.
[0064] Specifically, the terminal can configure the virtual audio component based on this parameter processing attribute. Then, the configured virtual audio component can determine the target audio parameters of the system audio data. This allows the terminal to adjust the audio parameters of the intercepted system audio data to obtain processed audio data. For example, assuming the requirement is to set the sampling rate of the system audio data to 'a' and the number of audio tracks to 'b', the virtual audio component can be configured with these parameter processing attributes. The configured virtual audio component can then adjust the sampling rate and number of audio tracks of the intercepted system audio data to obtain processed audio data.
[0065] In step 203, the terminal sends the processed audio data to the system audio output component via the virtual audio driver, obtains the initial volume value of the system audio output component before the virtual audio driver is started, compares the initial volume value with a preset volume threshold, and determines the system volume value and the driver volume value based on the comparison result.
[0066] The terminal can send the processed audio data to the system audio output component via a virtual device created by the virtual audio driver. It can obtain the initial volume value of the system audio output component before the virtual audio driver is started, and then compare the initial volume value with a preset volume threshold. Based on the comparison result, the system volume value and the driver volume value can be determined.
[0067] Please continue to refer to this. Figure 4 The terminal can determine the system volume value and the drive volume value based on the comparison between the initial volume value and the preset volume threshold. Then, the terminal can calculate the target volume value based on the system volume value and set the volume of the system audio output component accordingly, allowing the processed audio data to be played based on the adjusted volume. Optionally, when the initial volume value is greater than the preset volume threshold, a preset system volume value can be obtained. This preset system volume value can be a pre-set parameter value. Introducing this parameter value allows the target volume value to be set appropriately, and the preset system volume value can be used as the system volume value. The driver volume value to be determined can be assigned based on the initial volume value to obtain the driver volume value. When the initial volume value is not greater than the preset volume threshold, the preset volume threshold can be used as the system volume value, and the value of preset system volume value ÷ (preset volume threshold ÷ initial volume value) can be determined as the driver volume value.
[0068] In step 204, the terminal calculates the target volume value based on the system volume value and the drive volume value, and plays the processed audio data based on the target volume value.
[0069] Specifically, the terminal can calculate the target volume value based on the system volume value and the driver volume value, and then play the processed audio data at the target volume value. This can be achieved by multiplying the system volume value by the driver volume value and then determining the target volume value as the ratio of the calculated product to the preset system volume value. For example, assuming the initial volume value is 50, the preset volume threshold is 80, and the preset system volume value is 100, then since the initial volume value of 50 is less than the preset volume threshold of 80, the system volume value is 80. The driver volume value is 100 ÷ (80 ÷ 50) = 62.5, and the target volume value is 80 × 62.5 ÷ 100 = 50, which is equal to the initial volume value. For example, suppose the initial volume value is 90, the preset volume threshold is 80, and the preset system volume value is 100. Since the initial volume value of 90 is greater than the preset volume threshold of 80, the system volume value is 100 and the driver volume value is 90. Therefore, the target volume value is 100 × 90 ÷ 100 = 90, which is equal to the initial volume value.
[0070] Therefore, by using the above adjustment strategies, the target volume value can be adjusted to be equal to the initial volume value, so that the processed audio data can be played at a suitable volume.
[0071] In step 205, when an audio mixing request for the processed audio data is received, the terminal collects external input audio data and caches the processed audio data and the external input audio data into the audio data storage pool respectively.
[0072] To enable the sharing of microphone-captured audio and system audio from other applications during live streaming, allowing other users in the live stream to hear both the microphone's audio and the system audio from the user connected to the microphone, the audio data captured by the microphone during the live stream can be mixed with system audio data from other applications. Please refer to [further details omitted]. Figure 5a The producer-consumer pattern can be used to cache and consume processed audio data as well as externally input audio data for data preprocessing. Specifically, when an audio mixing request for the processed audio data is received, for example, a user can... Figure 5b When the share button triggers an audio mixing request for the processed audio data, the terminal can collect external input audio data and cache the processed audio data and the external input audio data into the audio data storage pool respectively.
[0073] In step 206, the terminal adjusts the processed audio data in the audio data storage pool according to preset processing parameters to obtain target system audio data, and adjusts the external input audio data in the audio data storage pool according to preset processing parameters to obtain target external audio data.
[0074] To synthesize the target system audio data and the target external audio data, the terminal can perform data preprocessing on the processed audio data to obtain the target system audio data, and perform data preprocessing on the external input audio data to obtain the target external audio data. This data preprocessing can include resampling the processed audio data and the external input audio data, data format conversion, and data size adjustment, so that the processed audio data and the external input audio data can be mixed. Specifically, the terminal can resample the processed audio data and the external input audio data according to the required sampling rate, convert the data format according to the required data format, and adjust the data size according to the required data size, etc.
[0075] Specifically, the terminal can cache the processed audio data and the externally input audio data separately in an audio data storage pool. Then, it can adjust the processed audio data in the audio data storage pool according to preset processing parameters to obtain the target system audio data. Simultaneously, it can adjust the externally input audio data in the audio data storage pool according to preset processing parameters to obtain the target external audio data. These preset processing parameters may include parameters such as sampling rate, data format, and data size, which are pre-set according to actual conditions and can be determined based on specific circumstances.
[0076] In step 207, the terminal performs synthesis processing on the target system audio data and the target external audio data to obtain mixed audio data, and pushes the mixed audio data.
[0077] The terminal can send the target system audio data and external audio data to a pulse code modulation buffer for synthesis processing to obtain mixed audio data, and then push the mixed audio data. The synthesized mixed audio data can be sent to a server, which then distributes it to associated clients, such as the clients of other users in the same live stream room.
[0078] As described above, this embodiment of the application obtains system audio data input by the system audio input component through the terminal. When the virtual audio driver in the system starts, the currently used audio output component is switched to the virtual audio driver. A virtual audio component is created through the virtual audio driver, and the system audio data input by the system audio input component is intercepted by the virtual audio component. The terminal calls the attribute parameter acquisition interface and obtains the parameter processing attribute according to the call result. The virtual audio component is configured according to the parameter processing attribute. After configuration, the virtual audio component adjusts the audio parameters of the intercepted system audio data to obtain the processed audio data. The terminal sends the processed audio data to the system audio output component through the virtual audio driver, obtains the initial volume value of the system audio output component before the virtual audio driver starts, and compares the initial volume value with the preset volume threshold. The system volume and driver volume values are compared, and the system volume and driver volume values are determined based on the comparison results. The terminal calculates the target volume value based on the system volume and driver volume values, and plays the processed audio data based on the target volume value. When an audio mixing request for the processed audio data is received, the terminal collects external input audio data and caches the processed audio data and the external input audio data in the audio data storage pool respectively. The terminal adjusts the processed audio data in the audio data storage pool according to preset processing parameters to obtain the target system audio data, and adjusts the external input audio data in the audio data storage pool according to preset processing parameters to obtain the target external audio data. The terminal synthesizes the target system audio data and the target external audio data to obtain mixed audio data, and pushes the mixed audio data. Therefore, by intercepting system audio data input to the system audio input component through a virtual audio driver, processing the intercepted system audio data, and then sending the processed audio data to the system audio output component for playback through the virtual audio driver, the sound ducking phenomenon in existing technologies is avoided, ensuring normal playback of audio data. At the same time, by synthesizing the processed audio data and external input audio data, and pushing the synthesized mixed audio data, other clients can simultaneously obtain system audio data and external input audio data from the current client system, improving audio acquisition efficiency and thus improving audio data playback efficiency.
[0079] To better implement the above methods, embodiments of the present invention also provide an audio playback device, which can be integrated into a computer device, which can be a terminal.
[0080] For example, such as Figure 7The diagram shown is a structural schematic of an audio playback device provided in an embodiment of this application. The audio playback device may include an acquisition unit 301, an interception unit 302, a processing unit 303, and a sending unit 304, as follows: Acquisition unit 301 is used to acquire system audio data input by the system audio input component, which is the audio input component currently used by the system. Interception unit 302 is used to intercept system audio data input by the system audio input component when the virtual audio driver in the system is started. The virtual audio driver is a pre-created analog audio driver component. Processing unit 303 is used to process the audio parameters of the intercepted system audio data to obtain processed audio data; The sending unit 304 is used to send the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. The system audio output component is the audio output component currently used by the system.
[0081] In one embodiment, the interception unit 302 includes: The switching subunit is used to switch the audio output component currently used by the system to a virtual audio driver; Create a sub-unit for creating virtual audio components via the virtual audio driver; The interception subunit is used to intercept system audio data input from the system audio input component based on the virtual audio component.
[0082] In one embodiment, the processing unit 303 includes: The calling sub-unit is used to call the attribute parameter retrieval interface and process the attribute based on the retrieval result. The adjustment subunit is used to adjust the audio parameters of the intercepted system audio data according to the parameter processing attribute to obtain the processed audio data.
[0083] In one embodiment, the adjustment subunit includes: The configuration module is used to configure the properties of the virtual audio component based on the parameter processing properties; The audio parameter adjustment module is used to adjust the audio parameters of the intercepted system audio data through the configured virtual audio component to obtain processed audio data.
[0084] In one embodiment, the audio playback device further includes: The determining unit is used to obtain the initial volume value of the system's audio output component before the virtual audio driver starts, and to determine the target volume value based on the initial volume value; The playback unit is used to play the processed audio data based on the target volume value.
[0085] In one embodiment, the determining unit includes: The comparison subunit is used to compare the initial volume value with a preset volume threshold, and determine the system volume value and the drive volume value based on the comparison result; The calculation subunit is used to calculate the target volume value based on the system volume value and the drive volume value.
[0086] In one embodiment, the audio playback device further includes: The acquisition unit is used to acquire external input audio data when it receives an audio mixing request for the processed audio data. The preprocessing unit is used to preprocess the processed audio data to obtain the target system audio data, and to preprocess the external input audio data to obtain the target external audio data. The synthesis unit is used to synthesize the target system audio data and the target external audio data to obtain mixed audio data, and to push the mixed audio data.
[0087] In one embodiment, the data preprocessing unit includes: The caching subunit is used to cache the processed audio data and the external input audio data into the audio data storage pool respectively; The first adjustment subunit is used to adjust the processed audio data in the audio data storage pool according to preset processing parameters to obtain the target system audio data. The second adjustment subunit is used to adjust the external input audio data in the audio data storage pool according to preset processing parameters to obtain the target external audio data.
[0088] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0089] As described above, this embodiment of the application acquires system audio data input by the system audio input component through the acquisition unit 301; the interception unit 302 intercepts the system audio data input by the system audio input component when the virtual audio driver in the system is started; the processing unit 303 processes the audio parameters of the intercepted system audio data to obtain processed audio data; and the sending unit 304 sends the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. Thus, by intercepting the system audio data input by the system audio input component through the virtual audio driver, processing the intercepted system audio data, and then sending the processed audio data to the system audio output component for playback through the virtual audio driver, the sound ducking phenomenon in the prior art is avoided, ensuring normal playback of audio data and thus improving the efficiency of audio data playback.
[0090] This application also provides a computer device, such as... Figure 8 As shown, it illustrates a structural schematic diagram of a computer device involved in an embodiment of this application. This computer device can be a terminal, specifically: The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 8 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 401 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, it performs various functions of the computer device and processes data, thereby performing overall detection of the computer device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.
[0091] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and audio playback by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0092] The computer device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0093] The computer device may also include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0094] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows: The system acquires system audio data input from the system audio input component; when the virtual audio driver in the system starts, it intercepts the system audio data input from the system audio input component using the virtual audio driver; it processes the audio parameters of the intercepted system audio data to obtain processed audio data; and it sends the processed audio data to the system audio output component via the virtual audio driver so that the system audio output component can play the processed audio data.
[0095] The specific implementation of each of the above operations can be found in the preceding embodiments, and will not be repeated here. It should be noted that the computer device provided in this application embodiment and the audio playback method in the above embodiments belong to the same concept, and its specific implementation process can be found in the above method embodiments, and will not be repeated here.
[0096] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0097] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the audio playback methods provided in embodiments of this application. For example, the instructions can execute the following steps: The system acquires system audio data input from the system audio input component; when the virtual audio driver in the system starts, it intercepts the system audio data input from the system audio input component using the virtual audio driver; it processes the audio parameters of the intercepted system audio data to obtain processed audio data; and it sends the processed audio data to the system audio output component via the virtual audio driver so that the system audio output component can play the processed audio data.
[0098] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0099] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the audio playback methods provided in the embodiments of this application, the beneficial effects that any of the audio playback methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0100] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.
[0101] The above provides a detailed description of an audio playback method, apparatus, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An audio playback method, characterized in that, include: Acquire system audio data input from the system audio input component, wherein the system audio input component is the audio input component currently used by the system; When the virtual audio driver in the system starts, it intercepts the system audio data input by the system audio input component. The virtual audio driver is a pre-created audio driver. The audio parameters of the intercepted system audio data are processed to obtain processed audio data. The audio parameters include at least a volume value. When the volume value of the system audio data decreases to a value lower than the initial volume value due to the microphone collecting audio data, the processing operation includes at least restoring the decreased volume value to the same level as the initial volume value of the system audio data. The processed audio data is sent to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. The system audio output component is the audio output component currently used by the system.
2. The audio playback method as described in claim 1, characterized in that, The method of intercepting system audio data input from the system audio input component using the virtual audio driver includes: Switch the system's currently used audio output component to the virtual audio driver; A virtual audio component is created through the virtual audio driver, and the virtual audio component is a component of an analog audio device; The virtual audio component intercepts system audio data input by the system audio input component.
3. The audio playback method as described in claim 2, characterized in that, The process of processing the audio parameters of the intercepted system audio data to obtain processed audio data includes: Call the attribute parameter retrieval interface, and process the attribute based on the retrieval result; The audio parameters of the intercepted system audio data are adjusted according to the parameter processing attributes to obtain processed audio data.
4. The audio playback method as described in claim 3, characterized in that, The step of adjusting the audio parameters of the intercepted system audio data according to the parameter processing attributes to obtain processed audio data includes: Configure the attributes of the virtual audio component according to the parameter processing attributes; The virtual audio component is configured to adjust the audio parameters of the intercepted system audio data, resulting in processed audio data.
5. The audio playback method according to any one of claims 1 to 4, characterized in that, After sending the processed audio data to the system audio output component via the virtual audio driver, the process further includes: Obtain the initial volume value of the system audio output component before the virtual audio driver starts, and determine the target volume value based on the initial volume value; The processed audio data is played based on the target volume value.
6. The audio playback method as described in claim 5, characterized in that, Determining the target volume value based on the initial volume value includes: The initial volume value is compared with a preset volume threshold, and the system volume value and the drive volume value are determined based on the comparison result. The target volume value is obtained by calculating based on the system volume value and the drive volume value.
7. The audio playback method as described in claim 1, characterized in that, After processing the audio parameters of the intercepted system audio data to obtain the processed audio data, the process further includes: When an audio mixing request for the processed audio data is received, external input audio data is collected. The processed audio data is preprocessed to obtain target system audio data, and the external input audio data is preprocessed to obtain target external audio data. The target system audio data and the target external audio data are synthesized to obtain mixed audio data, and the mixed audio data is pushed.
8. The audio playback method as described in claim 7, characterized in that, The process of preprocessing the processed audio data to obtain target system audio data, and preprocessing the externally input audio data to obtain target external audio data, includes: The processed audio data and the externally input audio data are respectively cached in the audio data storage pool; The processed audio data in the audio data storage pool is adjusted according to preset processing parameters to obtain the target system audio data; The external input audio data in the audio data storage pool is adjusted according to preset processing parameters to obtain the target external audio data.
9. An audio playback device, characterized in that, include: The acquisition unit is used to acquire system audio data input by the system audio input component, wherein the system audio input component is the audio input component currently used by the system. An interception unit is used to intercept system audio data input by the system audio input component when the virtual audio driver in the system starts, wherein the virtual audio driver is a pre-created audio driver. A processing unit is used to process the audio parameters of the intercepted system audio data to obtain processed audio data. The audio parameters include at least a volume value. When the volume value of the system audio data decreases to a value lower than the initial volume value due to the microphone collecting audio data, the processing operation includes at least restoring the decreased volume value to the same level as the initial volume value of the system audio data. The sending unit is used to send the processed audio data to the system audio output component via the virtual audio driver, so that the system audio output component can play the processed audio data. The system audio output component is the audio output component currently used by the system.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the audio playback method according to any one of claims 1 to 8.
11. A computer program product, characterized in that, The computer program product includes computer instructions stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer device to perform the audio playback method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Voice data processing method, and voice data processing method and system in game live broadcasting
CN104967960A
Audio processing method, audio processing device, audio processing equipment and computer-readable storage medium
CN110808060A