Audio processing method and electronic equipment

By using multiple sounding devices in electronic devices and optimizing filters according to the grip angle, the earpiece sound leakage problem is solved, ensuring user privacy and hearing experience.

CN119136113APending Publication Date: 2024-12-13HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310713648.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-13
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

As the proportion of electronic device screens increases, sound leakage is prone to occur when the earpiece is close to the edge of the screen, resulting in user privacy leakage and privacy security.

Method used

By using at least two sounding devices in an electronic device, the target audio optimization coefficient is determined based on the user's grip angle, the filter of the sounding device is optimized to reduce the sound energy of the sound leakage zone, and achieve a sound leakage-proof effect while maintaining the listening zone. The sound energy remains unchanged.

Benefits of technology

It effectively prevents the earpiece from leaking sound, protects users' privacy and security, and ensures users' listening experience while preventing sound leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119136113A_ABST
    Figure CN119136113A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an audio processing method and electronic equipment, relates to the field of electronic equipment, and is used for avoiding the problem of sound leakage of a receiver, preventing leakage of user privacy and improving privacy security of a user. According to the specific scheme, under the condition that the electronic equipment is in a call scene, a first holding angle of the electronic equipment is determined, and the first holding angle is an included angle between the electronic equipment and the face of a user; determining a target audio optimization coefficient in a plurality of audio optimization coefficients stored in the electronic equipment based on the first holding angle; optimizing a first filter corresponding to the first sound production device and a second filter corresponding to the second sound production device according to the target audio optimization coefficient to obtain first audio data and second audio data; and outputting the first audio data through the first sound production device, and outputting the second audio data through the second sound production device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic devices, and in particular to an audio processing method and electronic device. Background Art

[0002] At present, voice communication has become an important function of electronic devices (such as mobile phones, etc.). For example, when a mobile phone interacts with other devices to provide users with voice communication functions, the handset of the mobile phone can convert audio electrical signals from other devices into sound signals and output the sound signals.

[0003] However, as the screen-to-body ratio of electronic devices such as mobile phones increases, the position of the receiver is getting closer and closer to the upper edge of the screen of electronic devices such as mobile phones. When the receiver is close to the upper edge of the screen of electronic devices such as mobile phones, the sound signal output by the receiver of the mobile phone may leak. Receiver leakage can cause the user's voice communication content to be heard by people around, resulting in the leakage of user privacy and affecting the user's privacy security. Summary of the invention

[0004] 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.

[0005] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:

[0006] 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: when the electronic device is in a call scenario, determining a first holding angle of the electronic device, the first holding angle being the angle between the electronic device and the user's face; based on the first holding angle, determining a target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device; the multiple audio optimization coefficients include audio optimization coefficients corresponding to the electronic device at multiple different holding angles, and the audio optimization coefficients are used to reduce the sound energy corresponding to the first audio data corresponding to the first sound-emitting device and the second audio data corresponding to the second sound-emitting device in the sound leakage area; optimizing the first filter corresponding to the first sound-emitting device and the second filter corresponding to the second sound-emitting device according to the target audio optimization coefficient to obtain the first audio data and the second audio data; outputting the first audio data through the first sound-emitting device, and outputting the second audio data through the second sound-emitting device.

[0007] Based on the method described in the first aspect, the electronic device can use at least two sound-emitting devices to respectively output the first audio data and the second audio data, thereby achieving the effect of sound field playback. And when the electronic device is making a call, the electronic device can select the target audio optimization coefficient corresponding to the current holding angle from the audio optimization coefficients corresponding to at least two sound-emitting devices at different holding angles according to the current holding angle (i.e., the first holding angle). Afterwards, the filters corresponding to at least two sound-emitting devices can be optimized respectively through the target audio optimization coefficient, so that when the user uses the electronic device to make a call, the optimized filters can respectively reduce the sound energy corresponding to the first audio data corresponding to the first sound-emitting device and the second audio data corresponding to the second sound-emitting device in the sound leakage area, thereby avoiding the problem of sound leakage in the earpiece, preventing the leakage of user privacy, and improving the privacy security of the user.

[0008] In addition, the scheme of the present application selects the coefficient of the filter corresponding to the current holding angle from the coefficients of the filters corresponding to at least two sound-emitting devices at different holding angles according to the current holding angle. Therefore, the scheme of the present application can ensure the sound leakage prevention effect of the electronic device and the user's hearing experience when the user uses the electronic device to make calls at different holding angles.

[0009] In combination with the first aspect, in another possible implementation method, the above-mentioned determination of the first holding angle of the electronic device may include: obtaining angle information corresponding to the electronic device at multiple moments; based on the angle information corresponding to the multiple moments, determining the second holding angles corresponding to the electronic device at the multiple moments; based on the second holding angles corresponding to the multiple moments, determining the first holding angle.

[0010] Based on this possible implementation, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments. Then, based on the angles corresponding to the multiple moments, the first holding angle can be accurately determined, that is, the angle between the electronic device and the user's face when the electronic device is in a call scene. Therefore, based on the accurate first holding angle, the target audio optimization coefficient can be accurately determined.

[0011] In combination with the first aspect, in another possible implementation method, the above-mentioned determination of the first holding angle based on the second holding angles corresponding to multiple moments may include: when multiple second holding angles include the third holding angle, updating the third holding angle to the first preset angle, and determining the first holding angle based on the first preset angle and the fourth holding angle; the third holding angle is outside the first preset angle range, and the fourth holding angle is within the first preset angle range; when multiple second holding angles do not include the third holding angle, determining the first holding angle based on multiple second holding angles.

[0012] Based on this possible implementation, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments, and then further screens the angles corresponding to multiple moments, so as to set the angles out of range as the preset angles, so as to more accurately determine the first holding angle, that is, the angle between the electronic device and the user's face when the electronic device is in a call scene. Therefore, based on the accurate first holding angle, the target audio optimization coefficient can be accurately determined.

[0013] In combination with the first aspect, in another possible implementation method, the above-mentioned determination of the first holding angle based on the first preset angle and the fourth holding angle may include: determining the first angle average value based on the first preset angle and the fourth holding angle; determining the first holding angle based on the first angle average value; the above-mentioned determination of the first holding angle based on multiple second holding angles may include: determining the second angle average value based on multiple second holding angles; determining the first holding angle based on the second angle average value.

[0014] Based on this possible implementation method, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments. Then, the angles corresponding to the multiple moments can be averaged, so that the first holding angle can be more accurately determined based on the average value.

[0015] In combination with the first aspect, in another possible implementation method, the above-mentioned determination of the first holding angle based on the second holding angles corresponding to multiple moments may include: when the number of multiple second holding angles is greater than or equal to a preset threshold, determining the first holding angle based on the second holding angles corresponding to multiple moments.

[0016] Based on this possible implementation, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments, and then, when the number of angles corresponding to multiple moments is greater than a preset threshold, the first holding angle is determined according to the angles corresponding to multiple moments. Since the number of angles corresponding to multiple moments is large enough, the accuracy of the determined first holding angle can be improved.

[0017] In combination with the first aspect, in another possible implementation, the above-mentioned audio optimization method may also include: when the number of multiple second holding angles is less than a preset threshold, determining the target audio optimization coefficient as a first preset audio optimization coefficient, and the first preset audio optimization coefficient is an audio optimization coefficient corresponding to the first preset holding angle among the multiple audio optimization coefficients stored in the electronic device.

[0018] Based on this possible implementation, the electronic device determines the angles corresponding to the multiple moments through the angle information corresponding to the electronic device at the multiple moments, and then, when the number of angles corresponding to the multiple moments is less than the preset threshold, the audio optimization coefficient can be set to the preset audio optimization coefficient among the multiple audio optimization coefficients stored in the electronic device. Thus, when the number of angles corresponding to the multiple moments is less than the preset threshold, the electronic device can still optimize the filter through the audio optimization coefficient.

[0019] In combination with the first aspect, in another possible implementation method, the above-mentioned determination of the target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device based on the first holding angle may include: when the first holding angle is outside the second preset angle range, determining the target audio optimization coefficient as the second preset audio optimization coefficient, the second preset audio optimization coefficient being the audio optimization coefficient corresponding to the second preset holding angle among the multiple audio optimization coefficients stored in the electronic device; when the first holding angle is within the second preset angle range, determining the target audio optimization coefficient as the audio optimization coefficient corresponding to the first holding angle among the multiple audio optimization coefficients stored in the electronic device.

[0020] Based on this possible implementation, after determining the first holding angle, that is, the angle between the electronic device and the user's face when the electronic device is in a call scenario, it can be further determined whether the first holding angle exceeds the preset angle range. When the first holding angle exceeds the preset angle range, the audio optimization coefficient can be set to an audio optimization coefficient preset in a plurality of audio optimization coefficients stored in the electronic device. Thus, when the first holding angle exceeds the preset angle range, the electronic device can still optimize the filter through the audio optimization coefficient. When the first holding angle does not exceed the preset angle range, the audio optimization coefficient can be set to an audio optimization coefficient corresponding to the first holding angle in a plurality of audio optimization coefficients stored in the electronic device. Thus, when the first holding angle does not exceed the preset angle range, the electronic device can optimize the filter through the audio optimization coefficient corresponding to the first holding angle.

[0021] In combination with the first aspect, in another possible implementation method, the above-mentioned target audio optimization coefficient may include a first optimization coefficient and a second optimization coefficient, and the above-mentioned optimizing the first filter corresponding to the first sound device and the second filter corresponding to the second sound device according to the target audio optimization coefficient to obtain the first audio data and the second audio data may include: optimizing the first filter according to the first optimization coefficient, and filtering the third audio data through the optimized first filter to obtain the first audio data; optimizing the second filter according to the second optimization coefficient, and filtering the fourth audio data through the optimized second filter to obtain the second audio data.

[0022] 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, and 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.

[0023] In a second aspect, an embodiment of the present application provides an audio processing device, which can be applied to an electronic device to implement the method in the first aspect. The functions of the audio processing device 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, for example, a determination module, an optimization module, and an output module.

[0024] Among them, the determination module can be used to determine a first holding angle of the electronic device when the electronic device is in a call scenario, and the first holding angle is the angle between the electronic device and the user's face.

[0025] The determination module can also be used to determine a target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device based on the first holding angle; the multiple audio optimization coefficients include audio optimization coefficients corresponding to the electronic device at multiple different holding angles, and the audio optimization coefficients are used to reduce the sound energy corresponding to the first audio data corresponding to the first sound device and the second audio data corresponding to the second sound device in the sound leakage area.

[0026] The optimization module can be used to optimize the first filter corresponding to the first sound device and the second filter corresponding to the second sound device according to the target audio optimization coefficient to obtain the first audio data and the second audio data.

[0027] The output module can be used to output the first audio data through the first sound-emitting device and output the second audio data through the second sound-emitting device.

[0028] In combination with the second aspect, in another possible implementation manner, the audio processing device may further include an acquisition module.

[0029] The acquisition module can be used to obtain the angle information corresponding to the electronic device at multiple times.

[0030] The determination module may also be used to determine the second holding angles corresponding to the electronic device at multiple moments based on the angle information corresponding to the multiple moments.

[0031] The determination module may also be used to determine the first holding angle based on the second holding angles corresponding to a plurality of moments.

[0032] In combination with the second aspect, in another possible implementation manner, the audio processing device may further include an updating module.

[0033] The updating module may be configured to update the third holding angle to the first preset angle when the plurality of second holding angles include the third holding angle.

[0034] The determination module can also be used to determine the first holding angle based on the first preset angle and the fourth holding angle; the third holding angle is outside the first preset angle range, and the fourth holding angle is within the first preset angle range.

[0035] The determination module may also be configured to determine the first holding angle based on the multiple second holding angles when the multiple second holding angles do not include the third holding angle.

[0036] In combination with the second aspect, in another possible implementation manner, the determination module may also be used to determine the first angle average value based on the first preset angle and the fourth holding angle.

[0037] The determination module may also be configured to determine a first holding angle based on the first angle average value.

[0038] The determination module may also be configured to determine a second angle average value based on multiple second holding angles.

[0039] The determination module may also be configured to determine the first holding angle based on the second angle average value.

[0040] In combination with the second aspect, in another possible implementation, the determination module can also be used to determine the first holding angle according to the second holding angles corresponding to multiple moments when the number of the multiple second holding angles is greater than or equal to a preset threshold.

[0041] In combination with the second aspect, in another possible implementation method, the determination module can also be used to determine that the target audio optimization coefficient is a first preset audio optimization coefficient when the number of multiple second holding angles is less than a preset threshold, and the first preset audio optimization coefficient is an audio optimization coefficient corresponding to the first preset holding angle among multiple audio optimization coefficients stored in the electronic device.

[0042] In combination with the second aspect, in another possible implementation method, the determination module can also be used to determine that the target audio optimization coefficient is a second preset audio optimization coefficient when the first holding angle is outside the second preset angle range, and the second preset audio optimization coefficient is an audio optimization coefficient corresponding to the second preset holding angle among multiple audio optimization coefficients stored in the electronic device.

[0043] The determination module can also be used to determine, when the first holding angle is within a second preset angle range, that the target audio optimization coefficient is an audio optimization coefficient corresponding to the first holding angle among multiple audio optimization coefficients stored in the electronic device.

[0044] In combination with the second aspect, in another possible implementation, the optimization module can also be used to optimize the first filter according to the first optimization coefficient, and filter the third audio data through the optimized first filter to obtain the first audio data.

[0045] The optimization module can also be used to optimize the second filter according to the second optimization coefficient, and filter the fourth audio data through the optimized second filter to obtain the second audio data.

[0046] 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.

[0047] 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.

[0048] In a fifth aspect, an audio processing device is provided, comprising: a processor; the processor is used to couple with a memory, and after reading instructions in the memory, execute the audio processing method as described in any one of the above-mentioned first aspects according to the instructions.

[0049] In a sixth aspect, an embodiment of the present application provides 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 any one of the first aspect or possible implementations of the first aspect.

[0050] 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 any one of the first aspect or possible implementations of the first aspect.

[0051] In an eighth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0052] It should be understood that the beneficial effects of the second to eighth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a diagram showing the sound leakage from the earpiece of an electronic device. Figure 1 ;

[0054] Figure 2 A schematic diagram of a hardware structure of an electronic device;

[0055] Figure 3 This is a diagram showing the sound leakage from the earpiece of an electronic device. Figure 2 ;

[0056] Figure 4 A schematic diagram of an electronic device at an angle when a user is using the electronic device to make a call;

[0057] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0058] Figure 6 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0059] Figure 7 A schematic diagram of an audio processing method provided in an embodiment of the present application Figure 1 ;

[0060] Figure 8 A schematic diagram of an audio processing method provided in an embodiment of the present application Figure 2 ;

[0061] Fig. 9 A schematic diagram of an audio processing method provided in an embodiment of the present application Figure 3 ;

[0062] Fig.10 A schematic diagram of an audio processing method provided in an embodiment of the present application Figure 4 ;

[0063] Fig.11 A schematic diagram of an audio processing method provided in an embodiment of the present application Figure 5 ;

[0064] Fig.12 A schematic diagram of the structure of an audio processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0066] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0067] At present, voice communication has become an important function of electronic devices (such as mobile phones, etc.). In the process of mobile phones interacting with other devices to provide users with voice communication functions, the handset of the mobile phone can convert audio electrical signals from other devices into sound signals and output the sound signals.

[0068] However, as the screen-to-body ratio of electronic devices such as mobile phones increases, the position of the receiver is getting closer and closer to the upper edge of the screen of electronic devices such as mobile phones. However, when the receiver is located close to the upper edge of the screen of electronic devices such as mobile phones, the receiver may leak sound when outputting sound signals. Receiver leakage may cause the user's voice communication content to be heard by people around, resulting in the leakage of user privacy and affecting the user's privacy security.

[0069] For example, Figure 1 As shown, for a mobile phone 02 with a receiver 01 located at the upper edge of the screen, when a user makes a call through the mobile phone 02, the sound signal output by the receiver 01 will be emitted in all directions through the sound outlet at the top of the mobile phone 02. The sound signal output by the receiver 01 can be heard on one side of the user's ear, and the sound signal output by the receiver 01 can also be heard on the side away from the user's ear. Figure 1In area 03 in the mobile phone 02, the sound signal output by the earpiece 01 will also be transmitted to this area, that is, the sound signal output by the earpiece 01 can also be heard in area 03. Therefore, when the earpiece 01 is located near the upper edge of the screen of the mobile phone 02, the sound signal output by the earpiece 01 will have the problem of earpiece 01 leakage, that is, the sound signal output by the earpiece 01 can be heard in area 03. In other words, other users can hear the sound signal output by the earpiece 01 in area 03, which causes the user's voice communication content to be heard by people around, resulting in the leakage of user privacy and affecting the user's privacy security.

[0070] In order to 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, the prior art can play a first sound signal through the earpiece on the top of an electronic device such as a mobile phone, and play a second sound signal through the speaker at the bottom of the electronic device such as a mobile phone when the user is communicating voice through the electronic device such as a mobile phone. The second sound signal is opposite in phase to the first sound signal. Since the second sound signal is opposite in phase to the first sound signal, the two sound waves can cancel each other out during propagation, thereby canceling out the sound leakage of the earpiece of the electronic device and reducing the leakage of voice communication content. In other words, the prior art can solve the problem of earpiece sound leakage by using dual-unit hardware to emit anti-phase sound waves for cancellation.

[0071] However, the solution in the prior art of playing a first sound signal through an earpiece and a speaker playing a second sound signal with a phase opposite to the first sound signal can offset the earpiece sound leakage of an 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 earpiece sound leakage of an electronic device. Therefore, this solution of playing a first sound signal through an earpiece and a speaker playing a second sound signal with a phase opposite to the first sound signal does not solve the problem of earpiece sound leakage caused when the earpiece is located close to the upper edge of the screen of an electronic device such as a mobile phone.

[0072] In addition, with the development of electronic devices such as mobile phones, people's functional requirements for electronic devices such as mobile phones are becoming more and more diverse. For example, users have higher and higher requirements for the quality of sound signals output by the earpieces of electronic devices such as mobile phones. For example, the sound signals that users hope to hear can achieve the effect of sound field playback. Electronic devices such as mobile phones can restore the three-dimensional sense of sound in nature through sound field playback, and can restore the three-dimensional sense of sound to a certain extent, thereby providing a certain degree of playback sound with spatial distribution characteristics such as azimuth and layering.

[0073] Typically, a mobile phone or other electronic device may include at least two sound-generating devices (such as a receiver and a screen sound-generating device, etc.), so that the mobile phone or other electronic device can use the at least two sound-generating devices to achieve sound field playback. The screen sound-generating device is a device that can generate sound through screen vibration, and the screen sound-generating device can be located below the screen of the mobile phone or other electronic device.

[0074] For example, Figure 2 As shown, the mobile phone 04 may include two sound-generating devices, namely, a screen sound-generating device 05 and an earpiece 06. The earpiece 06 may be located at the upper edge of the screen of the mobile phone 04, and the screen sound-generating device 05 may be located below the screen of the mobile phone 04 and close to the earpiece 06. When the user makes a call through the mobile phone 04, the earpiece 06 may output a sound signal, and the screen sound-generating device 05 may output a sound signal through the vibration of the screen of the mobile phone 04, that is, the earpiece 06 and the screen sound-generating device 05 may output a sound signal at the same time, thereby achieving the effect of sound field playback.

[0075] However, when electronic devices such as mobile phones use at least two sound-generating devices to achieve sound field reproduction, there is still the problem of earpiece sound leakage caused by the earpiece being located close to the upper edge of the screen of the electronic device such as the mobile phone.

[0076] For example, Figure 3 As shown, when the mobile phone 04 includes two sound-generating devices, namely, the screen sound-generating device 05 and the earpiece 06, the earpiece 06 can be located at the upper edge of the screen of the mobile phone 04, and the screen sound-generating device 05 can be located below the screen of the mobile phone 04 and close to the earpiece 06. When the user makes a call through the mobile phone 04, the earpiece 06 and the screen sound-generating device 05 can output sound signals at the same time, thereby achieving the effect of sound field playback.

[0077] However, the sound signal output by the earpiece 06 will be emitted in all directions through the sound outlet at the top of the mobile phone 04, and the sound signal output by the screen sound device 05 will be emitted in all directions through the screen of the mobile phone 04. That is, the sound signal output by the earpiece 06 and the screen sound device 05 can be heard on the side of the user's ear, and the sound signal output by the earpiece 06 and the screen sound device 05 can also be heard on the side away from the user's ear, such as Figure 3 The sound signals output by the earpiece 06 and the screen sound device 05 can also be heard in area 07. Therefore, when the earpiece 06 and the screen sound device 05 output sound signals at the same time, the sound signals output by the earpiece 06 and the screen sound device 05 can be heard in area 07, that is, other users in area 07 can hear the sound signals output by the earpiece 06 and the screen sound device 05, which causes the user's voice communication content to be heard by people around, resulting in the leakage of the user's privacy, affecting the user's privacy security.

[0078] In order to 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 when at least two sound-emitting devices are used to achieve sound field reproduction, the relevant technology can determine the coefficients of the filters corresponding to the at least two sound-emitting devices based on the sound energy contrast algorithm, so that the filters corresponding to the at least two sound-emitting devices can be optimized respectively by using the coefficients, thereby solving the problem of earpiece sound leakage while achieving sound field reproduction using at least two sound-emitting devices.

[0079] The related technology may include the following process: obtaining the acoustic energy of the listening area and the acoustic energy of the leakage area of ​​the electronic device. According to the acoustic energy of the listening area and the acoustic energy of the leakage area, the coefficients of the filters corresponding to at least two sound-emitting devices are obtained, and the coefficients are the maximum value of the acoustic energy contrast between the acoustic energy of the listening area and the acoustic energy of the leakage area. The corresponding filters are optimized respectively by the coefficients of the filter. Therefore, when the user uses the electronic device to make a call, the optimized filters can filter the input signals of the at least two sound-emitting devices respectively, and the at least two sound-emitting devices output the filtered input signals. The output signals of the at least two sound-emitting devices can achieve the effect of sound field playback in the listening area.

[0080] Since the coefficients of the filters corresponding to at least two sound-emitting devices are the maximum value of the sound energy contrast ratio between the sound energy in the listening area and the sound energy in the sound leakage area, the optimized filter can reduce the sound energy of the sound-emitting device in the sound leakage area. That is, before the electronic device outputs audio data, the electronic device optimizes the output audio data so that the sound energy corresponding to the output audio data in the sound leakage area is reduced. And the output signals of at least two sound-emitting devices can also achieve interference cancellation in the sound leakage area. Therefore, the related technology can prevent sound leakage in the sound leakage area. At the same time, the optimized filter can ensure that the sound energy in the listening area remains unchanged. Therefore, the related technology can reduce the sound energy in the sound leakage area while realizing the sound field playback using at least two sound-emitting devices. That is, while preventing sound leakage, the user's hearing experience can be guaranteed.

[0081] In this related technology, the coefficients of the filters corresponding to the at least two sound-emitting devices can be determined by the sound energy contrast algorithm. The coefficients of the filters can prevent sound leakage while ensuring the user's hearing experience. However, in this related technology, when determining the coefficients of the filters corresponding to the at least two sound-emitting devices, the electronic device is fixed in a standard holding posture, thereby determining the coefficients of the filters corresponding to the at least two sound-emitting devices in the standard holding posture.

[0082] The standard holding posture may include the angle of the electronic device as a standard holding angle. The standard holding angle is the angle at which the user holds the electronic device under normal circumstances when the user uses the electronic device to make a call. The angle at which the user holds the electronic device may be the angle between the electronic device and the user's face when the user uses the electronic device to make a call. Since the coefficient corresponding to the standard holding posture is the maximum value of the sound energy contrast between the sound energy in the listening area and the sound energy in the leakage area, when the user uses the electronic device to make a call according to the standard holding posture, according to the coefficient corresponding to the standard holding posture, the sound energy of at least two sound-emitting devices in the leakage area can be reduced, and the sound energy in the listening area remains unchanged. In other words, for the coefficient corresponding to the standard holding posture, when the user uses the electronic device to make a call according to the standard holding posture (such as the standard holding angle), the electronic device has a better sound leakage prevention effect and the user's hearing effect is better.

[0083] However, when a user actually uses an electronic device to make a call, the user's holding posture for the electronic device may be different from the standard holding posture. For example, when a user actually uses an electronic device to make a call, the angle at which the user holds the electronic device is different from the standard holding angle. However, in the related art, when the user's holding posture for the electronic device is different from the standard holding posture, the coefficients of the filters corresponding to the at least two sound-emitting devices under the standard holding posture are still used to optimize the filters corresponding to the at least two sound-emitting devices.

[0084] When the user's holding posture of the electronic device is different from the standard holding posture, the range of the listening area and the sound leakage area of ​​the electronic device will change. At this time, if the coefficients of the filters corresponding to at least two sound-emitting devices under the standard holding posture are still used, and the filters corresponding to the at least two sound-emitting devices are optimized, the degree of reduction of the sound energy of the at least two sound-emitting devices in the actual sound leakage area will be reduced, and the sound energy in the listening area will be reduced. In other words, for the coefficients of the filters corresponding to the standard holding posture, when the user uses the electronic device to make calls according to different holding postures, the electronic device's sound leakage prevention effect is poor, and the user's hearing effect is poor.

[0085] It can be seen that the related technology cannot achieve both the effect of preventing sound leakage and the user's hearing experience when the user uses the electronic device to make calls according to different holding postures.

[0086] For example, combined with Figure 4 As shown in (a) in the figure, when an electronic device such as a mobile phone determines the coefficients of the filters corresponding to at least two sound-emitting devices, the mobile phone is fixed according to the standard holding posture shown in (a) in the figure, such as fixing the angle between the mobile phone and the user's face to the standard holding angle θ 1 The standard holding angle θ 1is the angle at which a user holds the electronic device in general. Then, based on the acoustic energy contrast algorithm, the coefficients of the filters corresponding to at least two sound-generating devices under the standard holding posture are determined.

[0087] Afterwards, the mobile phone will set the coefficients of the filters corresponding to the at least two sound-emitting devices to the coefficients of the filters corresponding to the at least two sound-emitting devices under the standard holding posture, thereby optimizing the filters corresponding to the at least two sound-emitting devices through the coefficients of the filters corresponding to the at least two sound-emitting devices under the standard holding posture. The optimized filters filter the input signals of the at least two sound-emitting devices respectively, and the at least two sound-emitting devices output the filtered input signals. When the user uses the mobile phone to make a call, the output signals of the at least two sound-emitting devices can achieve the effect of sound field playback in the listening area. And the output signals of the at least two sound-emitting devices can achieve the effect of preventing sound leakage in the sound leakage area.

[0088] However, when a user actually uses a mobile phone to make a call, the user's holding posture of the mobile phone may be different from the standard holding posture. Figure 4 As shown in (b) in FIG, when a user uses a mobile phone to make a call, the user's holding angle of the mobile phone may be the same as the standard holding angle, that is, the angle between the mobile phone and the user's face may be the same as the angle between the mobile phone and the user's face in the standard holding posture, that is, Figure 4 The angle θ shown in (b) 1 When a user uses a mobile phone to make a call, the user's holding angle of the mobile phone may also be different from the standard holding angle, that is, the angle between the mobile phone and the user's face may be smaller than the angle between the mobile phone and the user's face in the standard holding posture, that is, Figure 4 The angle θ shown in (b) 2 When a user uses a mobile phone to make a call, the angle between the mobile phone and the user's face can also be greater than the angle between the mobile phone and the user's face in the standard holding posture, that is, Figure 4 The angle θ shown in (b) 3 .

[0089] When the user's holding posture of the phone is different from the standard holding posture, for example, the angle between the phone and the user's face is θ 2 Or θ 3 , since the angle between the phone and the user's face is θ 2 Or θ 3 When the listening area and sound leakage area of ​​the mobile phone are in the range, the angle between the mobile phone and the user's face is θ 1 When the phone is used for a call, if the user still uses the standard holding posture (i.e. the angle between the phone and the user's face is θ 1) will result in a decrease in the degree of reduction of the sound energy of the at least two sound-emitting devices in the actual sound leakage area, and will reduce the sound energy in the listening area. In other words, for the coefficients of the filters corresponding to the standard holding posture, when the user uses the mobile phone to make calls according to different holding postures, the anti-sound leakage effect of the mobile phone is poor, and the user's hearing effect is poor.

[0090] In view of the above problems, an embodiment of the present application provides an audio processing method, which is applied to an electronic device, which 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 pre-store the coefficients of the filters corresponding to at least two sound-emitting devices under different holding postures. When the electronic device is making a call, the electronic device can obtain the current holding posture, and then select the coefficient of the filter corresponding to the current holding posture from the coefficients of the filters corresponding to at least two sound-emitting devices under different holding postures according to the current holding posture. Afterwards, the filters corresponding to the at least two sound-emitting devices can be optimized respectively according to the coefficients of the filters corresponding to the current holding posture, so that when the user uses the electronic device to make a call, the optimized filters 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] And because the coefficients of the 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 sound leakage area, the optimized filter can reduce the sound energy of the sound-emitting device in the sound 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 sound leakage area is reduced. And the output signals of at least two sound-emitting devices can also achieve interference cancellation in the sound leakage area. Therefore, the scheme of the present application can prevent sound leakage in the sound leakage area. At the same time, the optimized filter can keep the sound energy in the listening area unchanged. In other words, the scheme of the present application can reduce the sound energy in the sound leakage area while realizing the sound field playback by using at least two sound-emitting devices. That is, the scheme of the present application can ensure the user's hearing experience while preventing sound leakage.

[0092] In addition, the scheme of the present application selects the coefficient of the filter corresponding to the current holding posture from the coefficients of the filters corresponding to at least two sound-emitting devices under different holding postures according to the current holding posture. Therefore, the scheme of the present application can ensure the sound leakage prevention effect of the electronic device and the user's hearing experience when the user uses the electronic device to make calls according to different holding postures.

[0093] It should be noted that the user's holding posture of the electronic device may include the user's holding angle of the electronic device, the user's holding distance of the electronic device, and the user's holding strength of the electronic device. In the embodiments of the present application, the specific type of the user's holding posture of the electronic device is not limited. In the embodiments of the present application, the user's holding posture of the electronic device is illustrated as the user's holding angle of the electronic device.

[0094] The holding angle of the electronic device by the user may be the angle between the side of the user's ear close to the electronic device and the electronic device when the user uses the electronic device to make a call.

[0095] The holding distance of the electronic device by the user may be the distance between the electronic device and the side of the user's ear close to the electronic device when the user uses the electronic device to make a call.

[0096] The user's holding strength of the electronic device may be the strength with which the user holds the electronic device when the user uses the electronic device to make a call.

[0097] The audio processing method provided in the embodiment of the present application is described below.

[0098] The audio processing method provided in the embodiments of the present application can be applied to electronic devices. In some embodiments, the electronic devices can be electronic devices for applications such as mobile phones, tablet computers, handheld computers, personal computers (PCs), cellular phones, personal digital assistants (PDAs), and wearable devices. The embodiments of the present application do not limit the specific form of the electronic devices.

[0099] For example, taking the electronic device as a mobile phone, Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown.

[0100] like Figure 5As shown, the electronic device may include a processor 510, an external memory interface 520, an internal memory 521, a universal serial bus (USB) interface 530, a charging management module 540, a power management module 541, a battery 542, an antenna 1, an antenna 2, a mobile communication module 550, a wireless communication module 560, an audio module 570, a speaker 570A, a receiver 570B, a microphone 570C, an earphone interface 570D, a sensor module 580, a button 590, a motor 591, an indicator 592, a camera 593, a display screen 594, and a subscriber identification module (SIM) card interface 595, etc. Among them, the sensor module 580 may include a pressure sensor 580A, a gyroscope sensor 580B, an air pressure sensor 580C, a magnetic sensor 580D, an acceleration sensor 580E, a distance sensor 580F, a proximity light sensor 580G, a fingerprint sensor 580H, a temperature sensor 580J, a touch sensor 580K, an ambient light sensor 580L, a bone conduction sensor 580M, etc.

[0101] It is to 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 in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0102] The processor 510 may include one or more processing units, for example, the processor 510 may include an application processor (AP), a modem processor, a graphics processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.

[0103] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0104] The processor 510 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 510 is a cache memory. The memory may store instructions or data that the processor 510 has just used or cyclically used. If the processor 510 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 510, and thus improves the efficiency of the system.

[0105] In some embodiments, the processor 510 may include one or more interfaces. The interface 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, etc.

[0106] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 550, wireless communication module 560, modem processor and baseband processor.

[0107] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0108] The mobile communication module 550 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 550 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 550 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 550 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 550 can be set in the processor 510. In some embodiments, at least some of the functional modules of the mobile communication module 550 can be set in the same device as at least some of the modules of the processor 510.

[0109] The wireless communication module 560 can provide wireless communication solutions 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., which are applied to electronic devices. The wireless communication module 560 can be one or more devices integrating at least one communication processing module. The wireless communication module 560 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 510. The wireless communication module 560 can also receive the signal to be sent from the processor 510, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0110] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 550, and the antenna 2 is coupled to the wireless communication module 560, so that the electronic device can communicate with the network and other devices through 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.

[0111] The electronic device implements the display function through a GPU, a display screen 594, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 594 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 510 may include one or more GPUs that execute program instructions to generate or change display information.

[0112] The display screen 594 is used to display images, videos, etc. The display screen 594 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 or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 594, where N is a positive integer greater than 1.

[0113] The electronic device can realize the shooting function through the ISP, the camera 593, the video codec, the GPU, the display screen 594 and the application processor, etc. In some embodiments, the electronic device may include 1 or N cameras 593, where N is a positive integer greater than 1.

[0114] The internal memory 521 can be used to store computer executable program codes, which include instructions. The processor 510 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 521. The internal memory 521 may include a program storage area and a data storage area. Among them, the program storage area may 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 may store data established during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 521 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.

[0115] The acceleration sensor 580E can periodically collect acceleration data of the electronic device at a certain frequency. For example, the acceleration magnitude of the electronic device in various directions (generally XYZ three-axis directions) can be collected.

[0116] In some examples, in order to implement the audio processing method provided in the embodiments of the present application, the electronic device may include an angle sensor. The angle sensor may be used to obtain angle information of the electronic device, so that the angle between the electronic device and the user (i.e., the angle between the electronic device and the user's face when the electronic device is talking) may be determined based on the angle information of the electronic device.

[0117] Of course, it is understandable that the above Figure 5 The figure is only an exemplary description when the electronic device is in the form of a mobile phone. If the electronic device is in the form of a tablet computer, a handheld computer, a PC, a PDA, a wearable device (such as a smart watch, a smart bracelet), etc., the structure of the electronic device may include Figure 5 The structure shown in the figure is less than Figure 5 More structures are shown in the figure, which are not limited here.

[0118] In some examples, in order to enable the electronic device to achieve the effect of sound field playback, the electronic device may also include a filter group. The filter group may include multiple filters, which may also be called playback filters. The filters may correspond one-to-one to the sound-generating devices that achieve sound field playback, thereby filtering the input signal of the sound-generating devices that achieve sound field playback.

[0119] It is understandable that, generally speaking, the realization of electronic device functions requires not only hardware support but also software cooperation.

[0120] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.

[0121] Figure 6 It is a software structure block diagram of the electronic device provided in the embodiment of the present application.

[0122] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and the system library (also called the Native layer), and the kernel layer.

[0123] The application layer can include a series of application packages. Figure 6 As shown, the application package may include applications such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, short message, etc. The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0124] like Figure 6 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0125] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0126] 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.

[0127] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0128] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).

[0129] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0130] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0131] like Figure 6 As shown, in order to implement the audio processing method provided in the embodiment of the present application, the application framework layer may also include an anti-sound leakage module, etc.

[0132] The sound leakage prevention module can be used to store multiple groups of filter coefficients and the holding angle corresponding to each group of filter coefficients. Different groups of filter coefficients correspond to different holding angles. Each group of filter coefficients can include multiple filter coefficients, and the multiple filter coefficients correspond to the filters corresponding to the sound-generating devices of the electronic device.

[0133] For example, when the electronic device includes two sound-emitting devices, the electronic device may include two filters, and the two filters filter the input signals of the two sound-emitting devices respectively. The sound leakage prevention module may store multiple groups of filter coefficients, and different groups of filter coefficients correspond to different holding angles. Each group of filter coefficients includes two filter coefficients, and the two filter coefficients can be used to optimize the two filters respectively. The two optimized filters can filter the input signals of the two sound-emitting devices respectively.

[0134] The sound leakage prevention module can also be used to obtain multiple angle information sent by the angle sensor, and determine the current holding angle of the electronic device based on the multiple angle information.

[0135] After determining the current holding angle of the electronic device, the sound leakage prevention module can also be used to determine the filter coefficient corresponding to the current holding angle from the stored multiple groups of filter coefficients according to the current holding angle of the electronic device.

[0136] After determining the filter coefficient corresponding to the current holding angle, the sound leakage prevention module can also be used to send the filter coefficient corresponding to the current holding angle to the filters corresponding to at least two sound emitters, so that the filters can be optimized according to the corresponding filter coefficients, and the optimized filters can filter the input signals of at least two sound emitters respectively, and at least two sound emitters can output the input information after filtering.

[0137] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0138] 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.

[0139] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0140] The system library may 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.

[0141] The surface manager is used to manage the display subsystem and provide the fusion of two-dimensional and three-dimensional layers for multiple applications.

[0142] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats.

[0143] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0144] A 2D graphics engine is a drawing engine for 2D drawings.

[0145] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0146] The methods in the following embodiments can all be implemented in an electronic device having the above hardware structure or software structure.

[0147] The following combination Figure 7, taking the user's holding posture of the electronic device as the user's holding angle of the electronic device, that is, the angle between the side of the user's ear close to the electronic device and the electronic device when the user uses the electronic device to make a call as an example, an audio processing method provided in an embodiment of the present application is described in detail. The audio processing method can be applied to an electronic device, and the electronic device may include an angle sensor, at least two sound-generating devices, filters corresponding to at least two sound-generating devices, and an anti-leakage sound module. Figure 7 A flowchart of an audio processing method provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the audio processing method may include the following S701-S716.

[0148] S701. A sound leakage prevention module of an electronic device stores multiple groups of filter coefficients and a holding angle corresponding to each group of filter coefficients.

[0149] In order to achieve the function of sound field playback, the electronic device includes at least two sound-generating devices. Each sound-generating device corresponds to a filter (also called a playback filter), that is, the filter corresponds to the sound-generating device one by one. The filter corresponding to the sound-generating device can filter the input signal (i.e., audio data) of the sound-generating device, so that the sound-generating device can output the input signal after filtering.

[0150] In the embodiment of the present application, the specific number of at least two sound-emitting devices included in the electronic device is not limited. In the embodiment of the present application, two sound-emitting devices included in the electronic device, namely, a first sound-emitting device (such as a receiver included in the electronic device) and a second sound-emitting device receiver (such as a screen sound-emitting device included in the electronic device) are used as an example for schematic illustration.

[0151] When the electronic device includes two sound-emitting devices, the electronic device includes two filters (i.e., playback filters), a first filter and a second filter. The first filter is a filter corresponding to the first sound-emitting device, i.e., the first filter can filter the input signal (i.e., audio data) of the first sound-emitting device, so that the first sound-emitting device can output the input signal after filtering (which may also be referred to as the first audio data in the embodiment of the present application). The second filter is a filter corresponding to the second sound-emitting device, i.e., the second filter can filter the input signal (i.e., audio data) of the second sound-emitting device, so that the second sound-emitting device can output the input signal after filtering (which may also be referred to as the second audio data in the embodiment of the present application).

[0152] When talking with a user using an electronic device, the electronic device can simultaneously output the filtered input signal through the first sound device and output the filtered input signal through the second sound device, thereby achieving the effect of sound field playback.

[0153] Before a user uses an electronic device to make a call, the electronic device, such as an anti-leakage sound module of the electronic device, can pre-store multiple groups of filter coefficients (which may also be referred to as audio optimization coefficients in the embodiment of the present application), and the holding angle corresponding to each group of filter coefficients. In other words, multiple audio optimization coefficients may include audio optimization coefficients corresponding to the electronic device at multiple different holding angles, and the audio optimization coefficients can be used to reduce the sound energy corresponding to the first audio data corresponding to the first sound-emitting device and the second audio data corresponding to the second sound-emitting device in the sound leakage area, thereby achieving sound field playback while avoiding the problem of sound leakage in the earpiece, preventing the leakage of user privacy, and improving the privacy security of the user.

[0154] Each group of filter coefficients may include multiple coefficients corresponding to the sound field playback filter, that is, the coefficients in each group of filter coefficients correspond one-to-one to the multiple sound field filters included in the electronic device. The filter coefficients can be used to optimize the filter, such as the filter can be multiplied by the coefficients corresponding to the filter, so that the optimized filter can filter the input signal of the sound-generating device. For example, when the electronic device includes a first filter and a second filter, each group of filter coefficients may include coefficients corresponding to the first filter and coefficients corresponding to the second filter.

[0155] In some examples, each set of filter coefficients may include multiple filter coefficients that correspond one-to-one to filters corresponding to the sound-emitting devices of the electronic device.

[0156] In some examples, different groups of filter coefficients correspond to different holding angles. The holding angle corresponding to the filter coefficient may be an angle or an angle range.

[0157] When the holding angle corresponding to the filter coefficient is an angle, that is, the holding angles corresponding to filter coefficients of different groups are different. In other words, each group of filter coefficients can correspond to a holding angle. For example, when the sound leakage prevention module stores 4 groups of filter coefficients, namely coefficient 1 (coefficient 1 includes two filter coefficients), coefficient 2 (coefficient 2 includes two filter coefficients), coefficient 3 (coefficient 3 includes two filter coefficients) and coefficient 4 (coefficient 4 includes two filter coefficients), the holding angle corresponding to coefficient 1 can be 10°, the holding angle corresponding to coefficient 2 can range from 21°, the holding angle corresponding to coefficient 3 can be 22°, and the holding angle corresponding to coefficient 4 can be 23°. In other words, when the holding angle is 10°, the corresponding filter coefficient is coefficient 1. When the holding angle is 20°, the corresponding filter coefficient is coefficient 2. When the holding angle is 21°, the corresponding filter coefficient is coefficient 3. When the holding angle is between 22°, the corresponding filter coefficient is coefficient 4.

[0158] When the holding angle corresponding to the filter coefficient is an angle range, it can be easily calculated, that is, different groups of filter coefficients correspond to different holding angle ranges. In other words, each group of filter coefficients can correspond to a holding angle range.

[0159] For example, when the sound leakage prevention module stores 4 groups of filter coefficients, namely coefficient 1 (coefficient 1 includes two filter coefficients), coefficient 2 (coefficient 2 includes two filter coefficients), coefficient 3 (coefficient 3 includes two filter coefficients) and coefficient 4 (coefficient 4 includes two filter coefficients), the range of holding angles corresponding to coefficient 1 can be [10°, 20°], the range of holding angles corresponding to coefficient 2 can be [20°, 30°], the range of holding angles corresponding to coefficient 3 can be [30°, 40°], and the range of holding angles corresponding to coefficient 4 can be [40°, 50°]. That is, when the holding angle is between 10° and 20°, the corresponding filter coefficient is coefficient 1. When the holding angle is between 20° and 30°, the corresponding filter coefficient is coefficient 2. When the holding angle is between 30° and 40°, the corresponding filter coefficient is coefficient 3. When the holding angle is between 40° and 50°, the corresponding filter coefficient is coefficient 4.

[0160] It should be noted that the specific type of holding angle corresponding to the filter coefficient is not limited in the embodiment of the present application. In the embodiment of the present application, the holding angle corresponding to the filter coefficient is taken as an angle range for illustration.

[0161] In some examples, each set of filter coefficients can be determined based on an acoustic energy contrast algorithm when the angle of the electronic device is set to the holding angle corresponding to the set of filter coefficients, and the filter coefficient corresponding to the holding angle is determined.

[0162] The following is a schematic illustration of determining the filter coefficient corresponding to each holding angle based on the acoustic energy contrast algorithm.

[0163] The acoustic energy contrast algorithm is an algorithm that maximizes the acoustic contrast control (ACC). That is, the acoustic energy contrast algorithm can measure the transfer function from the sound device to different target points, design a set of filter coefficients, and apply them to the first sound device and the second sound device respectively, so as to suppress the sound leakage point as much as possible while ensuring that the loudness in the ear remains unchanged.

[0164] The acoustic energy contrast algorithm requires the setting of acoustic bright and dark areas. Among them, the acoustic bright area (i.e., the listening area) can be the area where the desired signal energy is the largest, and the acoustic dark area (i.e., the leakage area) can be the area where the desired signal energy is the smallest. The acoustic energy contrast algorithm is different from the general active noise control and sound field playback ideas. The acoustic energy contrast algorithm adjusts the amplitude and phase of the input signal of the speaker array unit corresponding to the sound-emitting device to maximize the ratio of the acoustic energy between the bright and dark areas, thereby achieving the goal of radiating the acoustic energy to the bright area while minimizing the acoustic energy in the dark area.

[0165] That is to say, when the electronic device is fixed according to the first holding angle, the electronic device can be divided into corresponding listening areas and sound leakage areas. The listening area is the area where the user hopes to hear the audio when the electronic device outputs the audio through two sound-emitting devices. For example, the listening area can be the area on one side of the screen of the electronic device when the user uses the electronic device for a voice call. The sound leakage area is the area where the user does not want to hear the audio when the electronic device outputs the audio through two sound-emitting devices. For example, the sound leakage area can be the area on the other side of the screen of the electronic device when the user uses the electronic device for a voice call.

[0166] 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 screen of the electronic device where audio can be heard, and the sound leakage area may be all areas on the other side of the screen of the electronic device where audio can be heard. When a user uses an electronic device to make a voice call, the listening area may also be an area on one side of the screen of the electronic device that is in the same plane as the user's ear, and the sound leakage area may be an area on the other side of the screen of the electronic device that is in the same plane as the user's ear.

[0167] After the electronic device is divided into a corresponding listening area and a leakage sound area, a plurality of listening area sampling points and a plurality of leakage sound area sampling points may be determined. The listening area sampling points may be used to sample the audio in the listening area, so as to determine the sound energy in the listening area. The leakage sound area sampling points may be used to sample the audio in the leakage sound area, so as to determine the sound energy in the leakage sound area.

[0168] After determining a plurality of listening area sampling points and a plurality of sound leakage area sampling points, the electronic device may output the first audio data through the first sound emitting device, and output the second audio data through the second sound emitting device. Afterwards, the electronic device may obtain the sound energy corresponding to each listening area sampling point and the sound energy corresponding to each sound leakage area sampling point. The sound energy corresponding to each listening area sampling point may include the sound energy corresponding to the first audio data at the listening area sampling point and the sound energy corresponding to the second audio data at the listening area sampling point. The sound energy corresponding to each sound leakage area sampling point may include the sound energy corresponding to the first audio data at the sound leakage area sampling point and the sound energy corresponding to the second audio data at the sound leakage area sampling point.

[0169] After determining the acoustic energy corresponding to each listening area sampling point and the acoustic energy corresponding to each leakage area sampling point, the electronic device may determine the average acoustic energy corresponding to the listening area sampling point (i.e., the acoustic energy corresponding to the listening area) and the average acoustic energy corresponding to the leakage area sampling point (i.e., the acoustic energy corresponding to the leakage area). The acoustic energy corresponding to the listening area may include the acoustic energy corresponding to the first audio data in the listening area and the acoustic energy corresponding to the second audio data in the listening area. The acoustic energy corresponding to the leakage area may include the acoustic energy corresponding to the first audio data in the leakage area and the acoustic energy corresponding to the second audio data in the leakage area.

[0170] For example, the transfer function corresponding to the listening area can be expressed by the following formula 1:

[0171] Formula 1:

[0172] Among them, R b It can represent the transfer function corresponding to the listening area. It can represent the conjugate matrix of the transfer function matrix corresponding to the sampling point in the listening area, G b It can represent the transfer function matrix corresponding to the sampling point in the listening area, N b It can represent the number of sampling points in the listening area.

[0173] The transfer function corresponding to the sound leakage area can be expressed by the following formula 2:

[0174] Formula 2:

[0175] Among them, R d The transfer function corresponding to the sound leakage area can be expressed as It can represent the conjugate matrix of the transfer function matrix corresponding to the sampling point in the sound leakage area, G d It can represent the transfer function matrix corresponding to the sampling point in the sound leakage area, N d It can represent the number of sampling points in the sound leakage area.

[0176] Afterwards, the sound energy corresponding to the listening area (i.e., the transfer function corresponding to the listening area) can be expressed by the following formula 3:

[0177] Formula 3: e b =w H R b w;

[0178] Among them, e b It can represent the sound energy corresponding to the listening area, w H It can represent the conjugate matrix corresponding to the filter coefficients of the electronic device, R b can represent the transfer function corresponding to the listening area, and w can represent the matrix corresponding to the filter coefficients of the electronic device.

[0179] For example, the sound energy corresponding to the sound leakage area (i.e., the transfer function corresponding to the sound leakage area) can be expressed by the following formula 2:

[0180] Formula 4: e d =w H R d w;

[0181] Among them, e d It can represent the sound energy corresponding to the sound leakage area, w H It can represent the conjugate matrix corresponding to the filter coefficients of the electronic device, R d can represent the transfer function corresponding to the sound leakage area, and w can represent the matrix corresponding to the filter coefficient of the electronic device.

[0182] After determining the sound energy corresponding to the listening area and the sound leakage area, the electronic device can determine the coefficients of the filters corresponding to at least two sound-emitting devices (i.e., the coefficients corresponding to the first filter and the coefficients corresponding to the second filter when the electronic device is at the first holding angle) based on the sound energy corresponding to the listening area and the sound leakage area.

[0183] The optimization coefficient corresponding to the first filter may be the acoustic energy contrast corresponding to the first sound-emitting device. The acoustic energy contrast may be the ratio of the acoustic energy in the listening area to the acoustic energy in the sound leakage area. In order to minimize the acoustic energy of the first sound-emitting device in the sound leakage area, the acoustic energy contrast of the first sound-emitting device may be maximized. When the acoustic energy contrast of the first sound-emitting device is maximized, the acoustic energy in the sound leakage area corresponding to the first sound-emitting device is minimized.

[0184] The optimization coefficient corresponding to the second filter may be the acoustic energy contrast corresponding to the second sound-emitting device. The acoustic energy contrast may be the ratio of the acoustic energy in the listening area to the acoustic energy in the sound leakage area. In order to minimize the acoustic energy of the second sound-emitting device in the sound leakage area, the acoustic energy contrast of the second sound-emitting device may be maximized. When the acoustic energy contrast of the second sound-emitting device is maximized, the acoustic energy in the sound leakage area corresponding to the first sound-emitting device is minimized.

[0185] For example, the acoustic energy contrast can be expressed by the following formula 5:

[0186] Formula 5:

[0187] Among them, C can represent the acoustic energy contrast, w H It can represent the conjugate matrix corresponding to the filter coefficients of the electronic device, R b can represent the transfer function corresponding to the listening area, and w can represent the matrix of filter coefficients of the electronic device.

[0188] The larger the value of the acoustic energy contrast, the greater the difference in acoustic energy between the listening area and the sound leakage area. The idea of ​​the acoustic energy contrast algorithm is to maximize the acoustic energy ratio, that is, C max .

[0189] For example, the maximum value of the acoustic energy contrast can be expressed by the following formula 6:

[0190] Formula 6:

[0191] Among them, C max It can represent the maximum value of the acoustic energy contrast, R d The transfer function matrix corresponding to the sound leakage area can be expressed as R b It can represent the transfer function matrix corresponding to the listening area, w opt The coefficient corresponding to the filter of the electronic device when the maximum value of the sound energy contrast can be expressed.

[0192] According to formula 6, in C max When it is the maximum value, w can be obtained opt , w opt That is, the coefficient of the filter obtained based on the acoustic energy contrast algorithm. opt Can include w 1 and w 2 , w 1 It can be the coefficient corresponding to the first filter when the electronic device is at different holding angles, w 2 It may be the coefficients corresponding to the second filter when the electronic device is at different holding angles.

[0193] It should be noted that the multiple sets of filter coefficients stored in the sound leakage prevention module of the electronic device and the holding angles corresponding to each set of filter coefficients may include filter coefficients corresponding to standard holding angles. That is, the multiple sets of filter coefficients stored in the sound leakage prevention module of the electronic device and the holding angles corresponding to each set of filter coefficients may include the filter coefficients corresponding to the angle at which the user holds the electronic device when talking on the electronic device under normal circumstances.

[0194] S702: When the electronic device is in a call scenario, an angle sensor of the electronic device obtains angle information of the electronic device.

[0195] After the sound leakage prevention module of the electronic device stores multiple sets of filter coefficients and the holding angles corresponding to each set of filter coefficients, the user can talk with other electronic devices through the electronic device. That is, when the electronic device is in a call scene, the angle sensor of the electronic device can obtain the angle information of the electronic device.

[0196] In some examples, the call scenario may include a user using an electronic device to make a voice call with another electronic device, and the call scenario may also include a user using an electronic device to make a video call with another electronic device. The specific type of the call scenario is not limited in the embodiments of the present application.

[0197] In some examples, the angle sensor of the electronic device may be a sensor capable of acquiring angle information of the electronic device. For example, the angle sensor may be an inertial measurement unit (IMU) sensor. The IMU sensor may detect the angle information of the electronic device, and thus may determine the holding angle of the electronic device based on the angle information of the electronic device.

[0198] In some examples, the angle information of the electronic device may include Y-axis information of the electronic device, so that the holding angle of the electronic device can be determined based on the Y-axis information of the electronic device.

[0199] In other examples, the angle information of the electronic device may include three-axis information of the electronic device, namely, X-axis information, Y-axis information, and Z-axis information of the electronic device, so that the holding angle of the electronic device can be comprehensively determined based on the X-axis information, Y-axis information, and Z-axis information of the electronic device.

[0200] In some examples, when the electronic device is in a call scenario, the angle sensor of the electronic device can obtain the angle information of the electronic device once every preset time period. The angle information of the electronic device obtained by the angle sensor of the electronic device can also be called a frame of angle information. The specific duration of the preset time period can be set according to actual conditions, and this is not limited in the embodiments of the present application. For example, the preset time period can be 10 milliseconds. In other words, the angle sensor of the electronic device can obtain the angle information corresponding to the electronic device at multiple times.

[0201] After the angle sensor of the electronic device acquires the angle information of the electronic device once every preset time period, the angle sensor may send the acquired angle information to the sound leakage prevention module of the electronic device.

[0202] In other examples, when the electronic device is in a call scenario, the angle sensor of the electronic device can also obtain the angle information of the electronic device in real time. The angle sensor can send the obtained angle information to the sound leakage prevention module of the electronic device in real time.

[0203] It should be noted that when the electronic device is in a call scenario, after the angle sensor of the electronic device obtains the angle information of the electronic device, the angle sensor of the electronic device can also determine the angle of the electronic device based on the angle information of the electronic device. After determining the angle of the electronic device, the angle sensor of the electronic device can send the angle of the electronic device to the sound leakage prevention module of the electronic device, so that the sound leakage prevention module of the electronic device can determine the corresponding filter coefficient according to the angle of the electronic device.

[0204] S703: The angle sensor of the electronic device sends angle information of the electronic device to the sound leakage prevention module.

[0205] After the angle sensor of the electronic device obtains the angle information of the electronic device, the angle sensor of the electronic device can send the obtained angle information to the anti-sound leakage module of the electronic device, so that the anti-sound leakage module of the electronic device can determine the angle of the electronic device according to the angle information of the electronic device.

[0206] S704: The sound leakage prevention module of the electronic device receives the angle information of the electronic device, and determines the angle of the electronic device according to the angle information of the electronic device.

[0207] After the sound leakage prevention module of the electronic device receives the angle information of the electronic device, the sound leakage prevention module of the electronic device can determine the angle of the electronic device (also referred to as the second holding angle in the embodiment of the present application) according to the angle information of the electronic device. The angle of the electronic device is the angle between the user's face and the electronic device when the user uses the electronic device to make a call.

[0208] After the sound leakage prevention module of the electronic device determines the angle of the electronic device based on the angle information of the electronic device, the sound leakage prevention module of the electronic device can store the angle of the electronic device, so that the sound leakage prevention module of the electronic device determines whether the number of angles of the electronic device is greater than a preset threshold.

[0209] In some examples, when the angle information of the electronic device includes the Y-axis information of the electronic device, the sound leakage prevention module of the electronic device can determine the angle of the electronic device according to the Y-axis information of the electronic device. That is, according to the Y-axis information of the electronic device, the angle between the user's face and the electronic device when the user uses the electronic device for a call can be determined.

[0210] In other examples, when the angle information of the electronic device includes the X-axis information, Y-axis information, and Z-axis information of the electronic device, the sound leakage prevention module of the electronic device can determine the angle of the electronic device based on the X-axis information, Y-axis information, and Z-axis information of the electronic device. That is, based on the X-axis information, Y-axis information, and Z-axis information of the electronic device, the angle between the user's face and the electronic device when the user uses the electronic device for a call can be comprehensively determined.

[0211] In some examples, when the angle sensor of the electronic device obtains the angle information of the electronic device once every preset time period, that is, the anti-leakage sound module of the electronic device can receive the angle information of the electronic device sent by the angle sensor of the electronic device once every preset time period, that is, receive one frame of the angle information of the electronic device every preset time period.

[0212] After the sound leakage prevention module of the electronic device receives a frame of angle information of the electronic device every preset time period, the sound leakage prevention module of the electronic device can determine the angle of the corresponding electronic device based on the angle information of the frame of electronic device. That is, after the sound leakage prevention module of the electronic device receives a frame of angle information of the electronic device every preset time period, the sound leakage prevention module of the electronic device can determine the angle of the frame of electronic device. In other words, the second holding angles corresponding to the electronic device at multiple moments can be determined based on the angle information corresponding to multiple moments.

[0213] After the anti-sound leakage module of the electronic device determines the angle of a frame of the electronic device, the anti-sound leakage module of the electronic device stores the determined angle of the frame of the electronic device, so that when the number of determined angles of the electronic device is greater than a preset threshold, the anti-sound leakage module of the electronic device can determine the current holding angle of the electronic device based on multiple angles of the electronic device.

[0214] It should be noted that after the sound leakage prevention module of the electronic device determines the angle of the electronic device, the sound leakage prevention module of the electronic device can also determine whether the angle of the electronic device exceeds a first preset angle range. The first preset angle range can be the range of the holding angle of the electronic device when the user uses the electronic device for a call under normal circumstances.

[0215] The specific value of the first preset angle range can be set according to actual conditions, and is not limited in the embodiments of the present application. For example, the first preset angle range can be [10°, 50°], that is, in general, when a user uses an electronic device to make a call, the holding angle of the electronic device ranges from 10° to 50°. Whether the current holding angle of the electronic device exceeds the preset angle range, that is, the current holding angle of the electronic device is less than 10°, or the current holding angle of the electronic device is greater than 50°.

[0216] When the sound leakage prevention module of the electronic device determines that the angle of the electronic device exceeds the preset angle range, the electronic device can determine the angle of the electronic device as the first preset angle, so that the electronic device can store the first preset angle. That is, when the plurality of second holding angles include a third holding angle, and the third holding angle is outside the first preset angle range, the electronic device can update the third angle to the first preset angle. Afterwards, the electronic device can continue to execute the following S705.

[0217] When the sound leakage prevention module of the electronic device determines that the angle of the electronic device does not exceed the preset angle range, the electronic device can store the angle of the electronic device. That is, when the plurality of second holding angles do not include the third holding angle, and the third holding angle is outside the first preset angle range, the electronic device can store the second holding angle. Afterwards, the electronic device can continue to execute the following S705.

[0218] The specific value of the first preset angle can be set according to actual conditions, and is not limited in the embodiments of the present application. For example, the first preset angle can be an angle within the above preset angle range, such as when the preset angle range is [10°, 50°], the first preset angle can be 10°.

[0219] S705: The sound leakage prevention module of the electronic device determines whether the number of angles of the electronic device is greater than a preset threshold.

[0220] After the sound leakage prevention module of the electronic device determines the angle of the electronic device according to the angle information of the electronic device, the electronic device can determine whether the number of angles of the electronic device is greater than a preset threshold. The specific value of the preset threshold can be set according to actual conditions, and this is not limited in the embodiments of the present application.

[0221] If the anti-leakage module of the electronic device determines that the number of angles of the electronic device is not greater than the preset threshold, the electronic device can continue to execute the following S706-S708. If the anti-leakage module of the electronic device determines that the number of angles of the electronic device is greater than the preset threshold, the electronic device can continue to execute the following S709.

[0222] S706: The sound leakage prevention module of the electronic device determines that the filter coefficient is a first preset filter coefficient.

[0223] When the number of angles of the electronic device determined by the sound leakage prevention module of the electronic device is not greater than the preset threshold (i.e., less than or equal to the preset threshold), the sound leakage prevention module of the electronic device can determine that the number of angles of the electronic device currently determined is small. If the current holding angle of the electronic device is determined based on the currently determined angle of the electronic device, the accuracy of the current holding angle of the electronic device determined will be low.

[0224] When the sound leakage prevention module of the electronic device determines that the number of angles of the electronic device currently determined is small, the sound leakage prevention module of the electronic device can determine that the filter coefficient is a first preset filter coefficient (which may also be referred to as a first preset audio optimization coefficient in the embodiment of the present application). The first preset filter coefficient may include two filter coefficients, namely, a coefficient corresponding to the first filter and a coefficient corresponding to the second filter.

[0225] In some examples, the first preset filter coefficient may be a filter coefficient in a plurality of sets of filter coefficients stored in the sound leakage prevention module of the electronic device. For example, when the plurality of sets of filter coefficients stored include filter coefficients corresponding to a holding angle of 20°, the first preset filter coefficient may be a filter coefficient corresponding to a holding angle of 20°.

[0226] Furthermore, the first preset filter coefficient may be a filter coefficient corresponding to a standard holding angle (which may also be referred to as a first preset holding angle in the embodiment of the present application) among multiple sets of filter coefficients stored in the sound leakage prevention module of the electronic device. For example, when the multiple sets of filter coefficients stored include filter coefficients corresponding to a holding angle of 10° and filter coefficients corresponding to a holding angle of 20°, and the standard holding angle is 10°, the first preset filter coefficient may be a filter coefficient corresponding to a holding angle of 10°.

[0227] In some examples, the first preset filter coefficient may also be a historical filter coefficient. The historical filter coefficient may be a coefficient corresponding to the filter when the user last made a call through the electronic device.

[0228] S707: The sound leakage prevention module of the electronic device sends a first preset filter coefficient to the filter.

[0229] After the sound leakage prevention module of the electronic device determines that the filter coefficient is the first preset filter coefficient, the sound leakage prevention module of the electronic device may send the first preset filter coefficient to the filter.

[0230] When the first preset filter coefficient includes two filter coefficients, namely, the coefficient corresponding to the first filter and the coefficient corresponding to the second filter, the anti-sound leakage module of the electronic device sends the first preset filter coefficient to the filter, which may include: the anti-sound leakage module of the electronic device sends the coefficient corresponding to the first filter in the first preset filter coefficient to the first filter, and sends the coefficient corresponding to the second filter in the first preset filter coefficient to the second filter.

[0231] S708: The filter of the electronic device receives the first preset filter coefficient and optimizes the filter according to the first preset filter coefficient.

[0232] After the filter of the electronic device receives the first preset filter coefficient, the filter of the electronic device may optimize the filter according to the first preset filter coefficient.

[0233] That is, when the filter of the electronic device includes a first filter and a second filter, after the first filter receives the coefficient corresponding to the first filter in the first preset filter coefficient sent by the sound leakage prevention module of the electronic device, the first filter can be optimized according to the coefficient corresponding to the first filter. For example, the first filter can be multiplied by the coefficient corresponding to the first filter, so that the optimized first filter can filter the input signal of the first sound-emitting device. Afterwards, the first sound-emitting device can output the signal filtered by the first filter.

[0234] After the second filter receives the coefficient corresponding to the second filter in the first preset filter coefficient sent by the sound leakage prevention module of the electronic device, the second filter can be optimized according to the coefficient corresponding to the second filter. For example, the second filter can be multiplied by the coefficient corresponding to the second filter, so that the optimized second filter can filter the input signal of the second sound-emitting device. Afterwards, the second sound-emitting device can output the signal filtered by the second filter.

[0235] S709: The sound leakage prevention module of the electronic device determines the current holding angle of the electronic device according to the angle of the electronic device.

[0236] When the number of angles of the electronic device determined by the sound leakage prevention module of the electronic device is greater than a preset threshold (i.e., less than or equal to the preset threshold), the sound leakage prevention module of the electronic device can determine that the number of currently determined angles of the electronic device is large. According to the large number of currently determined angles of the electronic device, the accuracy of determining the current holding angle of the electronic device is high.

[0237] When the sound leakage prevention module of the electronic device determines that the number of angles of the electronic device currently determined is large, the sound leakage prevention module of the electronic device can determine the current holding angle of the electronic device based on the angle of the electronic device, and thus can determine the coefficient corresponding to the filter based on the current holding angle of the electronic device.

[0238] In some examples, when the sound leakage prevention module of the electronic device determines that the number of currently determined angles of the electronic device is large, the sound leakage prevention module of the electronic device determines the current holding angle of the electronic device based on the multiple angles of the electronic device, which may include: the sound leakage prevention module of the electronic device determines the average value of the angles of the electronic device based on the multiple angles of the electronic device, and the sound leakage prevention module of the electronic device determines the average value of the angles of the multiple electronic devices as the current holding angle of the electronic device.

[0239] For example, the sound leakage prevention module of the electronic device determines the average value of the angle of the electronic device according to multiple angles of the electronic device, which can be determined by the following code:

[0240]

[0241] That is, the sound leakage prevention module of the electronic device can first sum the multiple angles of the electronic device to obtain the sum of the multiple angles. Then, the sound leakage prevention module of the electronic device can divide the sum of the multiple angles by the number of the multiple angles of the electronic device to obtain the average value of the angles of the electronic device.

[0242] S710. The sound leakage prevention module of the electronic device determines whether the current holding angle of the electronic device exceeds a preset angle range.

[0243] After the sound leakage prevention module of the electronic device determines the current holding angle of the electronic device, the sound leakage prevention module of the electronic device can determine whether the current holding angle of the electronic device exceeds a preset angle range. The preset angle range is the range of the holding angle of the electronic device when the user uses the electronic device for a call under normal circumstances.

[0244] The specific value of the preset angle range can be set according to actual conditions, and is not limited in the embodiments of the present application. For example, the preset angle range can be [10°, 50°], that is, in general, when a user uses an electronic device to make a call, the holding angle of the electronic device ranges from 10° to 50°. Whether the current holding angle of the electronic device exceeds the preset angle range, that is, the current holding angle of the electronic device is less than 10°, or the current holding angle of the electronic device is greater than 50°.

[0245] If the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device exceeds the preset angle range, the electronic device can continue to execute the following S711-S713. If the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device does not exceed the preset angle range, the electronic device can continue to execute the following S714.

[0246] S711. The sound leakage prevention module of the electronic device determines that the filter coefficient is a second preset filter coefficient.

[0247] When the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device exceeds the preset angle range, the sound leakage prevention module of the electronic device can determine the filter coefficient to be a second preset filter coefficient (which may also be referred to as a second preset audio optimization coefficient in the embodiment of the present application).

[0248] The second preset filter coefficient may include two filter coefficients, ie, a coefficient corresponding to the first filter and a coefficient corresponding to the second filter.

[0249] In some examples, the second preset filter coefficient may be a filter coefficient from a plurality of sets of filter coefficients stored in the sound leakage prevention module of the electronic device. For example, when the plurality of sets of filter coefficients stored include filter coefficients corresponding to a holding angle of 20°, the second preset filter coefficient may be a filter coefficient corresponding to a holding angle of 20°.

[0250] Furthermore, the second preset filter coefficient may be a filter coefficient corresponding to a standard holding angle (which may also be referred to as a second preset angle in the embodiment of the present application) among multiple sets of filter coefficients stored in the sound leakage prevention module of the electronic device. For example, when the multiple sets of filter coefficients stored include filter coefficients corresponding to a holding angle of 10° and filter coefficients corresponding to a holding angle of 20°, and the standard holding angle is 10°, the second preset filter coefficient may be a filter coefficient corresponding to a holding angle of 10°.

[0251] It should be noted that the second preset filter coefficient may be the same as the first preset filter coefficient, or may be different from the first preset filter coefficient, which is not limited in the embodiments of the present application.

[0252] S712. The sound leakage prevention module of the electronic device sends a second preset filter coefficient to the filter.

[0253] After the sound leakage prevention module of the electronic device determines that the filter coefficient is the second preset filter coefficient, the sound leakage prevention module of the electronic device may send the second preset filter coefficient to the filter.

[0254] When the second preset filter coefficient includes two filter coefficients, namely, the coefficient corresponding to the first filter and the coefficient corresponding to the second filter, the anti-sound leakage module of the electronic device sends the second preset filter coefficient to the filter, which may include: the anti-sound leakage module of the electronic device sends the coefficient corresponding to the first filter in the second preset filter coefficient to the first filter, and sends the coefficient corresponding to the second filter in the second preset filter coefficient to the second filter.

[0255] S713: The filter of the electronic device receives the second preset filter coefficient and optimizes the filter according to the second preset filter coefficient.

[0256] After the filter of the electronic device receives the second preset filter coefficient, the filter of the electronic device may optimize the filter according to the second preset filter coefficient.

[0257] That is, when the filter of the electronic device includes a first filter and a second filter, after the first filter receives the coefficient corresponding to the first filter in the second preset filter coefficient sent by the sound leakage prevention module of the electronic device, the first filter can be optimized according to the coefficient corresponding to the first filter. For example, the first filter can be multiplied by the coefficient corresponding to the first filter, so that the optimized first filter can filter the input signal of the first sound-emitting device. Afterwards, the first sound-emitting device can output the signal filtered by the first filter.

[0258] After the second filter receives the coefficient corresponding to the second filter in the second preset filter coefficient sent by the anti-leakage module of the electronic device, the second filter can be optimized according to the coefficient corresponding to the second filter. For example, the second filter can be multiplied by the coefficient corresponding to the second filter, so that the optimized second filter can filter the input signal of the second sound-emitting device. Afterwards, the second sound-emitting device can output the signal filtered by the second filter.

[0259] S714. The sound leakage prevention module of the electronic device determines a filter coefficient corresponding to the current holding angle from multiple groups of filter coefficients according to the current holding angle of the electronic device.

[0260] When the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device does not have a preset angle range (that is, the current holding angle of the electronic device is within the preset angle range), the sound leakage prevention module of the electronic device can determine the filter coefficient corresponding to the current holding angle from the stored multiple sets of filter coefficients (which may also be referred to as the target audio optimization coefficient in the embodiment of the present application).

[0261] In some examples, when the holding angles corresponding to multiple sets of filter coefficients stored in the anti-sound leakage module of the electronic device are one angle, that is, when the holding angles corresponding to different sets of filter coefficients are different, the anti-sound leakage module of the electronic device can determine the filter coefficient corresponding to the current holding angle from the stored multiple sets of filter coefficients.

[0262] For example, when the sound leakage prevention module stores 4 groups of filter coefficients, namely coefficient 1 (coefficient 1 includes two filter coefficients), coefficient 2 (coefficient 2 includes two filter coefficients), coefficient 3 (coefficient 3 includes two filter coefficients) and coefficient 4 (coefficient 4 includes two filter coefficients), the holding angle corresponding to coefficient 1 can be 10°, the holding angle corresponding to coefficient 2 can be in the range of 21°, the holding angle corresponding to coefficient 3 can be 22°, and the holding angle corresponding to coefficient 4 can be 23°. If the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device is 21°, the sound leakage prevention module of the electronic device can determine that the filter coefficient corresponding to the current holding angle is coefficient 2.

[0263] In other examples, when the holding angles corresponding to multiple groups of filter coefficients stored in the sound leakage prevention module of the electronic device are an angle range, that is, the holding angle ranges corresponding to different groups of filter coefficients are different, the sound leakage prevention module of the electronic device can determine the angle range in which the current holding angle of the electronic device is located, and thereby determine the filter coefficient corresponding to the angle range as the filter coefficient corresponding to the current holding angle.

[0264] For example, when the sound leakage prevention module stores 4 groups of filter coefficients, namely coefficient 1 (coefficient 1 includes two filter coefficients), coefficient 2 (coefficient 2 includes two filter coefficients), coefficient 3 (coefficient 3 includes two filter coefficients) and coefficient 4 (coefficient 4 includes two filter coefficients), the range of holding angles corresponding to coefficient 1 can be [10°, 20°], the range of holding angles corresponding to coefficient 2 can be [20°, 30°], the range of holding angles corresponding to coefficient 3 can be [30°, 40°], and the range of holding angles corresponding to coefficient 4 can be [40°, 50°]. If the sound leakage prevention module of the electronic device determines that the current holding angle of the electronic device is 21°, the sound leakage prevention module of the electronic device can determine that the angle range corresponding to the current holding angle is [20°, 30°], and the sound leakage prevention module of the electronic device can determine that the filter coefficient corresponding to the current holding angle is coefficient 2.

[0265] S715. The sound leakage prevention module of the electronic device sends a filter coefficient corresponding to the current holding angle to the filter.

[0266] After the sound leakage prevention module of the electronic device outputs the filter coefficient corresponding to the current holding angle, the sound leakage prevention module of the electronic device may send the filter coefficient corresponding to the current holding angle to the filter.

[0267] When the filter coefficient corresponding to the current holding angle may include two filter coefficients, namely, the coefficient corresponding to the first filter and the coefficient corresponding to the second filter, the anti-sound leakage module of the electronic device sends the filter coefficient corresponding to the current holding angle to the filter, which may include: the anti-sound leakage module of the electronic device sends the coefficient corresponding to the first filter among the filter coefficients corresponding to the current holding angle to the first filter, and sends the coefficient corresponding to the second filter among the filter coefficients corresponding to the current holding angle to the second filter.

[0268] S716: The filter of the electronic device receives the filter coefficient corresponding to the current holding angle, and optimizes the filter according to the filter coefficient corresponding to the current holding angle.

[0269] After the filter of the electronic device receives the filter coefficient corresponding to the current holding angle, the filter of the electronic device may optimize the filter according to the filter coefficient corresponding to the current holding angle.

[0270] That is, when the filter of the electronic device includes a first filter and a second filter, after the first filter receives the coefficient corresponding to the first filter in the filter coefficient corresponding to the current holding angle sent by the sound leakage prevention module of the electronic device, the first filter can be optimized according to the coefficient corresponding to the first filter. For example, the first filter can be multiplied by the coefficient corresponding to the first filter, so that the optimized first filter can filter the input signal of the first sound-emitting device. Afterwards, the first sound-emitting device can output the signal filtered by the first filter (which may also be referred to as the first audio data in the embodiment of the present application).

[0271] After the second filter receives the coefficient corresponding to the second filter in the filter coefficient corresponding to the current holding angle sent by the sound leakage prevention module of the electronic device, the second filter can be optimized according to the coefficient corresponding to the second filter. For example, the second filter can be multiplied by the coefficient corresponding to the second filter, so that the optimized second filter can filter the input signal of the second sound-emitting device. Afterwards, the second sound-emitting device can output the signal filtered by the second filter (which may also be referred to as the second audio data in the embodiment of the present application).

[0272] In the solution of the present application, 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 pre-store the coefficients of the filters corresponding to the at least two sound-emitting devices at different holding angles. When the electronic device is making a call, the electronic device can obtain the current holding angle, and then select the coefficient of the filter corresponding to the current holding angle from the coefficients of the filters corresponding to the at least two sound-emitting devices at different holding angles according to the current holding angle. Afterwards, the filters corresponding to the at least two sound-emitting devices can be optimized respectively by the coefficients of the filters corresponding to the current holding angle, so that when the user uses the electronic device to make a call, the optimized filters 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.

[0273] And because the coefficients of the 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 sound leakage area, the optimized filter can reduce the sound energy of the sound-emitting device in the sound 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 sound leakage area is reduced. And the output signals of at least two sound-emitting devices can also achieve interference cancellation in the sound leakage area. Therefore, the scheme of the present application can prevent sound leakage in the sound leakage area. At the same time, the optimized filter can keep the sound energy in the listening area unchanged. In other words, the scheme of the present application can reduce the sound energy in the sound leakage area while realizing the sound field playback by using at least two sound-emitting devices. That is, the scheme of the present application can ensure the user's hearing experience while preventing sound leakage.

[0274] In addition, in the solution of the present application, the electronic device selects the coefficient of the filter corresponding to the current holding angle from the coefficients of the filters corresponding to at least two sound-emitting devices at different holding angles according to the current holding angle. Therefore, the solution of the present application can ensure the sound leakage prevention effect of the electronic device and the user's hearing experience when the user uses the electronic device to make calls at different holding angles.

[0275] For ease of understanding, the following Figures 8 to 10 , taking an electronic device including two sound-emitting devices, namely a first sound-emitting device and a second sound-emitting device, the first filter is a playback filter corresponding to the first sound-emitting device, and the second filter is a playback filter corresponding to the second sound-emitting device as an example, the audio processing method provided in an embodiment of the present application is schematically illustrated.

[0276] like Figure 8 As shown, the audio processing method provided in the embodiment of the present application may include the following steps:

[0277] An electronic device (such as a mobile phone) can pre-store multiple sets of filter coefficients and the holding angle corresponding to each set of filter coefficients. The holding angle corresponding to each set of filter coefficients is different, and each set of filters includes filter coefficients corresponding to the first filter and filter coefficients corresponding to the second filter. Each set of filter coefficients is obtained based on the sound energy contrast algorithm. In other words, the electronic device can preset multiple sets of algorithm coefficients.

[0278] When a user uses an electronic device (such as a mobile phone) to make a call, the electronic device can obtain sensor information (ie, angle information of the electronic device). For example, the electronic device can obtain sensor information (ie, angle information of the electronic device) every preset time period.

[0279] After the electronic device acquires the sensor information, the angle θ may be acquired according to the sensor information, that is, the electronic device may determine the angle θ of the electronic device according to the sensor information.

[0280] After the electronic device determines the angle θ of the electronic device, the electronic device may determine whether the number of the angle θ of the electronic device is greater than a preset threshold, that is, the electronic device may determine whether the angle θ of the electronic device is accumulated for N frames.

[0281] When the electronic device determines that the angle θ of the electronic device has not accumulated N frames, the electronic device can keep the filter in a historical state, that is, the electronic device can set the filter coefficient of the filter to a preset filter coefficient, such as the first preset filter coefficient mentioned above.

[0282] When the electronic device determines the angle θ of the electronic device and accumulates N frames, the electronic device can calculate the current angle state of the electronic device according to the accumulated angle θ of the electronic device. That is, the electronic device can determine the current holding angle of the electronic device according to the accumulated holding angle θ of the electronic device.

[0283] After calculating the current angle state of the electronic device, the electronic device can determine the filter coefficients corresponding to the current angle state according to the current angle state and multiple sets of preset algorithm coefficients. In other words, the electronic device can switch the corresponding algorithm parameter update state according to the current angle state.

[0284] After determining the filter coefficients corresponding to the current angle state, the electronic device may output the filter coefficients corresponding to the current angle state to the filter (ie, output them to the first filter and the second filter, respectively).

[0285] It should be noted that before the electronic device calculates the current angle state of the electronic device, the electronic device may also determine whether the angle θ of the electronic device exceeds a preset angle range. The preset angle range may be [10°, 50°].

[0286] Combination Fig. 9 As shown, after the electronic device acquires the sensor information, the angle θ can be acquired according to the sensor information, that is, the electronic device can determine the angle θ of the electronic device according to the sensor information.

[0287] After the electronic device determines the angle θ of the electronic device, the electronic device may determine whether the angle θ of the electronic device exceeds a preset angle range.

[0288] When the electronic device determines that the angle θ of the electronic device exceeds the preset angle range, the electronic device can set the angle θ of the electronic device to a default value of 10°. Thereafter, the electronic device can calculate the current angle state of the electronic device according to the default value of 10°.

[0289] When the electronic device determines that the angle θ of the electronic device does not exceed the preset angle range, the electronic device may calculate the current angle state of the electronic device according to the angle θ of the electronic device.

[0290] It should be noted that after the electronic device calculates the current angle state of the electronic device, the electronic device can also determine which angle range the current angle state of the electronic device is in. The angle range may include the angle range of the holding angle corresponding to each set of filter coefficients pre-stored by the electronic device (such as a mobile phone).

[0291] For example, the electronic device (such as a mobile phone) pre-stores multiple sets of filter coefficients including coefficient 1, coefficient 2, coefficient 3, and coefficient 4. The angle range corresponding to coefficient 1 may be [10°, 20°], the angle range corresponding to coefficient 2 may be [20°, 30°], the angle range corresponding to coefficient 3 may be [30°, 40°], and the angle range corresponding to coefficient 4 may be [40°, 50°].

[0292] Combination Fig.10 As shown, after the electronic device calculates the current angle state of the electronic device, the angle range of the current angle state can be determined.

[0293] When the electronic device determines that the angle range of the current angle state is [10°, 20°], the electronic device may determine that the coefficient of the filter is coefficient 1, so that the electronic device may update the coefficient of the filter.

[0294] When the electronic device determines that the angle range of the current angle state is [20°, 30°], the electronic device may determine that the coefficient of the filter is 2, so that the electronic device may update the coefficient of the filter.

[0295] When the electronic device determines that the angle range of the current angle state is [30°, 40°], the electronic device may determine that the coefficient of the filter is 3, so that the electronic device may update the coefficient of the filter.

[0296] When the electronic device determines that the angle range of the current angle state is [40°, 50°], the electronic device may determine that the coefficient of the filter is 4, so that the electronic device may update the coefficient of the filter.

[0297] For ease of understanding, the following Fig.11 The audio processing method provided in the embodiment of the present application is described. Fig.11 As shown, the audio processing method may include the following S1101-S1104.

[0298] S1101: When the electronic device is in a call scenario, determine a first holding angle of the electronic device, where the first holding angle is an angle between the electronic device and a user's face.

[0299] 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.

[0300] In some examples, when the 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 may 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 the 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.

[0301] In some examples, determining the first holding angle of the electronic device may include: obtaining angle information corresponding to the electronic device at multiple times. Then, based on the angle information corresponding to the multiple times, determining the second holding angles corresponding to the electronic device at the multiple times. Then, based on the second holding angles corresponding to the multiple times, determining the first holding angle.

[0302] The angle information may include Y-axis information of the electronic device. In some examples, the angle information may also include X-axis information and Y-axis information of the electronic device.

[0303] That is to say, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments. Then, according to the angles corresponding to the multiple moments, the first holding angle can be accurately determined, that is, the angle between the electronic device and the user's face when the electronic device is in a call scene. Therefore, based on the accurate first holding angle, the target audio optimization coefficient can be accurately determined.

[0304] In some examples, determining the first holding angle based on the second holding angles corresponding to the multiple moments may include: when the multiple second holding angles include the third holding angle, updating the third holding angle to the first preset angle, and determining the first holding angle based on the first preset angle and the fourth holding angle. The third holding angle is outside the first preset angle range, and the fourth holding angle is within the first preset angle range. When the multiple second holding angles do not include the third holding angle, determining the first holding angle based on the multiple second holding angles.

[0305] In some examples, the first preset angle may be 10°, and the specific value of the first preset angle is not limited in the embodiments of the present application. The first preset angle range may be [10°, 50°], and the specific value of the first preset angle range is not limited in the embodiments of the present application.

[0306] That is to say, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments, and then further screens the angles corresponding to multiple moments, so as to set the angles out of range as the preset angles, so as to more accurately determine the first holding angle, that is, the angle between the electronic device and the user's face when the electronic device is in a call scene. Therefore, based on the accurate first holding angle, the target audio optimization coefficient can be accurately determined.

[0307] In some examples, the above-mentioned determination of the first holding angle based on the first preset angle and the fourth holding angle may include: determining the first angle average value based on the first preset angle and the fourth holding angle; determining the first holding angle based on the first angle average value; the above-mentioned determination of the first holding angle based on multiple second holding angles may include: determining the second angle average value based on multiple second holding angles; determining the first holding angle based on the second angle average value.

[0308] That is to say, the electronic device determines the angles corresponding to multiple moments through the angle information corresponding to the electronic device at multiple moments, and then calculates the average value of the angles corresponding to the multiple moments, so that the first holding angle can be determined more accurately according to the average value.

[0309] In some examples, determining the first holding angle based on the second holding angles corresponding to multiple moments may include: when the number of the multiple second holding angles is greater than or equal to a preset threshold, determining the first holding angle based on the second holding angles corresponding to multiple moments.

[0310] The specific value of the preset threshold can be determined according to actual conditions and is not limited in the embodiments of the present application.

[0311] That is, the electronic device determines the angles corresponding to the multiple moments through the angle information corresponding to the electronic device at the multiple moments, and then, when the number of the angles corresponding to the multiple moments is greater than a preset threshold, the first holding angle is determined according to the angles corresponding to the multiple moments. Since the number of the angles corresponding to the multiple moments is large enough, the accuracy of the determined first holding angle can be improved.

[0312] In some examples, when the number of multiple second holding angles is less than a preset threshold, the target audio optimization coefficient is determined to be a first preset audio optimization coefficient, and the first preset audio optimization coefficient is an audio optimization coefficient corresponding to a first preset holding angle among multiple audio optimization coefficients stored in the electronic device.

[0313] That is, the electronic device determines the angles corresponding to the multiple moments through the angle information corresponding to the electronic device at the multiple moments, and then, when the number of angles corresponding to the multiple moments is less than the preset threshold, the audio optimization coefficient is set to the preset audio optimization coefficient among the multiple audio optimization coefficients stored in the electronic device. Thus, when the number of angles corresponding to the multiple moments is less than the preset threshold, the electronic device can still optimize the filter through the audio optimization coefficient.

[0314] Specifically, the specific implementation of determining the first holding angle of the electronic device by the electronic device in the embodiment of the present application can refer to the specific implementation in S701-S709 above, which will not be described in detail in the embodiment of the present application.

[0315] S1102. Determine a target audio optimization coefficient from a plurality of audio optimization coefficients stored in the electronic device based on the first holding angle.

[0316] The multiple audio optimization coefficients may include audio optimization coefficients corresponding to the electronic device at multiple different holding angles, and the audio optimization coefficients are used to reduce the acoustic energy corresponding to the first audio data corresponding to the first sound device and the second audio data corresponding to the second sound device in the sound leakage area. The audio optimization coefficient may include a first optimization coefficient corresponding to the first filter and a second optimization coefficient corresponding to the second filter. The audio optimization coefficient may be obtained by an acoustic energy contrast algorithm.

[0317] In some examples, the above-mentioned determination of the target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device based on the first holding angle may include: when the first holding angle is outside the second preset angle range, determining the target audio optimization coefficient as the second preset audio optimization coefficient, the second preset audio optimization coefficient being the audio optimization coefficient corresponding to the second preset holding angle among the multiple audio optimization coefficients stored in the electronic device; when the first holding angle is within the second preset angle range, determining the target audio optimization coefficient as the audio optimization coefficient corresponding to the first holding angle among the multiple audio optimization coefficients stored in the electronic device.

[0318] In some examples, the second preset angle range may be [10°, 50°]. The specific numerical value of the first preset angle range is not limited in the embodiments of the present application.

[0319] That is to say, after determining the first holding angle, that is, the angle between the electronic device and the user's face when the electronic device is in a call scenario, it can be further determined whether the first holding angle exceeds the preset angle range. When the first holding angle exceeds the preset angle range, the audio optimization coefficient can be set to an audio optimization coefficient preset in a plurality of audio optimization coefficients stored in the electronic device. Thus, when the first holding angle exceeds the preset angle range, the electronic device can still optimize the filter through the audio optimization coefficient. When the first holding angle does not exceed the preset angle range, the audio optimization coefficient can be set to an audio optimization coefficient corresponding to the first holding angle in a plurality of audio optimization coefficients stored in the electronic device. Thus, when the first holding angle does not exceed the preset angle range, the electronic device can optimize the filter through the audio optimization coefficient corresponding to the first holding angle.

[0320] It should be noted that the second preset angle range may be the same as the angle range corresponding to the multiple audio optimization coefficients stored in the electronic device.

[0321] The second preset angle range may be the same as the first preset angle range, or may be different from the first preset angle range. For example, the second preset angle range may be smaller than the first preset angle range.

[0322] Specifically, the specific implementation method of determining the target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device based on the first holding angle in the embodiment of the present application can refer to the specific implementation methods in S710-S714 above, which will not be repeated in the embodiment of the present application.

[0323] S1103. Optimize a first filter corresponding to the first sound-emitting device and a second filter corresponding to the second sound-emitting device according to a target audio optimization coefficient to obtain first audio data and second audio data.

[0324] The target audio optimization coefficient may include a first optimization coefficient and a second optimization coefficient.

[0325] In some examples, the above-mentioned optimizing the first filter corresponding to the first sound device and the second filter corresponding to the second sound device according to the target audio optimization coefficient to obtain the first audio data and the second audio data may include: optimizing the first filter according to the first optimization coefficient, and filtering the third audio data through the optimized first filter to obtain the first audio data; optimizing the second filter according to the second optimization coefficient, and filtering the fourth audio data through the optimized second filter to obtain the second audio data.

[0326] That is to say, when the electronic device outputs filtered audio data through the sound-emitting device, the filter corresponding to the sound-emitting device is optimized through the audio optimization coefficient, and the filter filters the audio data to obtain the 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.

[0327] Specifically, in the embodiment of the present application, the first filter corresponding to the first sound device and the second filter corresponding to the second sound device are optimized according to the target audio optimization coefficient to obtain the specific implementation method of the first audio data and the second audio data. Please refer to the specific implementation method in S715-S716 above, which will not be repeated in the embodiment of the present application.

[0328] S1104. Output first audio data through a first sound-emitting device, and output second audio data through a second sound-emitting device.

[0329] In the solution of the present application, the electronic device can use at least two sound-emitting devices to respectively output the first audio data and the second audio data, thereby achieving the effect of sound field playback. And when the electronic device is making a call, the electronic device can select the target audio optimization coefficient corresponding to the current holding angle from the audio optimization coefficients corresponding to at least two sound-emitting devices at different holding angles according to the current holding angle (i.e., the first holding angle). Afterwards, the filters corresponding to at least two sound-emitting devices can be optimized respectively by the target audio optimization coefficient, so that when the user uses the electronic device to make a call, the optimized filters can respectively reduce the sound energy corresponding to the first audio data corresponding to the first sound-emitting device and the second audio data corresponding to the second sound-emitting device in the sound leakage area, thereby avoiding the problem of sound leakage in the earpiece, preventing the leakage of user privacy, and improving the privacy security of the user.

[0330] In addition, the scheme of the present application selects the coefficient of the filter corresponding to the current holding angle from the coefficients of the filters corresponding to at least two sound-emitting devices at different holding angles according to the current holding angle. Therefore, the scheme of the present application can ensure the sound leakage prevention effect of the electronic device and the user's hearing experience when the user uses the electronic device to make calls at different holding angles.

[0331] Corresponding to the method in the aforementioned embodiment, the embodiment of the present application also 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 through hardware. The hardware or software includes one or more modules corresponding to the above functions.

[0332] For example, Fig.12 A schematic diagram of the structure of an audio processing device 12 is shown. Fig.12 As shown, the audio processing device 12 may include: a determination module 1201, an optimization module 1202, an output module 1203, etc.

[0333] Among them, the determination module 1201 can be used to determine a first holding angle of the electronic device when the electronic device is in a call scenario, and the first holding angle is the angle between the electronic device and the user's face.

[0334] Determination module 1201 can also be used to determine a target audio optimization coefficient from multiple audio optimization coefficients stored in the electronic device based on the first holding angle; the multiple audio optimization coefficients include audio optimization coefficients corresponding to the electronic device at multiple different holding angles, and the audio optimization coefficients are used to reduce the sound energy corresponding to the first audio data corresponding to the first sound device and the second audio data corresponding to the second sound device in the sound leakage area.

[0335] The optimization module 1202 can be used to optimize the first filter corresponding to the first sound device and the second filter corresponding to the second sound device according to the target audio optimization coefficient to obtain the first audio data and the second audio data.

[0336] The output module 1203 may be configured to output first audio data through a first sound-emitting device, and output second audio data through a second sound-emitting device.

[0337] In another possible implementation, the audio processing device 12 may further include an acquisition module 1204 .

[0338] The acquisition module 1204 may be used to acquire angle information corresponding to the electronic device at multiple moments.

[0339] The determination module 1201 may also be configured to determine the second holding angles corresponding to the electronic device at multiple moments based on the angle information corresponding to the multiple moments.

[0340] The determination module 1201 may also be configured to determine the first holding angle based on second holding angles corresponding to a plurality of moments.

[0341] In another possible implementation manner, the audio processing device 12 may further include an updating module 1205 .

[0342] The updating module 1205 may be configured to update the third holding angle to the first preset angle when the plurality of second holding angles include the third holding angle.

[0343] The determination module 1201 may also be used to determine the first holding angle based on the first preset angle and the fourth holding angle; the third holding angle is outside the first preset angle range, and the fourth holding angle is within the first preset angle range.

[0344] The determination module 1201 may also be configured to determine the first holding angle based on the multiple second holding angles when the multiple second holding angles do not include the third holding angle.

[0345] In another possible implementation, the determination module 1201 may also be configured to determine the first angle average value based on the first preset angle and the fourth holding angle.

[0346] The determination module 1201 may also be configured to determine a first holding angle based on the first angle average value.

[0347] The determination module 1201 may also be configured to determine a second angle average value based on multiple second holding angles.

[0348] The determination module 1201 may also be configured to determine a first holding angle based on the second angle average value.

[0349] In another possible implementation, the determination module 1201 may also be configured to determine the first holding angle according to the second holding angles corresponding to a plurality of moments when the number of the plurality of second holding angles is greater than or equal to a preset threshold.

[0350] In another possible implementation, determination module 1201 can also be used to determine that the target audio optimization coefficient is a first preset audio optimization coefficient when the number of multiple second holding angles is less than a preset threshold, and the first preset audio optimization coefficient is an audio optimization coefficient corresponding to the first preset holding angle among multiple audio optimization coefficients stored in the electronic device.

[0351] In another possible implementation, determination module 1201 can also be used to determine that the target audio optimization coefficient is a second preset audio optimization coefficient when the first holding angle is outside the second preset angle range, and the second preset audio optimization coefficient is an audio optimization coefficient corresponding to the second preset holding angle among multiple audio optimization coefficients stored in the electronic device.

[0352] The determination module 1201 may also be used to determine, when the first holding angle is within a second preset angle range, that the target audio optimization coefficient is an audio optimization coefficient corresponding to the first holding angle among a plurality of audio optimization coefficients stored in the electronic device.

[0353] In another possible implementation, the optimization module 1202 may also be configured to optimize the first filter according to the first optimization coefficient, and filter the third audio data by using the optimized first filter to obtain the first audio data.

[0354] The optimization module 1202 may also be configured to optimize the second filter according to the second optimization coefficient, and filter the fourth audio data by using the optimized second filter to obtain the second audio data.

[0355] It should be understood that the division of units or modules (hereinafter referred to as units) in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; or all in the form of hardware; or some units can be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware.

[0356] For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in a memory in the form of a program, and called and executed by a certain processing element of the device. 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 unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software called by a processing element.

[0357] In one example, the unit 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.

[0358] 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 a program. For another example, these units can be integrated together and implemented in the form of a system on a chip SOC.

[0359] In one implementation, the units of the above apparatus implementing the corresponding steps in the above method can be implemented in the form of a processing element scheduling program. For example, the apparatus may include a processing element and a storage element, and the processing element calls the program stored in the storage element to execute the method described in the above method embodiment. The storage element may be a storage element on the same chip as the processing element, that is, an on-chip storage element.

[0360] In another implementation, the program for executing the above method may be in a storage element on a different chip from the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element to the on-chip storage element to call and execute the method described in the above method embodiment.

[0361] For example, an embodiment of the present application may also provide a device, 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 above instructions, the electronic device implements the audio processing method described in the above embodiment. The memory may be located inside the electronic device or outside the electronic device. And the processor includes one or more.

[0362] In another implementation, the unit of the device implementing each step in the above method may be configured as one or more processing elements, which may be arranged on the corresponding electronic device, and the processing element here may be an integrated circuit, for example: one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of these integrated circuits. These integrated circuits may be integrated together to form a chip.

[0363] For example, the present application also provides a chip, which can be applied to the above electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a line; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuit to implement the method described in the above method embodiment.

[0364] An embodiment of the present application also provides a computer program product, including computer instructions executed by the above-mentioned electronic device.

[0365] 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.

[0366] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0367] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0368] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0369] 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, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0370] For example, the present application embodiment may also provide a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by an electronic device, the electronic device implements the audio processing method described in the above method embodiment.

[0371] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An audio processing method, It is 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: When the electronic device is in a call scenario, determining a first holding angle of the electronic device, where the first holding angle is an angle between the electronic device and a user's face; Based on the first holding angle, determining a target audio optimization coefficient from a plurality of audio optimization coefficients stored in the electronic device; the plurality of audio optimization coefficients include audio optimization coefficients corresponding to the electronic device at a plurality of different holding angles, the audio optimization coefficients being used to reduce the acoustic energy corresponding to the first audio data corresponding to the first sound emitting device and the second audio data corresponding to the second sound emitting device in the sound leakage area; Optimizing a first filter corresponding to the first sound-emitting device and a second filter corresponding to the second sound-emitting device according to the target audio optimization coefficient to obtain the first audio data and the second audio data; 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.

2. The method according to claim 1, It is characterized in that The determining a first holding angle of the electronic device includes: Acquire angle information corresponding to the electronic device at multiple times; Determining second holding angles corresponding to the electronic device at the multiple moments based on the angle information corresponding to the multiple moments; The first holding angle is determined based on the second holding angles respectively corresponding to the multiple moments.

3. The method according to claim 2, It is characterized in that The determining the first holding angle based on the second holding angles respectively corresponding to the multiple moments includes: In the case where the plurality of second holding angles include a third holding angle, the third holding angle is updated to a first preset angle, and the first holding angle is determined based on the first preset angle and a fourth holding angle; the third holding angle is outside the first preset angle range, and the fourth holding angle is within the first preset angle range; In a case where the plurality of second holding angles do not include the third holding angle, the first holding angle is determined based on the plurality of second holding angles.

4. The method according to claim 3, It is characterized in that The determining the first holding angle based on the first preset angle and the fourth holding angle includes: Determining a first angle average value based on the first preset angle and the fourth holding angle; determining the first holding angle based on the first angle average value; The determining the first holding angle based on the plurality of the second holding angles includes: Determine a second angle average value based on the plurality of second holding angles; The first holding angle is determined based on the second angle average value.

5. The method according to any one of claims 2 to 4, It is characterized in that The determining the first holding angle based on the second holding angles respectively corresponding to the multiple moments includes: When the number of the plurality of second holding angles is greater than or equal to a preset threshold, the first holding angle is determined according to the second holding angles respectively corresponding to the plurality of moments.

6. The method according to claim 5, It is characterized in that The method further comprises: When the number of the plurality of second holding angles is less than a preset threshold, the target audio optimization coefficient is determined to be a first preset audio optimization coefficient, and the first preset audio optimization coefficient is an audio optimization coefficient corresponding to a first preset holding angle among the plurality of audio optimization coefficients stored in the electronic device.

7. The method according to any one of claims 1 to 6, It is characterized in that The determining, based on the first holding angle, a target audio optimization coefficient from a plurality of audio optimization coefficients stored in the electronic device includes: When the first holding angle is outside the second preset angle range, determining that the target audio optimization coefficient is a second preset audio optimization coefficient, where the second preset audio optimization coefficient is an audio optimization coefficient corresponding to the second preset holding angle among a plurality of audio optimization coefficients stored in the electronic device; When the first holding angle is within the second preset angle range, the target audio optimization coefficient is determined to be an audio optimization coefficient corresponding to the first holding angle among a plurality of audio optimization coefficients stored in the electronic device.

8. The method according to any one of claims 1 to 7, It is characterized in that The target audio optimization coefficient includes a first optimization coefficient and a second optimization coefficient, and optimizing a first filter corresponding to the first sound device and a second filter corresponding to the second sound device according to the target audio optimization coefficient to obtain the first audio data and the second audio data includes: optimizing the first filter according to the first optimization coefficient, and filtering the third audio data by using the optimized first filter to obtain the first audio data; The second filter is optimized according to the second optimization coefficient, and the fourth audio data is filtered by the optimized second filter to obtain the second audio data.

9. An electronic device, It is 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 according to any one of claims 1 to 8.

10. A computer-readable storage medium having computer program instructions stored thereon; It is 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 8.