Audio processing method and electronic device
By using multiple sound-emitting devices in electronic devices and calculating audio optimization coefficients, optimizing filters to reduce the sound energy in the sound leakage area solves the problem of earpiece sound leakage, improves user privacy and security, and achieves sound field replay.
Patent Information
- Application Number
- PCT/CN2023/134599
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-22
- Filing Date
- 2023-11-28
- Publication Date
- 2024-08-29
AI Technical Summary
When the earpiece of electronic devices such as mobile phones is positioned close to the upper edge of the screen, sound leakage is prone to occur, leading to leakage of user privacy and affecting privacy security.
By using at least two sound-emitting devices (such as earpieces and speakers) in electronic equipment, the sound energy in the listening area and the sound leakage area is obtained, the audio optimization coefficient is calculated, and the filter of the sound-emitting device is optimized to reduce the sound energy in the sound leakage area. This avoids sound leakage.
It effectively prevents user privacy leakage and improves privacy security while keeping the sound energy in the listening area unchanged to achieve sound field replay effects.
Smart Images

Figure CN2023134599_29082024_PF_FP_ABST
Abstract
Description
Audio processing method and electronic equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 22, 2023, with application number 202310190424.8 and invention name “An Audio Processing Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of electronic devices, and in particular to an audio processing method and electronic device. Background Art
[0003] Voice communication has become an important function of electronic devices such as mobile phones. When mobile phones and other electronic devices interact with other devices to provide users with voice communication functions, the handset of mobile phones and other electronic devices can convert the audio electrical signals from other devices into sound signals and output the sound signals.
[0004] As the screen-to-body ratio of electronic devices like mobile phones increases, the earpiece is positioned increasingly closer to the top edge of the screen. However, when the earpiece is positioned close to the top edge of the screen, the earpiece may experience sound leakage. This sound leakage can cause nearby users to overhear their voice communications, potentially compromising their privacy and security.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide an audio processing method and an electronic device for avoiding the problem of sound leakage in a receiver, thereby preventing the leakage of user privacy and improving the privacy security of the user.
[0007] To achieve the above objectives, the present invention adopts the following technical solutions:
[0008] In a first aspect, an embodiment of the present application provides an audio processing method, which is applied to an electronic device. The electronic device may include at least two sound-emitting devices, and the at least two sound-emitting devices may include a first sound-emitting device and a second sound-emitting device. The above-mentioned audio processing method may include: outputting first audio data through the first sound-emitting device, and outputting second audio data through the second sound-emitting device; obtaining a first sound energy corresponding to the first audio data in a listening area and a second sound energy corresponding to a leakage area, and obtaining a third sound energy corresponding to the second audio data in the listening area and a fourth sound energy corresponding to the leakage area; determining an audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area; the audio optimization coefficient is used to reduce the sound energy corresponding to the third audio data corresponding to the first sound-emitting device and the fourth audio data corresponding to the second sound device in the leakage area.
[0009] Based on the method described in the first aspect, the electronic device can determine an audio optimization coefficient based on the sound energy corresponding to the listening area and the sound energy corresponding to the sound leakage area. The audio optimization coefficient can reduce the sound energy corresponding to the audio data in the sound leakage area. That is, before the electronic device outputs the audio data, the electronic device can optimize the output audio data so that the sound energy corresponding to the output audio data in the sound leakage area is reduced. This can avoid the problem of sound leakage from the earpiece of the electronic device in the sound leakage area, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0010] In combination with the first aspect, in another possible implementation method, the above-mentioned audio optimization coefficient may include a first optimization coefficient and a second optimization coefficient. The above-mentioned determination of the audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area may include: determining a first sound energy contrast between the first sound energy and the second sound energy; determining the first optimization coefficient based on the first sound energy contrast; determining a second sound energy contrast between the third sound energy and the fourth sound energy; and determining the second optimization coefficient based on the second sound energy contrast.
[0011] Based on this possible implementation method, the electronic device can accurately determine the audio optimization coefficient according to the sound energy contrast between the sound energy corresponding to the listening area and the sound energy corresponding to the leakage area. The audio optimization coefficient can reduce the sound energy corresponding to the audio data in the leakage area, thereby avoiding the problem of sound leakage of the earpiece of the electronic device in the leakage area, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0012] In combination with the first aspect, in another possible implementation method, determining the first optimization coefficient based on the first acoustic energy contrast may include: determining the numerical value corresponding to the maximization of the first acoustic energy contrast as the first optimization coefficient; determining the second optimization coefficient based on the second acoustic energy contrast may include: determining the numerical value corresponding to the maximization of the second acoustic energy contrast as the second optimization coefficient.
[0013] Based on this possible implementation method, the electronic device determines the numerical value corresponding to the maximization of the sound energy contrast as the audio optimization coefficient. Since the numerical value corresponding to the maximization of the sound energy contrast is determined as the audio optimization coefficient, the audio optimization coefficient can reduce the sound energy corresponding to the audio data in the leakage area, thereby avoiding the problem of sound leakage in the earpiece of the electronic device, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0014] In combination with the first aspect, in another possible implementation, the above-mentioned obtaining of the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the leakage area may include: obtaining a first transfer function corresponding to the first audio data in the listening area, and obtaining a second transfer function corresponding to the first audio data in the leakage area; determining the first sound energy corresponding to the first audio data in the listening area based on the first transfer function corresponding to the listening area; and determining the second sound energy corresponding to the first audio data in the leakage area based on the second transfer function corresponding to the leakage area.
[0015] Based on this possible implementation method, the electronic device can determine the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the first audio data in the leakage area through the first transfer function corresponding to the first audio data in the listening area and the second transfer function corresponding to the first audio data in the leakage area, thereby determining the first audio optimization coefficient based on the first sound energy corresponding to the listening area and the second sound energy corresponding to the leakage area.
[0016] In combination with the first aspect, in another possible implementation, the obtaining of the first transfer function corresponding to the first audio data in the listening area may include: obtaining the transfer function of the first audio data at each sampling point in the listening area; and determining the first transfer function corresponding to the first audio data in the listening area based on the transfer function of the first audio data at each sampling point in the listening area; the obtaining of the second transfer function corresponding to the first audio data in the leakage area may include: obtaining the transfer function of the first audio data at each sampling point in the leakage area; and determining the second transfer function corresponding to the first audio data in the leakage area based on the transfer function of the first audio data at each sampling point in the leakage area.
[0017] Based on this possible implementation method, the electronic device can determine the transfer function of the first audio data corresponding to the listening area and the transfer function of the first audio data corresponding to the leakage area through the transfer function of each sampling point of the first audio data in the listening area and the transfer function of each sampling point of the first audio data in the leakage area, thereby determining the first sound energy corresponding to the listening area and the second sound energy corresponding to the leakage area.
[0018] In conjunction with the first aspect, in another possible implementation, determining the first transfer function corresponding to the first audio data in the listening area based on the transfer functions of the first audio data at each sampling point in the listening area may include: determining a weight corresponding to each sampling point in the listening area; and determining the first transfer function corresponding to the first audio data in the listening area based on the weight corresponding to each sampling point in the listening area and the transfer function of each sampling point in the listening area.
[0019] Based on this possible implementation, the electronic device can accurately determine the first transfer function corresponding to the first audio data in the listening area by using the weights corresponding to the sampling points in the listening area, thereby determining the first sound energy corresponding to the listening area and the second sound energy corresponding to the leakage area.
[0020] In combination with the first aspect, in another possible implementation, the above-mentioned audio processing method may also include: optimizing the first filter corresponding to the first sound device according to the first optimization coefficient, and filtering the third audio data through the optimized first filter to obtain filtered third audio data; optimizing the second filter corresponding to the second sound device according to the second optimization coefficient, and filtering the fourth audio data through the optimized second filter to obtain filtered fourth audio data; outputting the filtered third audio data through the first sound device, and outputting the filtered fourth audio data through the second sound device.
[0021] Based on this possible implementation method, when the electronic device outputs filtered audio data through a sound-emitting device, the filter corresponding to the sound-emitting device is optimized through the audio optimization coefficient. The filter filters the audio data to obtain filtered audio data. The sound energy corresponding to the audio data in the leakage area is reduced through the audio optimization coefficient, thereby avoiding the problem of sound leakage in the earpiece of the electronic device, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0022] In combination with the first aspect, in another possible implementation, before obtaining the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the leakage area, and obtaining the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the leakage area, the above-mentioned audio processing method may also include: determining a usage scenario in which the electronic device outputs the first audio data and the second audio data; and determining the listening area and the leakage area according to the usage scenario of the first audio data and the second audio data.
[0023] Based on this possible implementation method, the electronic device determines the listening area and the sound leakage area by outputting the usage scenario of the first audio data and the second audio data, and can determine the audio optimization coefficient corresponding to the usage scenario of the first audio data and the second audio data, so as to avoid the problem of sound leakage in the earpiece when the electronic device outputs the first audio data and the second audio data, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0024] In combination with the first aspect, in another possible implementation, the usage scenario of the third audio data and the fourth audio data is the same as the usage scenario of the first audio data and the second audio data.
[0025] Based on this possible implementation method, since the usage scenario in which the electronic device outputs the first audio data and the second audio data is the same as the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, in the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, the audio optimization coefficient corresponding to the usage scenario of the first audio data and the second audio data can be used to avoid the problem of sound leakage in the earpiece when the electronic device outputs the third audio data and the fourth audio data, thereby preventing the leakage of user privacy and improving the user's privacy security.
[0026] In combination with the first aspect, in another possible implementation, the at least two sound-emitting devices may include at least one of an earpiece of the electronic device and a speaker of the electronic device or a screen sound-emitting device of the electronic device.
[0027] Based on this possible implementation method, since the at least two sound-emitting devices can include at least one of an earpiece of an electronic device and a speaker of an electronic device, when the sound-emitting device of the electronic device includes an earpiece of an electronic device and a speaker of an electronic device, it can not only avoid the problem of sound leakage in the earpiece of the electronic device, thereby preventing the leakage of user privacy and improving the privacy security of the user, but also realize sound field playback through the earpiece of the electronic device and the speaker of the electronic device.
[0028] In combination with the first aspect, in another possible implementation, the first sound-emitting device may be a receiver of an electronic device, and the second sound-emitting device may be a screen sound-emitting device of the electronic device.
[0029] Based on this possible implementation method, when the sound-emitting device of the electronic device includes an earpiece of the electronic device and a screen sound-emitting device of the electronic device, it can not only avoid the problem of sound leakage in the earpiece of the electronic device, thereby preventing the leakage of user privacy and improving the user's privacy security, but also realize sound field playback through the earpiece of the electronic device and the speaker of the electronic device.
[0030] In a second aspect, embodiments of the present application provide an audio processing device that can be applied to an electronic device and used to implement the method described in the first aspect. The functions of the audio processing device can be implemented through hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as an output module, an acquisition module, and a determination module.
[0031] The output module may be configured to output first audio data through a first sound-emitting device, and to output second audio data through a second sound-emitting device.
[0032] The acquisition module can be used to obtain the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area, and obtain the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area.
[0033] The determination module can be used to determine the audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area; the audio optimization coefficient is used to reduce the sound energy corresponding to the third audio data corresponding to the first sound device and the fourth audio data corresponding to the second sound device in the leakage area.
[0034] In combination with the second aspect, in another possible implementation, the determination module may also be configured to determine a first acoustic energy contrast between the first acoustic energy and the second acoustic energy.
[0035] The determination module may also be configured to determine a first optimization coefficient according to the first acoustic energy contrast.
[0036] The determination module may also be configured to determine a second acoustic energy contrast ratio between the third acoustic energy and the fourth acoustic energy.
[0037] The determination module may also be configured to determine a second optimization coefficient according to the second acoustic energy contrast.
[0038] In combination with the second aspect, in another possible implementation, the determination module may also be configured to determine a value corresponding to maximizing the first acoustic energy contrast as the first optimization coefficient.
[0039] The determination module may also be configured to determine a value corresponding to when the second acoustic energy contrast is maximized as a second optimization coefficient.
[0040] In conjunction with the second aspect, in another possible implementation, the acquisition module may also be configured to acquire a first transfer function corresponding to the first audio data in the listening area, and acquire a second transfer function corresponding to the first audio data in the sound leakage area.
[0041] The determination module may also be configured to determine a first sound energy corresponding to the first audio data in the listening area according to a first transfer function corresponding to the listening area.
[0042] The determination module may also be configured to determine a second acoustic energy corresponding to the first audio data in the sound leakage area according to a second transfer function corresponding to the sound leakage area.
[0043] In conjunction with the second aspect, in another possible implementation, the acquisition module may also be configured to acquire a transfer function of the first audio data at each sampling point in the listening area.
[0044] The determination module may also be configured to determine a first transfer function corresponding to the first audio data in the listening area based on the transfer function of each sampling point of the first audio data in the listening area.
[0045] The acquisition module can also be used to obtain the transfer function of each sampling point of the first audio data in the sound leakage area.
[0046] The determination module may also be configured to determine a second transfer function corresponding to the first audio data in the sound leakage area based on the transfer function of each sampling point of the first audio data in the sound leakage area.
[0047] In conjunction with the second aspect, in another possible implementation, the determination module may also be configured to determine a weight corresponding to each sampling point in the listening area.
[0048] The determination module may also be configured to determine a first transfer function corresponding to the first audio data in the listening area according to the weights corresponding to the sampling points in the listening area and the transfer functions of the sampling points in the listening area.
[0049] In conjunction with the second aspect, in another possible implementation, the audio processing device may further include an optimization module. The optimization module may be configured to optimize the first filter corresponding to the first sound-emitting device based on the first optimization coefficient, and filter the third audio data using the optimized first filter to obtain filtered third audio data.
[0050] The optimization module may also be configured to optimize the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, and filter the fourth audio data using the optimized second filter to obtain filtered fourth audio data.
[0051] The output module can also be used to output the filtered third audio data through the first sound-emitting device, and output the filtered fourth audio data through the second sound-emitting device.
[0052] In combination with the second aspect, in another possible implementation, the determination module may also be used to determine a usage scenario in which the electronic device outputs the first audio data and the second audio data.
[0053] The determination module may also be configured to determine a listening area and a sound leakage area according to usage scenarios of the first audio data and the second audio data.
[0054] In combination with the second aspect, in another possible implementation manner, the usage scenario of the third audio data and the fourth audio data is the same as the usage scenario of the first audio data and the second audio data.
[0055] In combination with the second aspect, in another possible implementation, the at least two sound-emitting devices include at least one of an earpiece of the electronic device, a speaker of the electronic device, or a screen sound-emitting device of the electronic device.
[0056] In combination with the second aspect, in another possible implementation, the first sound-emitting device is an earpiece of the electronic device, and the second sound-emitting device is a screen sound-emitting device of the electronic device.
[0057] In a third aspect, an audio processing device is provided, which has the function of implementing the method described in the first aspect. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0058] In a fourth aspect, an audio processing device is provided, comprising: a processor and a memory; the memory is used to store computer execution instructions, and when the audio processing device is running, the processor executes the computer execution instructions stored in the memory to enable the audio processing device to perform the audio processing method as described in any one of the first aspects above.
[0059] In a fifth aspect, an audio processing device is provided, comprising: a processor; the processor is configured to be coupled to a memory, and after reading instructions in the memory, execute the audio processing method as described in any one of the first aspects above according to the instructions.
[0060] In a sixth aspect, embodiments of the present application provide a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by an electronic device, the electronic device implements the audio processing method as described in the first aspect or any possible implementation of the first aspect.
[0061] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising a computer-readable code, which, when executed in an electronic device, enables the electronic device to implement an audio processing method as described in the first aspect or any one of the possible implementations of the first aspect.
[0062] In an eighth aspect, a device (for example, a chip system) is provided, which includes a processor for supporting an electronic device in implementing the functions described in the first aspect. 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 can be composed of a chip or include a chip and other discrete devices.
[0063] It should be understood that the beneficial effects of the second to eighth aspects can be found in the relevant description of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] FIG1 is a schematic diagram of sound leakage from an earpiece of an electronic device;
[0065] FIG2 is a schematic diagram of a hardware structure of an electronic device;
[0066] FIG3 is a second schematic diagram of sound leakage from an earpiece of an electronic device;
[0067] FIG4 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0068] FIG5 is a schematic diagram of a software structure of an electronic device provided in an embodiment of the present application;
[0069] FIG6 is a flowchart of an audio processing method according to an embodiment of the present application;
[0070] FIG7 is a schematic diagram of the division of the listening area and the sound leakage area provided in an embodiment of the present application;
[0071] FIG8 is a first schematic diagram of the division of sampling points in the listening area and sampling points in the sound leakage area provided in an embodiment of the present application;
[0072] FIG9 is a second schematic diagram of the division of the listening area sampling points and the sound leakage area sampling points provided in an embodiment of the present application;
[0073] FIG10 is a schematic diagram showing a comparison of acoustic energy at sampling points in a sound leakage area according to an embodiment of the present application;
[0074] FIG11 is a second flow chart of an audio processing method provided in an embodiment of the present application;
[0075] FIG12 is a schematic structural diagram of an audio processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0077] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature specified as "first" or "second" may explicitly or implicitly include one or more of such features. Throughout this application, unless otherwise specified, "plurality" means two or more.
[0078] Voice communication has become an important function of electronic devices such as mobile phones. When mobile phones and other electronic devices interact with other devices to provide users with voice communication functions, the handset of mobile phones and other electronic devices can convert the audio electrical signals from other devices into sound signals and output the sound signals.
[0079] As the screen-to-body ratio of electronic devices like mobile phones increases, the earpiece is positioned increasingly closer to the top edge of the screen. However, when the earpiece is positioned close to the top edge of the screen, the earpiece may experience sound leakage. This sound leakage can cause nearby users to overhear their voice communications, potentially compromising their privacy and security.
[0080] For example, as shown in Figure 1, for a mobile phone 02 with earpiece 01 located at the top edge of the screen, when a user is making a call on mobile phone 02, the sound signal output by earpiece 01 is emitted in all directions through the sound outlet at the top of mobile phone 02. The sound signal output by earpiece 01 can be heard on the side of the user's ear and also on the side away from the user's ear. For example, in area 03 in Figure 1, the sound signal output by earpiece 01 is also transmitted to this area, meaning that the sound signal output by earpiece 01 can also be heard in area 03. Therefore, when earpiece 01 is located near the top edge of mobile phone 02's screen, the sound signal output by earpiece 01 may leak, meaning that the sound signal output by earpiece 01 can be heard in area 03. This means that other users in area 03 can hear the sound signal output by earpiece 01, causing the user's voice communication content to be overheard by those around them, resulting in the leakage of user privacy and compromising the user's privacy security.
[0081] In order to solve the problem of sound leakage from the earpiece when the earpiece is located close to the upper edge of the screen of an electronic device such as a mobile phone, the prior art usually arranges the earpiece at a relatively low position on the screen of an electronic device such as a mobile phone. Although the problem of sound leakage from the earpiece can be reduced from the perspective of structural design, this solution of arranging the earpiece at a relatively low position on the screen of an electronic device such as a mobile phone will reduce the screen-to-body ratio of the electronic device such as a mobile phone, resulting in a decrease in the relative ratio of the screen area to the front panel area of the electronic device such as the mobile phone, which will result in a lower user experience. Therefore, this solution of arranging the earpiece at a relatively low position on the screen of an electronic device such as a mobile phone does not effectively solve the problem of sound leakage from the earpiece caused by the earpiece being located close to the upper edge of the screen of an electronic device such as a mobile phone.
[0082] To address the issue of sound leakage caused by the earpiece being positioned close to the top edge of the screen of an electronic device, such as a mobile phone, existing technology allows a user to play a first sound signal through the earpiece at the top of the electronic device, such as a mobile phone, and a second sound signal through the speaker at the bottom of the electronic device, such as a mobile phone, when making a voice communication. The second sound signal has an opposite phase to the first sound signal. Because the second sound signal and the first sound signal have opposite phases, the two sound waves cancel each other out during propagation, thereby canceling out sound leakage from the earpiece of the electronic device and reducing the leakage of voice communication content.
[0083] However, this solution of playing a first sound signal through the earpiece and a second sound signal with a phase opposite to the first sound signal through the speaker can offset the sound leakage of the earpiece of the electronic device. However, since the first sound signal and the second sound signal are in opposite phases, this solution cannot enable the user to hear the sound signal through the earpiece to achieve the effect of sound field playback. That is, this solution cannot guarantee the user's hearing experience while offsetting the sound leakage of the earpiece of the electronic device. Therefore, this solution of playing a first sound signal through the earpiece and a second sound signal with a phase opposite to the first sound signal through the speaker does not solve the problem of earpiece sound leakage caused by the earpiece being located close to the upper edge of the screen of an electronic device such as a mobile phone.
[0084] Furthermore, with the development of electronic devices such as mobile phones, people's functional demands for these devices are becoming increasingly diverse. For example, users have increasingly demanded higher quality for the sound signals output by the earpieces of mobile phones and other electronic devices. For example, users want the sound signals they hear to achieve the effect of sound field reproduction. Mobile phones and other electronic devices can reproduce the three-dimensional effect of sound in nature through sound field reproduction, and can restore the three-dimensional effect of sound to a certain extent, thereby providing a certain degree of spatial distribution characteristics such as directional layering when reproduced.
[0085] Typically, electronic devices such as mobile phones can include at least two sound-generating devices (e.g., an earpiece and a screen sound-generating device), allowing the mobile phone or other electronic device to utilize the at least two sound-generating devices to achieve sound field playback. The screen sound-generating device, i.e., a device that can produce sound through screen vibration, can be located below the screen of the mobile phone or other electronic device.
[0086] For example, as shown in Figure 2, mobile phone 04 may include two sound-generating devices: a screen sound-generating device 05 and an earpiece 06. Earpiece 06 may be located at the top edge of the screen of mobile phone 04, while screen sound-generating device 05 may be located below the screen, near earpiece 06. When a user makes a call on mobile phone 04, earpiece 06 may output a sound signal, while screen sound-generating device 05 may output a sound signal by vibrating the screen of mobile phone 04. In other words, earpiece 06 and screen sound-generating device 05 may simultaneously output sound signals, thereby achieving a sound field playback effect.
[0087] However, when electronic devices such as mobile phones use at least two sound-generating devices to achieve sound field reproduction, the problem of earpiece sound leakage still exists when the earpiece is located close to the upper edge of the screen of the electronic device such as mobile phones.
[0088] For example, as shown in FIG3 , when mobile phone 04 includes two sound-generating devices, namely, screen sound-generating device 05 and earpiece 06, earpiece 06 can be located at the upper edge of the screen of mobile phone 04, and screen sound-generating device 05 can be located below the screen of mobile phone 04 and close to earpiece 06. When a user makes a call through mobile phone 04, earpiece 06 and screen sound-generating device 05 can simultaneously output sound signals, thereby achieving a sound field playback effect.
[0089] However, the sound signal output by earpiece 06 is emitted in all directions through the sound outlet at the top of mobile phone 04, and the sound signal output by screen sound device 05 is emitted in all directions through the screen of mobile phone 04. That is, the sound signals output by earpiece 06 and screen sound device 05 are heard on the side of the user's ear, and also on the side away from the user's ear, such as in area 07 in Figure 3. Therefore, when earpiece 06 and screen sound device 05 are outputting sound signals simultaneously, the sound signals output by earpiece 06 and screen sound device 05 can be heard in area 07. In other words, other users in area 07 can hear the sound signals output by earpiece 06 and screen sound device 05. This can cause the user's voice communication content to be heard by people around them, resulting in the leakage of user privacy and affecting the user's privacy security.
[0090] In response to the above problems, an embodiment of the present application provides an audio processing method, which is applied to an electronic device, and the electronic device can use at least two sound-emitting devices (such as a receiver, a speaker, etc.) to achieve the effect of sound field playback. And the electronic device can obtain the sound energy of the listening area and the sound energy of the leakage area. According to the sound energy of the listening area and the sound energy of the leakage area, the optimization coefficient corresponding to the at least two sound-emitting devices can be obtained. The optimization coefficient can be the maximum value of the sound energy contrast between the sound energy of the listening area and the sound energy of the leakage area. The playback filters corresponding to the at least two sound-emitting devices can be optimized respectively through the optimization coefficient, so that when the user uses the electronic device to make a call, the optimized playback filter can filter the input signals (i.e., audio data) of the at least two sound-emitting devices respectively, and the at least two sound-emitting devices can output the input signals after filtering. The output signals of the at least two sound-emitting devices can achieve the effect of sound field playback in the listening area.
[0091] Since the optimization coefficients of the playback filters corresponding to at least two sound-emitting devices are the maximum value of the sound energy contrast between the sound energy in the listening area and the sound energy in the leakage area, the optimized playback filter can reduce the sound energy of the sound-emitting device in the leakage area. That is, before the electronic device outputs audio data, the electronic device can optimize the output audio data so that the sound energy corresponding to the output audio data in the leakage area is reduced. And the output signals of at least two sound-emitting devices can also achieve interference cancellation in the leakage area. Therefore, the solution of the present application can prevent sound leakage in the leakage area. At the same time, the optimized playback filter can keep the sound energy in the listening area unchanged. In other words, the solution of the present application can reduce the sound energy in the leakage area while using at least two sound-emitting devices to achieve sound field playback. That is, the solution of the present application can ensure the user's hearing experience while preventing sound leakage.
[0092] The following describes the audio processing method provided in the embodiments of the present application.
[0093] The audio processing methods provided in the embodiments of the present application can be applied to electronic devices. In some embodiments, the electronic devices can be mobile phones, tablet computers, handheld computers, personal computers (PCs), cellular phones, personal digital assistants (PDAs), wearable devices, and other electronic devices with application programs. The embodiments of the present application do not limit the specific form of the electronic devices.
[0094] For example, taking the electronic device as a mobile phone as an example, FIG4 shows a structural diagram of an electronic device provided in an embodiment of the present application.
[0095] As shown in Figure 4, the electronic device may include a processor 410, an external memory interface 420, an internal memory 421, a universal serial bus (USB) interface 430, a charging management module 440, a power management module 441, a battery 442, an antenna 1, an antenna 2, a mobile communication module 450, a wireless communication module 460, an audio module 470, a speaker 470A, a receiver 470B, a microphone 470C, an earphone interface 470D, a sensor module 480, a button 490, a motor 491, an indicator 492, a camera 493, a display screen 494, and a subscriber identification module (SIM) card interface 495, etc. Among them, the sensor module 480 can include a pressure sensor 480A, a gyroscope sensor 480B, an air pressure sensor 480C, a magnetic sensor 480D, an acceleration sensor 480E, a distance sensor 480F, a proximity light sensor 480G, a fingerprint sensor 480H, a temperature sensor 480J, a touch sensor 480K, an ambient light sensor 480L, a bone conduction sensor 480M, etc.
[0096] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0097] The processor 410 may include one or more processing units. For example, the processor 410 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0098] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0099] Processor 410 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 410 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 410. If processor 410 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 410 latency, and thus improves system efficiency.
[0100] In some embodiments, the processor 410 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0101] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 450, wireless communication module 460, modem processor and baseband processor.
[0102] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0103] The mobile communication module 450 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to electronic devices. The mobile communication module 450 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 450 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 450 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the processor 410. In some embodiments, at least some of the functional modules of the mobile communication module 450 can be set in the same device as at least some of the modules of the processor 410.
[0104] The wireless communication module 460 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 460 can be one or more devices that integrate at least one communication processing module. The wireless communication module 460 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 410. The wireless communication module 460 can also receive the signal to be sent from the processor 410, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0105] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 450, and antenna 2 is coupled to wireless communication module 460, so that the electronic device can communicate with a network and other devices via wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology.
[0106] The electronic device implements display functionality through a GPU, display screen 494, and an application processor. The GPU is a microprocessor for image processing that connects the display screen 494 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 410 may include one or more GPUs that execute program instructions to generate or modify display information.
[0107] Display screen 494 is used to display images, videos, and the like. Display screen 494 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device can include one or N display screens 494, where N is a positive integer greater than one.
[0108] The electronic device can implement the shooting function through the ISP, camera 493, video codec, GPU, display 494 and application processor, etc. In some embodiments, the electronic device can include 1 or N cameras 493, where N is a positive integer greater than 1.
[0109] The internal memory 421 can be used to store computer executable program codes, which include instructions. The processor 410 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 421. The internal memory 421 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data established during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 421 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.
[0110] The acceleration sensor 480E can periodically collect acceleration data of the electronic device at a certain frequency. For example, it can collect the acceleration magnitude of the electronic device in various directions (generally the X, Y, and Z axes).
[0111] Of course, it is understood that FIG4 is merely an example of an electronic device in the form of a mobile phone. If the electronic device is a tablet computer, handheld computer, PC, PDA, wearable device (such as a smart watch, smart bracelet), or other device form factors, the structure of the electronic device may include fewer or more structures than shown in FIG2, and this is not limited here.
[0112] In some examples, to enable an electronic device to achieve a sound field playback effect, the electronic device may also include a playback filter bank. The playback filter bank may include multiple playback filters. The playback filters may correspond one-to-one with the sound-generating devices that achieve the sound field playback, thereby filtering the input signals of the sound-generating devices that achieve the sound field playback.
[0113] It is understandable that, generally speaking, the realization of electronic device functions requires not only hardware support but also software cooperation.
[0114] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device.
[0115] FIG5 is a block diagram of the software structure of the electronic device provided in an embodiment of the present application.
[0116] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries (also called the native layer), and the kernel layer.
[0117] The application layer includes a series of application packages. As shown in Figure 5, these packages may include applications such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, and short messaging. The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0118] As shown in FIG5 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
[0119] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0120] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0121] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0122] The phone manager is used to provide communication functions for electronic devices, such as call status management (including answering, hanging up, etc.).
[0123] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0124] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.
[0125] As shown in FIG5 , in order to implement the audio processing method provided in the embodiment of the present application, the application framework layer may further include an anti-sound leakage module, etc.
[0126] The anti-sound leakage module can be used to obtain the sound energy of the listening area and the sound energy of the leakage area, and based on the sound energy of the listening area and the sound energy of the leakage area, the optimization coefficient corresponding to at least two sound-emitting devices can be obtained. The optimization coefficient can be the maximum value of the sound energy contrast between the sound energy of the listening area and the sound energy of the leakage area.
[0127] After the sound leakage prevention module obtains the optimization coefficient, the sound leakage prevention module can send the optimization coefficient to the playback filters corresponding to at least two sound generators, so that the playback filters corresponding to at least two sound generators can filter the input signals of at least two sound generators respectively, and at least two sound generators can output the input information after filtering.
[0128] The Android runtime includes core libraries and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0129] The core library consists of two parts: one is the function that the Java language needs to call, and the other is The core library.
[0130] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0131] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0132] The surface manager is used to manage the display subsystem and provide the fusion of two-dimensional and three-dimensional layers for multiple applications.
[0133] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support multiple audio and video encoding formats.
[0134] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0135] A 2D graphics engine is a drawing engine for 2D drawings.
[0136] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0137] The methods in the following embodiments can all be implemented in an electronic device having the above hardware structure or software structure.
[0138] The following describes in detail an audio processing method provided by an embodiment of the present application in conjunction with Figure 6. Figure 6 is a flow chart of an audio processing method provided by an embodiment of the present application. As shown in Figure 6, the audio processing method may include the following S601-S609.
[0139] S601: The electronic device determines a listening area and a sound leakage area corresponding to a usage scenario according to the usage scenario of the electronic device.
[0140] The electronic device in the embodiment of the present application may include multiple sound-generating devices, and the electronic device may achieve the effect of sound field reproduction through the multiple sound-generating devices. In the embodiment of the present application, an electronic device including two sound-generating devices is used as an example for illustration, that is, the electronic device may achieve the effect of sound field reproduction through the two sound-generating devices.
[0141] The sound-emitting device included in the electronic device may be an earpiece included in the electronic device, a speaker included in the electronic device, or a receiver included in the electronic device. For example, when the electronic device achieves the effect of sound field playback through two sound-emitting devices, the two sound-emitting devices may be two speakers included in the electronic device, or the two sound-emitting devices may be an earpiece and a speaker included in the electronic device. In the embodiment of the present application, an example is used to illustrate that the electronic device includes two sound-emitting devices, namely, an earpiece included in the electronic device and a speaker included in the electronic device, that is, the electronic device can achieve the effect of sound field playback through the two sound-emitting devices (earpiece and speaker).
[0142] In some examples, when the electronic device includes two sound-emitting devices, namely, an earpiece included in the electronic device and a speaker included in the electronic device, the speaker included in the electronic device can be located below the screen of the electronic device, that is, the speaker can be provided with a piezoelectric vibrator under the screen, and the vibration can cause the screen to vibrate and emit sound. In other words, the speaker can emit audio (i.e., sound) through the screen of the electronic device. When the speaker emits audio through the screen of the electronic device, the speaker can also be called a screen sound-emitting device. The speaker included in the electronic device can also be located in other positions of the electronic device, such as below the electronic device. The specific position of the speaker is not limited in the embodiment of the present application. In the embodiment of the present application, the electronic device including two sound-emitting devices, namely, an earpiece included in the electronic device and a screen sound-emitting device included in the electronic device is used as an example for schematic description.
[0143] When implementing the audio processing method provided in the embodiments of the present application, the electronic device can first determine the usage scenario of the electronic device. Then, based on the usage scenario of the electronic device, the listening area and sound leakage area corresponding to the usage scenario can be determined. This allows the acoustic energy corresponding to the listening area and sound leakage area, respectively, to be determined. Furthermore, based on the acoustic energy corresponding to the listening area and sound leakage area, respectively, the optimized coefficients of the playback filters corresponding to at least two sound-emitting devices can be determined.
[0144] The usage scenario of the electronic device may be the usage scenario when the electronic device outputs the first audio data and the second audio data. The electronic device determines the listening area and the sound leakage area corresponding to the usage scenario according to the usage scenario of the electronic device, that is, determines the listening area and the sound leakage area corresponding to when the electronic device outputs the first audio data and the second audio data. The usage scenario of the electronic device may be the scenario in which the electronic device achieves the effect of sound field playback through two sound-emitting devices (such as a handset and a screen sound-emitting device). For example, the usage scenario of the electronic device may include the scenario in which the user uses the electronic device for voice communication (such as a voice call), and in the scenario in which the user uses the electronic device for voice call, the electronic device achieves the effect of sound field playback through two sound-emitting devices (such as a handset and a screen sound-emitting device). The usage scenario of the electronic device may also include the scenario in which the user uses the electronic device to play audio, and in the scenario in which the user uses the electronic device to play audio, the electronic device achieves the effect of sound field playback through two sound-emitting devices (such as a handset and a screen sound-emitting device).
[0145] The embodiments of this application do not limit the specific usage scenarios of the electronic device, that is, any scenario in which the electronic device achieves the effect of sound field playback through two sound-emitting devices (such as an earpiece and a screen sound-emitting device). The embodiments of this application use the electronic device in a scenario where the user uses the electronic device for voice communication (such as a voice call) as an example for illustration.
[0146] In some examples, the usage scenario of the electronic device may further include usage parameters of the electronic device and parameters of the sound-emitting device included in the electronic device. The usage parameters of the electronic device may include the position and angle of the electronic device when the user of the electronic device uses the electronic device for a voice call. The specific types of usage parameters of the electronic device are not limited in the embodiments of the present application. The parameters of the sound-emitting device included in the electronic device may include the setting position of the sound-emitting device, the distance between the sound-emitting devices, etc. The specific types of parameters of the sound-emitting device included in the electronic device are not limited in the embodiments of the present application.
[0147] After the electronic device determines the usage scenario of the electronic device, the electronic device determines a listening area and a sound leakage area corresponding to the usage scenario according to the usage scenario of the electronic device.
[0148] The listening zone is the area where a user expects to hear audio when an electronic device outputs audio through two sound-emitting devices. For example, the listening zone can be the area on one side of the electronic device's screen when the user is using the electronic device for a voice call. The sound leakage zone is the area where a user expects to hear audio when an electronic device outputs audio through two sound-emitting devices. For example, the sound leakage zone can be the area on the other side of the electronic device's screen when the user is using the electronic device for a voice call.
[0149] In some examples, when a user uses an electronic device to make a voice call, the listening area may be all areas on one side of the electronic device's screen where audio can be heard, and the sound leakage area may be all areas on the other side of the electronic device's screen where audio can be heard.
[0150] When a user uses an electronic device for a voice call, the listening zone may also be an area on one side of the electronic device's screen that is in the same plane as the user's ear, and the sound leakage zone may be an area on the other side of the electronic device's screen that is in the same plane as the user's ear. In the embodiment of the present application, the use scenario of the electronic device may include a scenario in which the user uses the electronic device for voice communication (such as a voice call), and the listening zone is an area on one side of the electronic device's screen that is in the same plane as the user's ear, and the sound leakage zone is an area on the other side of the electronic device's screen that is in the same plane as the user's ear as an example for schematic illustration.
[0151] For example, as shown in FIG7 , a mobile phone 04 includes two sound-emitting devices, namely, an earpiece 06 and a screen sound-emitting device 05. The earpiece 06 can be located at the upper edge of the screen of the mobile phone 04, and the screen sound-emitting device 05 can be located below the screen of the mobile phone 04 and close to the earpiece 06. When the use scenario of the mobile phone 04 is a voice call scenario, that is, when the user makes a call through the mobile phone 04, the earpiece 06 and the screen sound-emitting device 05 can output sound signals simultaneously, thereby achieving the effect of sound field playback. When the user makes a call through the mobile phone 04, the corresponding listening area can be an area on one side of the screen of the mobile phone 04 and in the same plane as the user's ear, and the sound leakage area can be an area on the other side of the screen of the mobile phone 04 and in the same plane as the user's ear.
[0152] In some examples, the electronic device may store a correspondence between a usage scenario of the electronic device and a listening area and a sound leakage area corresponding to the usage scenario. After the electronic device determines the usage scenario of the electronic device, the electronic device may determine the listening area and the sound leakage area corresponding to the determined usage scenario based on the usage scenario of the electronic device, the usage scenario of the electronic device, and the correspondence between the listening area and the sound leakage area corresponding to the usage scenario.
[0153] S602: The electronic device determines sampling points in the listening area and sampling points in the sound leakage area.
[0154] After the electronic device determines the listening area and sound leakage area corresponding to the usage scenario (i.e., the listening area and sound leakage area corresponding to the usage scenario in which the electronic device outputs the first audio data) based on the usage scenario of the electronic device, the electronic device can determine the listening area sampling points and the sound leakage area sampling points. There can be multiple listening area sampling points, and there can be multiple sound leakage area sampling points. In the embodiments of the present application, the specific number of listening area sampling points and the specific number of sound leakage area sampling points are not limited.
[0155] The listening area sampling points can be used to sample the audio in the listening area, thereby determining the sound energy in the listening area. The leakage area sampling points can be used to sample the audio in the leakage area, thereby determining the sound energy in the leakage area.
[0156] In some examples, after the electronic device determines a listening area and a sound leakage area corresponding to the usage scenario based on the usage scenario of the electronic device, the electronic device may evenly set listening area sampling points in the listening area, that is, the distances between adjacent listening area sampling points are the same, and the distances between adjacent listening area sampling points can meet a preset condition. The electronic device may evenly set the sound leakage area sampling points in the sound leakage area, that is, the distances between adjacent sound leakage area sampling points are the same, and the distances between adjacent sound leakage area sampling points can meet a preset condition. The preset condition may include that adjacent sampling points can all collect audio in the sound leakage area.
[0157] For example, in combination with FIG7 , let's continue to take the case where the mobile phone 04 includes two sound-emitting devices (earpiece 06 and screen sound-emitting device 05), the earpiece 06 can be located at the upper edge of the screen of the mobile phone 04, and the screen sound-emitting device 05 can be located below the screen of the mobile phone 04 and close to the earpiece 06. When a user makes a call through the mobile phone 04, the corresponding listening area can be an area on one side of the screen of the mobile phone 04 and in the same plane as the user's ear, and the leakage area can be an area on the other side of the screen of the mobile phone 04 and in the same plane as the user's ear. Afterwards, as shown in FIG8 , the listening area sampling points 08 can be evenly set in the listening area, and the distances between adjacent listening area sampling points 08 are the same. The leakage area sampling points 09 can be evenly set in the leakage area, and the distances between adjacent leakage area sampling points 09 are the same.
[0158] After the electronic device determines the listening area sampling point and the leakage area sampling point, audio collection devices can be set at the listening area sampling point and the leakage area sampling point respectively, so that the audio in the listening area can be sampled at the listening area sampling point, and the audio in the leakage area can be sampled at the leakage area sampling point.
[0159] In some examples, multiple audio acquisition devices can be configured for each sampling point (i.e., a listening zone sampling point and a sound leakage zone sampling point). The number of audio acquisition devices at each sampling point can be the same as the number of sound-emitting devices in the electronic device. For example, if the electronic device includes two sound-emitting devices, two audio acquisition devices can be configured for each sampling point to sample the audio from each sound-emitting device.
[0160] S603: The electronic device outputs first audio data through the first sound-emitting device, and outputs second audio data through the second sound-emitting device.
[0161] After the electronic device determines the listening area sampling point and the sound leakage area sampling point, the electronic device can output the first audio data and the second audio data. That is, the electronic device can output the first audio data through the first sound-emitting device and the second audio data through the second sound-emitting device, thereby sampling the audio in the listening area at the listening area sampling point and sampling the audio in the sound leakage area at the sound leakage area sampling point. That is, the first audio data and the second audio data can be test audio data.
[0162] When the electronic device includes two sound-emitting devices, which are an earpiece included in the electronic device and a screen sound-emitting device included in the electronic device, the first sound-emitting device may be the earpiece included in the electronic device, and the second sound-emitting device may be the screen sound-emitting device included in the electronic device.
[0163] The first audio data output by the first sound-emitting device and the second audio data output by the second sound-emitting device can be the same or different. For example, the frequencies of the first audio data and the second audio data can be the same or different. This is not limited in the embodiments of the present application. The embodiments of the present application are illustrated by taking the first audio data and the second audio data as the same audio.
[0164] S604: The electronic device obtains the sound energy corresponding to the sampling points in the listening area and the sound energy corresponding to the sampling points in the sound leakage area.
[0165] After the electronic device outputs the first audio data through the first sound emitting device and the second audio data through the second sound emitting device, the electronic device may obtain the sound energy corresponding to the sampling points in the listening area and the sound energy corresponding to the sampling points in the sound leakage area.
[0166] The sound energy corresponding to the sampling points in the listening area may include the sound energy corresponding to the sampling points in the listening area of the first audio data and the sound energy corresponding to the sampling points in the listening area of the second audio data. The sound energy corresponding to the sampling points in the leakage area may include the sound energy corresponding to the sampling points in the leakage area of the first audio data and the sound energy corresponding to the sampling points in the leakage area of the second audio data.
[0167] Acoustic energy refers to the energy of sound waves (i.e., the first and second audio data described above) propagating through a medium. This energy, on the one hand, causes the medium's particles to reciprocate near their equilibrium positions, generating kinetic energy. On the other hand, it also causes the medium to undergo a process of compression and expansion, imparting deformation potential energy. The sum of these two energies is the acoustic energy imparted to the medium by the acoustic vibrations. The magnitude of the acoustic energy reflects the intensity of the sound. Specifically, when the acoustic energy corresponding to a sampling point is high, the sound audible at that sampling point is louder; when the acoustic energy corresponding to a sampling point is low, the sound audible at that sampling point is quieter.
[0168] The sound energy corresponding to the listening area sampling points may include the sound energy corresponding to the first audio data and the sound energy corresponding to the second audio data at each listening area sampling point. The sound energy corresponding to the leakage area sampling points may include the sound energy corresponding to the first audio data and the sound energy corresponding to the second audio data at each leakage area sampling point.
[0169] In some examples, acoustic energy can be characterized by a transfer function (also known as an impulse response, which is the time response caused by applying an impulse function to an input). A transfer function is a concept in engineering control theory that reflects the functional relationship between a system's output and input. It is a frequency-domain analysis method. It is derived by taking the ratio of the Laplace transform of the output function (with respect to time) to the Laplace transform of the input function (with respect to time).
[0170] In some examples, the electronic device obtaining the sound energy corresponding to the sampling points in the listening area and the sound energy corresponding to the sampling points in the leakage area may include, at each sampling point in the listening area, collecting the sound energy corresponding to the first audio data and the sound energy corresponding to the second audio data using an audio collection device, so that the electronic device can obtain the transfer function corresponding to the first audio data and the transfer function corresponding to the second audio data at each sampling point in the listening area. At each sampling point in the leakage area, the electronic device collecting the sound energy corresponding to the first audio data and the sound energy corresponding to the second audio data using the audio collection device, so that the electronic device can obtain the transfer function corresponding to the first audio data and the transfer function corresponding to the second audio data at each sampling point in the leakage area.
[0171] S605: The electronic device determines the sound energy corresponding to the listening area according to the sound energy corresponding to the sampling points in the listening area, and determines the sound energy corresponding to the leakage area according to the sound energy corresponding to the sampling points in the leakage area.
[0172] After the electronic device obtains the sound energy corresponding to the sampling points in the listening area and the sound energy corresponding to the sampling points in the leakage area, the electronic device can determine the sound energy corresponding to the listening area based on the sound energy corresponding to the sampling points in the listening area. The sound energy corresponding to the listening area can include a first sound energy corresponding to the first audio data in the listening area and a third sound energy corresponding to the second audio data in the listening area. The sound energy corresponding to the leakage area can also be determined based on the sound energy corresponding to the sampling points in the leakage area. The sound energy corresponding to the leakage area can include a second sound energy corresponding to the first audio data in the leakage area and a fourth sound energy corresponding to the second audio data in the leakage area.
[0173] That is, the sound energy corresponding to the listening area may include the sound energy corresponding to the first sound device and the sound energy corresponding to the second sound device. The sound energy corresponding to the leakage area may include the sound energy corresponding to the first sound device and the sound energy corresponding to the second sound device.
[0174] When there are multiple listening area sampling points, the electronic device determines the sound energy corresponding to the listening area based on the sound energy corresponding to the listening area sampling points, which may include: the electronic device determines the listening area sound energy corresponding to the first sound emitting device based on the sound energy corresponding to the first audio data of the multiple listening area sampling points; the electronic device determines the listening area sound energy corresponding to the second sound emitting device based on the sound energy corresponding to the second audio data of the multiple listening area sampling points; the electronic device determines the leakage area sound energy corresponding to the first sound emitting device based on the sound energy corresponding to the first audio data of each leakage area sampling point; and the electronic device determines the leakage area sound energy corresponding to the second sound emitting device based on the sound energy corresponding to the second audio data of each leakage area sampling point.
[0175] In some examples, when sound energy is represented by a transfer function, the electronic device determines the sound energy corresponding to the listening area based on the sound energy corresponding to the listening area sampling point, which may include: the electronic device determines the listening area transfer function corresponding to the first sound device based on the transfer functions corresponding to the first audio data of multiple listening area sampling points (which may also be referred to as the first transfer function in the embodiment of the present application); the electronic device determines the listening area transfer function corresponding to the second sound device based on the transfer functions corresponding to the second audio data of multiple listening area sampling points (which may also be referred to as the third transfer function in the embodiment of the present application); the electronic device determines the leakage area transfer function corresponding to the first sound device based on the transfer function corresponding to the first audio data of each leakage area sampling point (which may also be referred to as the second transfer function in the embodiment of the present application); the electronic device determines the leakage area transfer function corresponding to the second sound device based on the transfer function corresponding to the second audio data of each leakage area sampling point (which may also be referred to as the fourth transfer function in the embodiment of the present application).
[0176] In some examples, when the electronic device determines the sound energy corresponding to the listening area based on the sound energy corresponding to the listening area sampling points, the electronic device may determine the sound energy corresponding to the listening area based on the weight of each listening area sampling point. Different listening area sampling points may be assigned different weights. Listening area sampling points in the area where the user in the listening area most desires to hear audio may be assigned higher weights, while listening area sampling points in the area where the user in the listening area does not desire to hear audio may be assigned lower weights.
[0177] Based on the sound energy corresponding to the sound leakage zone sampling points, the electronic device can determine the sound energy corresponding to the sound leakage zone based on the weight of each sound leakage zone sampling point. Different listening zone sampling points can be assigned different weights. Sound leakage zone sampling points in the area where the user least wants to hear audio can be assigned higher weights, while sound leakage zone sampling points in other areas of the sound leakage zone can be assigned lower weights.
[0178] For example, as shown in FIG8 , mobile phone 04 includes two sound-generating devices (earpiece 06 and screen sound-generating device 05). Earpiece 06 is located at the top edge of the screen of mobile phone 04, and screen sound-generating device 05 can be located below the screen of mobile phone 04, near earpiece 06. When a user makes a call on mobile phone 04, the corresponding listening zone is the area on one side of the screen of mobile phone 04 and in the same plane as the user's ear, and the leakage zone is the area on the other side of the screen of mobile phone 04 and in the same plane as the user's ear. Next, listening zone sampling points 08 are evenly distributed within the listening zone, with adjacent listening zone sampling points 08 spaced uniformly apart. Leakage zone sampling points 09 are evenly distributed within the leakage zone, with adjacent leakage zone sampling points 09 spaced uniformly apart. After determining listening zone sampling points 08 and leakage zone sampling points 09, different weights are assigned to different listening zone sampling points 08. As shown in FIG9 , multiple listening zone sampling points 08 within region 10 of the listening zone can be assigned higher weights. Different weights are set for different sound leakage area sampling points 09. As shown in FIG9 , a plurality of sound leakage area sampling points 09 in the sound leakage area 11 can be set with higher weights.
[0179] After obtaining the sound energy corresponding to each listening area sampling point 08, the sound energy corresponding to the listening area can be determined based on the weight corresponding to each listening area sampling point 08. After obtaining the sound energy corresponding to each leakage area sampling point 09, the sound energy corresponding to the leakage area can be determined based on the weight corresponding to each leakage area sampling point 09.
[0180] S606: The electronic device determines optimization coefficients corresponding to the playback filter according to the sound energy corresponding to the listening area and the sound energy corresponding to the sound leakage area. The optimization coefficients include optimization coefficients corresponding to the first playback filter and optimization coefficients corresponding to the second playback filter.
[0181] After the electronic device determines the sound energy corresponding to the listening area based on the sound energy corresponding to the sampling points in the listening area, and determines the sound energy corresponding to the leakage area based on the sound energy corresponding to the sampling points in the leakage area, the electronic device may determine the optimization coefficient corresponding to the playback filter (also referred to as the audio optimization coefficient in this embodiment of the application) based on the sound energy corresponding to the listening area and the sound energy corresponding to the leakage area. The audio optimization coefficient may include the optimization coefficient corresponding to the first playback filter and the optimization coefficient corresponding to the second playback filter, and may also be referred to as an objective function.
[0182] The playback filter can be used to filter the input signal (i.e., audio data) of the sound-generating device, so that the sound-generating device can output the input information (i.e., audio data) after filtering. The number of playback filters corresponds one-to-one to the number of sound-generating devices. That is, when the electronic device includes a first sound-generating device and a second sound-generating device, the electronic device includes a first playback filter and a second playback filter. The first playback filter corresponds to the first sound-generating device, i.e., the first playback filter filters the input signal (i.e., audio data) of the first sound-generating device, so that the first sound-generating device can output the input information (i.e., audio data) after filtering. The second playback filter corresponds to the second sound-generating device, i.e., the second playback filter filters the input signal (i.e., audio data) of the second sound-generating device, so that the second sound-generating device can output the input information (i.e., audio data) after filtering.
[0183] In some examples, the electronic device determines the optimization coefficient corresponding to the playback filter based on the sound energy corresponding to the listening area and the sound energy corresponding to the leakage area, which may include: the electronic device determines the optimization coefficient corresponding to the first playback filter based on the sound energy in the listening area corresponding to the first sound device and the sound energy in the leakage area corresponding to the first sound device.
[0184] The optimization coefficient corresponding to the first playback filter can be the acoustic energy contrast corresponding to the first sound-emitting device. The acoustic energy contrast can be the ratio of the acoustic energy in the listening area to the acoustic energy in the leakage area. That is, the acoustic energy contrast of the first sound-emitting device can be the ratio of the acoustic energy in the listening area corresponding to the first sound-emitting device to the acoustic energy in the leakage area corresponding to the first sound-emitting device. To minimize the acoustic energy of the first sound-emitting device in the leakage area, the acoustic energy contrast of the first sound-emitting device can be maximized. When the acoustic energy contrast of the first sound-emitting device is maximized, the acoustic energy in the leakage area corresponding to the first sound-emitting device is minimized.
[0185] In some examples, when sound energy is represented by a transfer function, the electronic device determines the optimization coefficient corresponding to the first playback filter based on the sound energy in the listening area corresponding to the first sound-emitting device and the sound energy in the leakage area corresponding to the first sound-emitting device. This may include: the electronic device determines the listening area transfer function corresponding to the first sound-emitting device based on the transfer functions corresponding to the first audio data at multiple listening area sampling points. The electronic device determines the leakage area transfer function corresponding to the first sound-emitting device based on the transfer function corresponding to the first audio data at each leakage area sampling point. Thereafter, the electronic device may determine the optimization coefficient corresponding to the first playback filter based on the ratio of the listening area transfer function corresponding to the first sound-emitting device to the leakage area transfer function corresponding to the first sound-emitting device. That is, when the ratio of the listening area transfer function corresponding to the first sound-emitting device to the leakage area transfer function corresponding to the first sound-emitting device is maximized, the maximum value becomes the optimization coefficient corresponding to the first playback filter (in this case, the first optimization coefficient may also be referred to as the first objective function).
[0186] In some examples, the electronic device determines the optimization coefficient corresponding to the playback filter based on the sound energy corresponding to the leakage area and the sound energy corresponding to the leakage area, which may include: the electronic device determines the optimization coefficient corresponding to the second playback filter based on the sound energy of the leakage area corresponding to the second sound-emitting device and the sound energy of the leakage area corresponding to the second sound-emitting device.
[0187] The optimization coefficient corresponding to the second playback filter can be the acoustic energy contrast corresponding to the second sound-emitting device. The acoustic energy contrast can be the ratio of the acoustic energy in the listening area to the acoustic energy in the leakage area. That is, the acoustic energy contrast of the second sound-emitting device can be the ratio of the acoustic energy in the listening area corresponding to the second sound-emitting device to the acoustic energy in the leakage area corresponding to the second sound-emitting device. To minimize the acoustic energy of the second sound-emitting device in the leakage area, the acoustic energy contrast of the second sound-emitting device can be maximized. When the acoustic energy contrast of the second sound-emitting device is maximized, the acoustic energy in the leakage area corresponding to the second sound-emitting device is minimized.
[0188] In some examples, when sound energy is represented by a transfer function, the electronic device determining the optimization coefficient corresponding to the second playback filter based on the sound energy in the listening area corresponding to the second sound-emitting device and the sound energy in the leakage area corresponding to the second sound-emitting device may include: the electronic device determining the listening area transfer function corresponding to the second sound-emitting device based on the transfer functions corresponding to the second audio data at multiple listening area sampling points. The electronic device determining the leakage area transfer function corresponding to the second sound-emitting device based on the transfer function corresponding to the second audio data at each leakage area sampling point. Thereafter, the electronic device may determine the optimization coefficient corresponding to the second playback filter based on the ratio of the listening area transfer function corresponding to the second sound-emitting device to the leakage area transfer function corresponding to the second sound-emitting device. That is, when the ratio of the listening area transfer function corresponding to the second sound-emitting device to the leakage area transfer function corresponding to the second sound-emitting device is maximum, the maximum value is the optimization coefficient corresponding to the second playback filter (in this case, the second optimization coefficient may also be referred to as a second objective function).
[0189] S607: The electronic device optimizes the first playback filter according to the optimization coefficient corresponding to the first playback filter, and optimizes the second playback filter according to the optimization coefficient corresponding to the second playback filter.
[0190] After the electronic device determines the optimization coefficients corresponding to the playback filters (i.e., audio optimization coefficients) based on the sound energy corresponding to the listening area and the sound energy corresponding to the sound leakage area, the optimization coefficients include the optimization coefficients corresponding to the first playback filter and the optimization coefficients corresponding to the second playback filter. The electronic device can optimize the first playback filter based on the optimization coefficients corresponding to the first playback filter, and optimize the second playback filter based on the optimization coefficients corresponding to the second playback filter. That is, the audio optimization coefficients can be used to reduce the sound energy corresponding to the third audio data corresponding to the first sound emitting device and the fourth audio data corresponding to the second sound emitting device in the sound leakage area.
[0191] In some examples, the electronic device optimizes the first playback filter based on the optimization coefficient corresponding to the first playback filter, which may include: the first playback filter can be multiplied by the optimization coefficient corresponding to the first playback filter, so that the optimized first playback filter can filter the input signal of the first sound device.
[0192] The electronic device optimizes the second playback filter according to the optimization coefficient corresponding to the second playback filter, which may include: the second playback filter can be multiplied by the optimization coefficient corresponding to the second playback filter, so that the optimized second playback filter can filter the input signal of the second sound device.
[0193] S608: The electronic device filters the input signal of the first sound-emitting device through the optimized first playback filter, and filters the input signal of the second sound-emitting device through the optimized second playback filter.
[0194] After the electronic device optimizes the first playback filter according to the optimization coefficient corresponding to the first playback filter, and optimizes the second playback filter according to the optimization coefficient corresponding to the second playback filter, the electronic device can filter the input signal of the first sound-emitting device through the optimized first playback filter, and filter the input signal of the second sound-emitting device through the optimized second playback filter.
[0195] The input signal of the first sound-emitting device may be an audio signal input by the electronic device to the first sound-emitting device when the user uses the electronic device for voice communication. The input signal of the second sound-emitting device may be an audio signal input by the electronic device to the second sound-emitting device when the user uses the electronic device for voice communication.
[0196] In some examples, before the electronic device filters the input signal of the first sound-emitting device through the optimized first playback filter and filters the input signal of the second sound-emitting device through the optimized second playback filter, the electronic device may determine whether a usage scenario in which the electronic device outputs the optimized input signal is the same as a usage scenario in which the electronic device outputs the first audio data and the second audio data. If the usage scenario in which the electronic device outputs the optimized input signal is the same as the usage scenario in which the electronic device outputs the first audio data and the second audio data, the input signal of the first sound-emitting device may be filtered through the optimized first playback filter, and the input signal of the second sound-emitting device may be filtered through the optimized second playback filter.
[0197] When the usage scenario in which the electronic device outputs the optimized input signal is different from the usage scenario in which the electronic device outputs the first audio data and the second audio data, the electronic device can first obtain the audio optimization coefficient corresponding to the usage scenario in which the optimized input signal is output, and then filter the filter using the audio optimization coefficient corresponding to the usage scenario in which the optimized input signal is output, and filter the input signal using the optimized filter to obtain the optimized input signal.
[0198] S609: The electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device, and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device.
[0199] After the electronic device filters the input signal of the first sound-emitting device through the optimized first playback filter and filters the input signal of the second sound-emitting device through the optimized second playback filter, the electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device, and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device.
[0200] The third audio data may be the audio data output by the first sound device when the user uses the electronic device for voice communication. The fourth audio data may be the audio data output by the second sound device when the user uses the electronic device for voice communication.
[0201] After the electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device, because the optimization coefficient of the filtering of the first playback filter is the value corresponding to the maximum acoustic energy contrast of the first sound-emitting device, the acoustic energy of the third audio data output by the first sound-emitting device is reduced in the sound leakage zone, while the acoustic energy of the third audio data output by the first sound-emitting device is not reduced in the listening zone. Furthermore, because the optimization coefficient of the filtering of the second playback filter is the value corresponding to the maximum acoustic energy contrast of the second sound-emitting device, the acoustic energy of the fourth audio data output by the second sound-emitting device is reduced in the sound leakage zone, while the acoustic energy of the fourth audio data output by the second sound-emitting device is not reduced in the listening zone.
[0202] Therefore, the electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device, and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device. This reduces the acoustic energy of the third audio data output by the first sound-emitting device in the sound leakage zone, and reduces the acoustic energy of the fourth audio data output by the second sound-emitting device in the sound leakage zone, thereby preventing sound leakage from the earpiece. Furthermore, after the electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device, and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device, the third audio data output by the first sound-emitting device and the fourth audio data output by the second sound-emitting device can achieve interference cancellation in the sound leakage zone. Furthermore, while the acoustic energy of the third audio data output by the first sound-emitting device is reduced in the sound leakage zone, the acoustic energy of the fourth audio data output by the second sound-emitting device is not reduced in the listening zone. Therefore, the third audio data output by the first sound-emitting device and the fourth audio data output by the second sound-emitting device still achieve sound field reproduction in the listening zone without reducing the acoustic energy in the listening zone, thereby ensuring the user's listening experience.
[0203] For example, as shown in FIG9 , let's continue with the example of a mobile phone 04 including two sound-generating devices (earpiece 06 and screen sound-generating device 05). Earpiece 06 is located at the top edge of the screen of mobile phone 04, and screen sound-generating device 05 can be located below the screen of mobile phone 04 and near earpiece 06. When a user makes a call on mobile phone 04, the corresponding listening zone is the area on one side of the screen of mobile phone 04 and in the same plane as the user's ear, and the leakage zone is the area on the other side of the screen of mobile phone 04 and in the same plane as the user's ear. Next, listening zone sampling points 08 are evenly distributed within the listening zone, with adjacent listening zone sampling points 08 spaced uniformly apart. Leakage zone sampling points 09 are evenly distributed within the leakage zone, with adjacent leakage zone sampling points 09 spaced uniformly apart. After determining listening zone sampling points 08 and leakage zone sampling points 09, different weights are assigned to different listening zone sampling points 08. Multiple listening zone sampling points 08 within region 10 of the listening zone can be assigned higher weights. Different weights are set for different sound leakage area sampling points 09. Higher weights can be set for multiple sound leakage area sampling points 09 in the sound leakage area 11. Based on the sound energy of the listening area sampling point 08, the corresponding sound energy of the earpiece in the listening area and the corresponding sound energy of the screen sound device 05 in the listening area can be determined. Based on the sound energy of the sound leakage area sampling point 09, the corresponding sound energy of the earpiece in the sound leakage area and the corresponding sound energy of the screen sound device 05 in the sound leakage area can be determined. After that, the optimization coefficient corresponding to the playback filter (i.e., the first playback filter) corresponding to the earpiece 04 and the optimization coefficient corresponding to the playback filter (i.e., the second playback filter) corresponding to the screen sound device 05 can be determined.
[0204] Afterwards, the first playback filter can be optimized according to the optimization coefficient corresponding to the first playback filter, and the second playback filter can be optimized according to the optimization coefficient corresponding to the second playback filter. The input signal of the first sound-emitting device (i.e., the earpiece 04) is filtered by the optimized first playback filter, and the input signal of the second sound-emitting device (i.e., the screen sound-emitting device 05) is filtered by the optimized second playback filter. The third audio data filtered by the first playback filter is output by the first sound-emitting device (i.e., the earpiece 04), and the fourth audio data filtered by the second playback filter is determined to be output by the second sound-emitting device (i.e., the screen sound-emitting device 05).
[0205] After the third audio data filtered by the first playback filter is output through the first sound-emitting device (i.e., the earpiece 04), and after determining that the fourth audio data filtered by the second playback filter is output through the second sound-emitting device (i.e., the screen sound-emitting device 05), the sound energy in the listening area and the sound energy in the leakage area can be collected. The sound energy corresponding to the sampling point in the leakage area shown in (a) of Figure 10 is the sound energy corresponding to the sampling point in the leakage area before optimization, and the sound energy corresponding to the sampling point in the leakage area shown in (b) of Figure 10 is the sound energy corresponding to the sampling point in the leakage area after optimization. By comparison, it can be seen that the sound energy corresponding to the sampling point in the leakage area after optimization is lower than the sound energy corresponding to the sampling point in the leakage area before optimization.
[0206] In some examples, the usage scenarios of the third audio data and the fourth audio data output by the electronic device are the same as the usage scenarios of the first audio data and the second audio data output by the electronic device.
[0207] In the solution of the present application, since the optimization coefficients of the playback filters corresponding to at least two sound-emitting devices are the maximum value of the sound energy contrast between the sound energy in the listening area and the sound energy in the leakage area, the optimized playback filter can reduce the sound energy in the leakage area, and at the same time, the optimized playback filter can keep the sound energy in the listening area unchanged. Moreover, after the electronic device outputs the third audio data filtered by the first playback filter through the first sound-emitting device, and determines to output the fourth audio data filtered by the second playback filter through the second sound-emitting device, the third audio data output by the first sound-emitting device and the fourth audio data output by the second sound-emitting device can achieve interference cancellation in the leakage area, further reducing the sound energy in the leakage area. In other words, the solution of the present application can reduce the sound energy in the leakage area while realizing sound field playback using at least two sound-emitting devices. That is, the solution of the present application can ensure the user's listening experience while preventing sound leakage.
[0208] For ease of understanding, the audio processing method provided by the embodiment of the present application is described below with reference to FIG11. As shown in FIG11, the audio processing method may include the following S1101-S1108.
[0209] S1101: Determine a usage scenario in which an electronic device outputs first audio data and second audio data.
[0210] The electronic device in the embodiment of the present application may include at least two sound-generating devices. The at least two sound-generating devices may include at least one of an earpiece of the electronic device, a speaker of the electronic device, or a screen sound-generating device of the electronic device.
[0211] In some examples, when an electronic device includes at least two sound-emitting devices, the electronic device can achieve sound field playback through the two sound-emitting devices. The at least two sound-emitting devices included in the electronic device can include a first sound-emitting device and a second sound-emitting device. For example, when the electronic device includes two sound-emitting devices, that is, the electronic device includes an earpiece and a screen sound-emitting device, when a user uses the electronic device to make a call, the electronic device can output audio data through the earpiece and the screen sound-emitting device, thereby achieving sound field playback.
[0212] When implementing the audio processing method provided in the embodiments of the present application, the electronic device may first determine a usage scenario in which the electronic device outputs the first audio data and the second audio data. Thus, the electronic device may determine the listening area and sound leakage area corresponding to the output of the first audio data and the second audio data based on the usage scenario in which the electronic device outputs the first audio data and the second audio data. The first audio data refers to the audio data output by the electronic device through the first sound-emitting device. The second audio data refers to the audio data output by the electronic device through the second sound-emitting device.
[0213] The usage scenario in which the electronic device outputs the first audio data and the second audio data may include a scenario in which the electronic device achieves the effect of sound field playback through two sound-emitting devices (such as an earpiece and a screen sound-emitting device). The usage scenario in which the electronic device outputs the first audio data and the second audio data may also include the usage parameters of the electronic device and the parameters of the sound-emitting device included in the electronic device. The usage parameters of the electronic device may include the position, angle, and distance of the electronic device from the user (such as the distance between the electronic device and the user's ear when the user uses the electronic device) when the user uses the electronic device to make a voice call. The parameters of the sound-emitting device included in the electronic device may include the setting position of the sound-emitting device, the distance between the sound-emitting devices, etc., such as the position and distance of the earpiece and screen sound-emitting device included in the electronic device.
[0214] Specifically, the specific implementation of determining the usage scenario of the electronic device outputting the first audio data and the second audio data in the embodiment of the present application can refer to the specific implementation in the above S601, which will not be repeated in the embodiment of the present application.
[0215] S1102: Determine a listening area and a sound leakage area according to a usage scenario in which the electronic device outputs the first audio data and the second audio data.
[0216] After determining the usage scenario in which the electronic device outputs the first audio data and the second audio data, the listening area and the sound leakage area can be determined according to the usage scenario in which the electronic device outputs the first audio data and the second audio data, that is, the listening area and the sound leakage area corresponding to the usage scenario in which the first audio data and the second audio data are output.
[0217] The first audio data and the second audio data may be audio data used when determining the audio optimization coefficient, such as test audio data.
[0218] In some examples, after determining the listening area and the sound leakage area corresponding to the usage scenarios of the first audio data and the second audio data, sampling points corresponding to the listening area and the sound leakage area can be determined. There can be multiple sampling points corresponding to the listening area, and there can also be multiple sampling points corresponding to the sound leakage area. The sampling points corresponding to the listening area can be used to sample the audio data in the listening area, thereby determining the acoustic energy in the listening area. The sampling points corresponding to the sound leakage area can be used to sample the audio data in the sound leakage area, thereby determining the acoustic energy in the sound leakage area.
[0219] Specifically, in the embodiment of the present application, the specific implementation method of determining the listening area and the sound leakage area according to the usage scenario of the electronic device outputting the first audio data and the second audio data can refer to the specific implementation method in the above S602, which will not be repeated in the embodiment of the present application.
[0220] S1103 , outputting first audio data through the first sound-emitting device, and outputting second audio data through the second sound-emitting device.
[0221] After determining the listening area and the leakage area (i.e., the listening area and the leakage area corresponding to the usage scenarios of the first audio data and the second audio data), the first audio data can be output through the first sound-emitting device, and the second audio data can be output through the second sound-emitting device, so that at the sampling point corresponding to the listening area, the first sound energy corresponding to the first audio data in the listening area and the third sound energy corresponding to the first audio data in the listening area can be obtained, and at the sampling point corresponding to the leakage area, the second sound energy corresponding to the first audio data in the leakage area and the fourth sound energy corresponding to the first audio data in the leakage area can be obtained.
[0222] It should be noted that when the electronic device includes multiple sound-emitting devices, the electronic device outputs the first audio data through the first sound-emitting device and outputs the second audio data through the second sound-emitting device. The electronic device can output audio data separately through each sound-emitting device.
[0223] It should be noted that when an electronic device includes multiple sound-emitting devices, the audio data output by the electronic device through each sound-emitting device may be the same or different, and this is not limited in the embodiments of the present application.
[0224] Specifically, the specific implementation of outputting the first audio data through the first sound-emitting device and outputting the second audio data through the second sound-emitting device in the embodiment of the present application can refer to the specific implementation in the above S603, which will not be repeated in the embodiment of the present application.
[0225] S1104 : Obtain first sound energy corresponding to the first audio data in the listening area and second sound energy corresponding to the sound leakage area, and obtain third sound energy corresponding to the second audio data in the listening area and fourth sound energy corresponding to the sound leakage area.
[0226] After the first audio data is output through the first sound-emitting device and the second audio data is output through the second sound-emitting device, the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area can be obtained, as well as the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area can be obtained.
[0227] In some examples, obtaining the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the leakage area may include obtaining a first transfer function corresponding to the first audio data in the listening area and obtaining a second transfer function corresponding to the first audio data in the leakage area. Subsequently, the first sound energy corresponding to the first audio data in the listening area may be determined based on the first transfer function corresponding to the listening area, and the second sound energy corresponding to the first audio data in the leakage area may be determined based on the second transfer function corresponding to the leakage area.
[0228] In some examples, obtaining the first transfer function corresponding to the first audio data in the listening area may include obtaining a transfer function of the first audio data at each sampling point in the listening area. Subsequently, the first transfer function corresponding to the first audio data in the listening area may be determined based on the transfer function of the first audio data at each sampling point in the listening area.
[0229] Obtaining the second transfer function corresponding to the first audio data in the sound leakage area may include obtaining a transfer function of the first audio data at each sampling point in the sound leakage area. Subsequently, the transfer function corresponding to the first audio data in the sound leakage area may be determined based on the transfer function of the first audio data at each sampling point in the sound leakage area.
[0230] In some examples, determining the first transfer function corresponding to the first audio data in the listening area based on the transfer functions of the first audio data at each sampling point in the listening area may include determining a weight corresponding to each sampling point in the listening area. Subsequently, determining the first transfer function corresponding to the first audio data in the listening area based on the weights corresponding to each sampling point in the listening area and the transfer functions of each sampling point in the listening area. Using the weights corresponding to each sampling point in the listening area, the first transfer function corresponding to the first audio data in the listening area can be accurately determined, thereby determining a first sound energy corresponding to the listening area and a second sound energy corresponding to the sound leakage area.
[0231] It should be noted that the above-mentioned method for obtaining the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area can be the same as the above-mentioned method for obtaining the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area. This will not be repeated in the embodiments of the present application.
[0232] In some examples, when the electronic device includes multiple sound-emitting devices, the above-mentioned obtaining of the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area, as well as obtaining of the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area, may include: respectively obtaining the sound energy corresponding to the audio data corresponding to each sound-emitting device in the listening area and the sound energy corresponding to the audio data corresponding to each sound-emitting device in the sound leakage area.
[0233] Specifically, the specific implementation methods of obtaining the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area, as well as obtaining the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area in the embodiment of the present application can refer to the specific implementation methods in S604-S605 above, and will not be repeated in the embodiment of the present application.
[0234] S1105 : Determine an audio optimization coefficient according to the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage sound area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage sound area.
[0235] After obtaining a first sound energy corresponding to the listening area, a second sound energy corresponding to the sound leakage area, a third sound energy corresponding to the listening area, and a fourth sound energy corresponding to the sound leakage area, an audio optimization coefficient may be determined based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the sound leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the sound leakage area. The audio optimization coefficient may be used to reduce the sound energy corresponding to the third audio data corresponding to the first sound emitting device and the fourth audio data corresponding to the second sound emitting device in the sound leakage area.
[0236] The third audio data corresponding to the first sound-emitting device and the fourth audio data corresponding to the second sound-emitting device may be audio data output by the electronic device when the user actually uses the electronic device. That is, the third audio data corresponding to the first sound-emitting device is audio data input by the electronic device to the first sound-emitting device when the user actually uses the electronic device, and the fourth audio data corresponding to the second sound-emitting device is audio data input by the electronic device to the second sound-emitting device when the user actually uses the electronic device.
[0237] In some examples, the audio optimization coefficient may include a first optimization coefficient and a second optimization coefficient. The first optimization coefficient may be used to optimize a filter (e.g., a playback filter) corresponding to the first sound-emitting device, thereby reducing the acoustic energy corresponding to third audio data corresponding to the first sound-emitting device in the sound leakage area. The second optimization coefficient may be used to optimize a filter (e.g., a playback filter) corresponding to the second sound-emitting device, thereby reducing the acoustic energy corresponding to fourth audio data corresponding to the second sound-emitting device in the sound leakage area.
[0238] In some examples, determining the first optimization coefficient based on the first sound energy corresponding to the listening area and the second sound energy corresponding to the sound leakage area may include determining a first sound energy contrast ratio between the first sound energy and the second sound energy, where the first sound energy contrast ratio may be a ratio of the first sound energy to the second sound energy. Subsequently, determining the first optimization coefficient based on the first sound energy contrast ratio. Based on the first sound energy contrast ratio between the sound energy corresponding to the listening area and the sound energy corresponding to the sound leakage area, the first optimization coefficient can be accurately determined, thereby reducing the sound energy of the audio data in the sound leakage area using the first optimization coefficient.
[0239] In some examples, determining the first optimization coefficient based on the first sound energy contrast ratio may include determining the first optimization coefficient as a value corresponding to when the first sound energy contrast ratio is maximized. Since the first optimization coefficient is determined as the value corresponding to when the first sound energy contrast ratio is maximized, the first optimization coefficient can be used to further reduce the sound energy of the audio data in the sound leakage area.
[0240] In some examples, determining the second optimization coefficient based on the third sound energy corresponding to the listening area and the fourth sound energy corresponding to the sound leakage area may include determining a second sound energy contrast ratio between the third sound energy and the fourth sound energy, where the second sound energy contrast ratio may be a ratio of the third sound energy to the fourth sound energy. Subsequently, determining the second optimization coefficient based on the second sound energy contrast ratio.
[0241] In some examples, determining the second optimization coefficient based on the second acoustic energy contrast may include: determining a value corresponding to maximizing the second acoustic energy contrast as the second optimization coefficient.
[0242] It should be noted that when the electronic device includes multiple sound-emitting devices, determining the audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area may include determining the optimization coefficient for each sound-emitting device based on the sound energy corresponding to the listening area and the sound energy corresponding to the leakage area of each sound-emitting device. That is, the audio optimization coefficient includes optimization coefficients corresponding to multiple sound-emitting devices.
[0243] Specifically, in the embodiment of the present application, the specific implementation method of determining the audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area can refer to the specific implementation method in the above S606, which will not be repeated in the embodiment of the present application.
[0244] S1106. Optimize the first filter corresponding to the first sound-emitting device according to the first optimization coefficient, and filter the third audio data using the optimized first filter to obtain filtered third audio data.
[0245] After determining the first optimization coefficient, the first filter corresponding to the first sound device can be optimized according to the first optimization coefficient, so that the third audio data is filtered by the optimized first filter to obtain the filtered third audio data, so that the first sound device can output the filtered third audio data.
[0246] It should be noted that when an electronic device includes multiple sound-emitting devices, the electronic device includes multiple filters (also called playback filters), and the filters correspond to the sound-emitting devices one-to-one. The audio optimization coefficient includes the optimization coefficients corresponding to the multiple sound-emitting devices. The above-mentioned first filter corresponding to the first sound-emitting device is optimized according to the first optimization coefficient, and the third audio data is filtered by the optimized first filter to obtain the filtered third audio data. It can include optimizing the filter corresponding to each sound-emitting device according to the optimization coefficient corresponding to each sound-emitting device, thereby filtering the audio data corresponding to each sound-emitting device by the optimized filter to obtain the filtered audio data, so that each sound-emitting device can output the corresponding filtered audio data respectively.
[0247] Specifically, in the embodiment of the present application, the first filter corresponding to the first sound device is optimized according to the first optimization coefficient, and the third audio data is filtered by the optimized first filter to obtain the filtered third audio data. For the specific implementation method, please refer to the specific implementation method in S607 above, which will not be repeated in the embodiment of the present application.
[0248] S1107 . Optimize the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, and filter the fourth audio data using the optimized second filter to obtain filtered fourth audio data.
[0249] After determining the second optimization coefficient, the second filter corresponding to the second sound device can be optimized according to the second optimization coefficient, so that the fourth audio data is filtered by the optimized second filter to obtain the filtered fourth audio data, so that the second sound device can output the filtered fourth audio data.
[0250] In some examples, the usage scenario in which the electronic device outputs the first audio data and the second audio data is the same as the usage scenario in which the electronic device outputs the third audio data and the fourth audio data. Since the usage scenario in which the electronic device outputs the first audio data and the second audio data is the same as the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, in the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, the audio optimization coefficient corresponding to the usage scenario in which the first audio data and the second audio data are used can be used to avoid the problem of sound leakage from the earpiece when the electronic device outputs the third audio data and the fourth audio data, thereby preventing the leakage of user privacy and improving user privacy security.
[0251] Before optimizing the first filter corresponding to the first sound-emitting device according to the first optimization coefficient and optimizing the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, the electronic device may determine whether a usage scenario in which the electronic device outputs the first audio data and the second audio data is the same as a usage scenario in which the electronic device outputs the third audio data and the fourth audio data. If the usage scenario in which the electronic device outputs the first audio data and the second audio data is the same as the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, the first filter corresponding to the first sound-emitting device may be optimized according to the first optimization coefficient, and the second filter corresponding to the second sound-emitting device may be optimized according to the second optimization coefficient.
[0252] When the usage scenario in which the electronic device outputs the first audio data and the second audio data is different from the usage scenario in which the electronic device outputs the third audio data and the fourth audio data, the electronic device can first obtain the audio optimization coefficient corresponding to the usage scenario in which the third audio data and the fourth audio data are output, and then filter the filter using the audio optimization coefficient corresponding to the usage scenario in which the third audio data and the fourth audio data are output, and filter the third audio data and the fourth audio data using the optimized filter to obtain the filtered third audio data and the fourth audio data.
[0253] The process of the electronic device obtaining the audio optimization coefficient corresponding to the usage scenario of outputting the third audio data and the fourth audio data can refer to the process of the electronic device obtaining the audio optimization coefficient corresponding to the usage scenario of outputting the first audio data and the second audio data in this application, and will not be repeated here in the embodiments of this application.
[0254] In some other examples, the frequency bands of the first audio data and the second audio data output by the electronic device are the same as the frequency bands of the third audio data and the fourth audio data output by the electronic device.
[0255] Before optimizing the first filter corresponding to the first sound-emitting device according to the first optimization coefficient and optimizing the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, the electronic device may determine whether the frequency bands of the first and second audio data output by the electronic device are the same as the frequency bands of the third and fourth audio data output by the electronic device. If the frequency bands of the first and second audio data output by the electronic device are the same as the frequency bands of the third and fourth audio data output by the electronic device, the first filter corresponding to the first sound-emitting device may be optimized according to the first optimization coefficient, and the second filter corresponding to the second sound-emitting device may be optimized according to the second optimization coefficient.
[0256] When the frequency band in which the electronic device outputs the first audio data and the second audio data is different from the frequency band in which the electronic device outputs the third audio data and the fourth audio data, the electronic device can first obtain the audio optimization coefficient corresponding to the frequency band in which the third audio data and the fourth audio data are output, and then filter the filter using the audio optimization coefficient corresponding to the frequency band in which the third audio data and the fourth audio data are output, and filter the third audio data and the fourth audio data using the optimized filter to obtain the filtered third audio data and the fourth audio data.
[0257] It should be noted that the order of executing S1106 and S1107 is not limited in the embodiments of the present application. That is, S1106 may be executed first and then S1107, or S1107 may be executed first and then S1106, or S1106 and S1107 may be executed simultaneously. The embodiments of the present application are illustrated by taking S1106 and S1107 as an example.
[0258] Specifically, in the embodiment of the present application, the second filter corresponding to the second sound device is optimized according to the second optimization coefficient, and the fourth audio data is filtered by the optimized second filter to obtain the filtered fourth audio data. For the specific implementation method, please refer to the specific implementation method in S608 above, which will not be repeated in the embodiment of the present application.
[0259] S1108. Output the filtered third audio data through the first sound-emitting device, and output the filtered fourth audio data through the second sound-emitting device.
[0260] After optimizing the first filter corresponding to the first sound-emitting device according to the first optimization coefficient and filtering the third audio data through the optimized first filter to obtain the filtered third audio data, and optimizing the second filter corresponding to the second sound-emitting device according to the second optimization coefficient and filtering the fourth audio data through the optimized second filter to obtain the filtered fourth audio data, the electronic device can output the filtered third audio data through the first sound-emitting device and output the filtered fourth audio data through the second sound-emitting device.
[0261] It should be noted that when an electronic device includes multiple sound-emitting devices and includes multiple filters, the above-mentioned steps of optimizing the first filter corresponding to the first sound-emitting device according to the first optimization coefficient, filtering the third audio data using the optimized first filter to obtain filtered third audio data, and optimizing the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, and filtering the fourth audio data using the optimized second filter to obtain filtered fourth audio data may include optimizing the filter corresponding to each sound-emitting device according to the optimization coefficient corresponding to the sound-emitting device, filtering the audio data corresponding to the sound-emitting device using the optimized filter, thereby obtaining multiple filtered audio data. Subsequently, the electronic device may output the corresponding filtered audio data through each sound-emitting device.
[0262] It should be noted that when an electronic device includes multiple sound-emitting devices, the audio data output by each sound-emitting device can be the same, or the audio data output by each sound-emitting device can be different, which is not limited in the embodiments of the present application.
[0263] The solution provided in the embodiment of the present application can accurately determine the audio optimization coefficient based on the sound energy contrast between the sound energy corresponding to the listening area and the sound energy corresponding to the leakage area, so that the sound energy corresponding to the audio data in the leakage area can be reduced by the audio optimization coefficient. That is, before the electronic device outputs the audio data, the electronic device can optimize the output audio data so that the sound energy corresponding to the output audio data in the leakage area is reduced. Thereby, the problem of sound leakage in the leakage area of the earpiece of the electronic device can be avoided, thereby preventing the leakage of user privacy and improving the privacy security of the user. At the same time, the optimized playback filter can keep the sound energy in the listening area unchanged. In other words, the solution of the present application can reduce the sound energy in the leakage area while realizing the sound field playback by using at least two sound-emitting devices. That is, the solution of the present application can ensure the user's hearing experience while preventing sound leakage.
[0264] Corresponding to the method in the aforementioned embodiment, an embodiment of the present application further provides an audio processing device. The audio processing device can be applied to an electronic device to implement the method in the aforementioned embodiment. The functions of the audio optimization device can be implemented by hardware or by executing corresponding software implementations in hardware. The hardware or software includes one or more modules corresponding to the above functions.
[0265] For example, FIG12 shows a schematic structural diagram of an audio processing device 12. As shown in FIG12, the audio processing device 12 may include: an output module 1201, an acquisition module 1202, and a determination module 1203.
[0266] The output module 1201 may be configured to output first audio data through a first sound-emitting device, and to output second audio data through a second sound-emitting device.
[0267] The acquisition module 1202 may be configured to acquire a first acoustic energy corresponding to the first audio data in the listening area and a second acoustic energy corresponding to the sound leakage area, and to acquire a third acoustic energy corresponding to the second audio data in the listening area and a fourth acoustic energy corresponding to the sound leakage area.
[0268] Determination module 1203 can be used to determine the audio optimization coefficient based on the first sound energy corresponding to the listening area, the second sound energy corresponding to the leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the leakage area; the audio optimization coefficient is used to reduce the sound energy corresponding to the third audio data corresponding to the first sound device and the fourth audio data corresponding to the second sound device in the leakage area.
[0269] In another possible implementation, the determination module 1203 may also be configured to determine a first acoustic energy contrast between the first acoustic energy and the second acoustic energy.
[0270] The determination module 1203 may also be configured to determine a first optimization coefficient according to the first acoustic energy contrast.
[0271] The determination module 1203 may also be configured to determine a second acoustic energy contrast ratio between the third acoustic energy and the fourth acoustic energy.
[0272] The determination module 1203 may also be configured to determine a second optimization coefficient according to the second acoustic energy contrast.
[0273] In another possible implementation, the determination module 1203 may also be configured to determine a value corresponding to the maximization of the first acoustic energy contrast as the first optimization coefficient.
[0274] The determination module 1203 may also be configured to determine a value corresponding to maximizing the second acoustic energy contrast as a second optimization coefficient.
[0275] In another possible implementation, the acquisition module 1202 may also be configured to acquire a first transfer function corresponding to the first audio data in the listening area, and acquire a second transfer function corresponding to the first audio data in the sound leakage area.
[0276] The determination module 1203 may also be configured to determine a first sound energy corresponding to the first audio data in the listening area according to a first transfer function corresponding to the listening area.
[0277] The determination module 1203 may also be configured to determine a second acoustic energy corresponding to the first audio data in the sound leakage area according to a second transfer function corresponding to the sound leakage area.
[0278] In another possible implementation, the acquisition module 1202 may also be configured to acquire a transfer function of the first audio data at each sampling point in the listening area.
[0279] The determination module 1203 may also be configured to determine a first transfer function corresponding to the first audio data in the listening area according to the transfer function of each sampling point of the first audio data in the listening area.
[0280] The acquisition module 1202 may also be configured to acquire a transfer function of each sampling point of the first audio data in the sound leakage area.
[0281] The determination module 1203 may also be configured to determine a second transfer function corresponding to the first audio data in the sound leakage area based on the transfer function of each sampling point of the first audio data in the sound leakage area.
[0282] In another possible implementation, the determination module 1203 may also be configured to determine a weight corresponding to each sampling point in the listening area.
[0283] The determination module 1203 may also be configured to determine a first transfer function corresponding to the first audio data in the listening area according to the weights corresponding to the sampling points in the listening area and the transfer functions of the sampling points in the listening area.
[0284] In another possible implementation, the audio processing device 12 may further include an optimization module 1204. The optimization module 1204 may be configured to optimize the first filter corresponding to the first sounding device according to the first optimization coefficient, and filter the third audio data using the optimized first filter to obtain filtered third audio data.
[0285] The optimization module 1204 may also be configured to optimize the second filter corresponding to the second sound-emitting device according to the second optimization coefficient, and filter the fourth audio data using the optimized second filter to obtain filtered fourth audio data.
[0286] The output module 1201 may also be configured to output the filtered third audio data through the first sound-emitting device, and output the filtered fourth audio data through the second sound-emitting device.
[0287] In another possible implementation, the determination module 1203 may also be configured to determine a usage scenario in which the electronic device outputs the first audio data and the second audio data.
[0288] The determination module 1203 may also be configured to determine a listening area and a sound leakage area according to usage scenarios of the first audio data and the second audio data.
[0289] In another possible implementation, the usage scenario of the third audio data and the fourth audio data is the same as the usage scenario of the first audio data and the second audio data.
[0290] In another possible implementation, the at least two sound-emitting devices include at least one of an earpiece of the electronic device, a speaker of the electronic device, or a screen sound-emitting device of the electronic device.
[0291] In another possible implementation, the first sound-emitting device is an earpiece of the electronic device, and the second sound-emitting device is a screen sound-emitting device of the electronic device.
[0292] It should be understood that the division of units or modules (hereinafter referred to as units) in the above devices is merely a division of logical functions. In actual implementation, they may be fully or partially integrated into a single physical entity, or physically separated. Furthermore, the units in the device may be implemented entirely in the form of software called through processing elements; entirely in the form of hardware; or partially in the form of software called through processing elements, and partially in the form of hardware.
[0293] For example, each unit can be a separately established processing element, or it can be integrated into a certain chip of the device for implementation. In addition, it can also be stored in a memory in the form of a program, and called by a certain processing element of the device to execute the function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above units can be implemented by the integrated logic circuit of the hardware in the processor element or in the form of software called by the processing element.
[0294] In one example, the units in the above apparatus may be one or more integrated circuits configured to implement the above method, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of at least two of these integrated circuit forms.
[0295] For another example, when the units in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a CPU or other processor that can call programs. For another example, these units can be integrated together and implemented in the form of a system on a chip (SOC).
[0296] In one implementation, the units implementing the corresponding steps of the above methods in the apparatus described above may be implemented in the form of a processing element scheduling program. For example, the apparatus may include a processing element and a storage element, with the processing element invoking a program stored in the storage element to execute the method described in the above method embodiments. The storage element may be a storage element on the same chip as the processing element, i.e., an on-chip storage element.
[0297] In another implementation, the program for executing the above method may be stored in a memory element on a different chip from the processing element, i.e., an off-chip memory element. In this case, the processing element calls or loads the program from the off-chip memory element onto the on-chip memory element to call and execute the method described in the above method embodiment.
[0298] For example, embodiments of the present application may also provide an apparatus, such as an electronic device, which may include a processor and a memory for storing instructions executable by the processor. When the processor is configured to execute the instructions, the electronic device implements the audio processing method described in the aforementioned embodiments. The memory may be located within or outside the electronic device. The processor may include one or more processors.
[0299] In another implementation, the unit of the apparatus implementing each step of the above method may be configured as one or more processing elements, which may be provided on the corresponding electronic device. The processing elements may be integrated circuits, such as one or more ASICs, one or more DSPs, one or more FPGAs, or a combination of these integrated circuits. These integrated circuits may be integrated together to form a chip.
[0300] For example, embodiments of the present application further provide a chip that can be used in the aforementioned electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via circuits; the processors receive and execute computer instructions from the electronic device's memory via the interface circuits to implement the methods described in the aforementioned method embodiments.
[0301] An embodiment of the present application also provides a computer program product, including computer instructions executed by the above-mentioned electronic device.
[0302] 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.
[0303] In the several embodiments provided in this 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 merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, 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.
[0304] The units described as separate components may or may not be physically separate, 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 places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0305] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0306] 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, such as a program. The software product is stored in a program product, such as a computer-readable storage medium, and includes a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
[0307] For example, embodiments of the present application may further provide a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by an electronic device, the electronic device implements the audio processing method described in the aforementioned method embodiment.
[0308] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. An audio processing method, characterized in that: Applied to an electronic device, the electronic device includes at least two sound-generating devices, the at least two sound-generating devices include a first sound-generating device and a second sound-generating device, the method includes: outputting first audio data through the first sound-generating device, and outputting second audio data through the second sound-generating device; Acquire a first acoustic energy corresponding to the first audio data in a listening area and a second acoustic energy corresponding to a sound leakage area, and acquire a third acoustic energy corresponding to the second audio data in the listening area and a fourth acoustic energy corresponding to the sound leakage area; An audio optimization coefficient is determined based on a first sound energy corresponding to the listening area, a second sound energy corresponding to the leakage area, a third sound energy corresponding to the listening area, and a fourth sound energy corresponding to the leakage area; the audio optimization coefficient is used to reduce the sound energy of third audio data corresponding to the first sound device and fourth audio data corresponding to the second sound device in the leakage area.
2. The method according to claim 1, characterized in that: The audio optimization coefficient includes a first optimization coefficient and a second optimization coefficient, and determining the audio optimization coefficient according to the first sound energy corresponding to the listening area, the second sound energy corresponding to the sound leakage area, the third sound energy corresponding to the listening area, and the fourth sound energy corresponding to the sound leakage area includes: determining a first acoustic energy contrast ratio between the first acoustic energy and the second acoustic energy; determining the first optimization coefficient according to the first acoustic energy contrast; determining a second acoustic energy contrast ratio between the third acoustic energy and the fourth acoustic energy; The second optimization coefficient is determined according to the second acoustic energy contrast.
3. The method according to claim 2, characterized in that The determining the first optimization coefficient according to the first acoustic energy contrast comprises: Determine a value corresponding to when the first acoustic energy contrast is maximized as the first optimization coefficient; The determining the second optimization coefficient according to the second acoustic energy contrast comprises: A value corresponding to when the second acoustic energy contrast is maximized is determined as the second optimization coefficient.
4. The method according to any one of claims 1 to 3, characterized in that The obtaining of the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area includes: Acquire a first transfer function corresponding to the first audio data in the listening area, and acquire a second transfer function corresponding to the first audio data in the sound leakage area; determining, according to a first transfer function corresponding to the listening area, a first acoustic energy corresponding to the first audio data in the listening area; According to a second transfer function corresponding to the sound leakage area, second acoustic energy corresponding to the first audio data in the sound leakage area is determined.
5. The method according to claim 4, characterized in that The obtaining of a first transfer function corresponding to the first audio data in the listening area includes: Acquire a transfer function of each sampling point of the first audio data in the listening area; Determine a first transfer function corresponding to the first audio data in the listening area according to the transfer function of each sampling point of the first audio data in the listening area; The obtaining of a second transfer function corresponding to the first audio data in the sound leakage area includes: Acquire a transfer function of each sampling point of the first audio data in the sound leakage area; A second transfer function corresponding to the first audio data in the sound leakage area is determined according to the transfer function of each sampling point of the first audio data in the sound leakage area.
6. The method according to claim 5, characterized in that Determining, according to the transfer function of each sampling point of the first audio data in the listening area, a first transfer function corresponding to the first audio data in the listening area includes: Determine the weight corresponding to each sampling point in the listening area; A first transfer function corresponding to the first audio data in the listening area is determined according to the weights corresponding to the sampling points in the listening area and the transfer functions of the sampling points in the listening area.
7. The method according to claim 2 or 3, characterized in that: The method further comprises: Optimizing the first filter corresponding to the first sound-generating device according to the first optimization coefficient, and filtering the third audio data by using the optimized first filter to obtain filtered third audio data; According to the second optimization coefficient, the second filter corresponding to the second sound-emitting device is optimized, and the fourth audio data is filtered by the optimized second filter to obtain filtered fourth audio data; The filtered third audio data is output through the first sound-generating device, and the filtered fourth audio data is output through the second sound-generating device.
8. The method according to any one of claims 1 to 3, characterized in that Before obtaining the first sound energy corresponding to the first audio data in the listening area and the second sound energy corresponding to the sound leakage area, and obtaining the third sound energy corresponding to the second audio data in the listening area and the fourth sound energy corresponding to the sound leakage area, the method further includes: Determine a usage scenario in which the electronic device outputs the first audio data and the second audio data; The listening area and the sound leakage area are determined according to usage scenarios of the first audio data and the second audio data.
9. The method according to claim 8, characterized in that The usage scenario of the third audio data and the fourth audio data is the same as the usage scenario of the first audio data and the second audio data.
10. The method according to any one of claims 1 to 3, characterized in that: The at least two sound-emitting devices include at least one of an earpiece of the electronic device, a speaker of the electronic device, or a screen sound-emitting device of the electronic device.
11. The method according to claim 10, wherein the first sound-emitting device is an earpiece of the electronic device, and the second sound-emitting device is a screen sound-emitting device of the electronic device.
12. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method as claimed in any one of claims 1 to 11.
13. A computer-readable storage medium having computer program instructions stored thereon; characterized in that: When the computer program instructions are executed by an electronic device, the electronic device implements the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Audio processing method and electronic device
CN117119092B
Sound leakage suppression method, related equipment and computer readable storage medium
CN113347307A
Method for counteracting sound leakage and electronic equipment
CN113746975A
Method and device for generating target parameter of energy compensation filter, and earphone
CN113766384A
Audio playing method, failure detection method of screen sounding device and electronic equipment
CN115686425A
