Method for adjusting gain of power amplifier and electronic equipment

By using gravity sensors in electronic devices to monitor the angle and adjust the power amplifier gain, the center offset of the sound field caused by changes in equipment status is solved, and volume balance and user experience improvement is achieved.

CN119450306AActive Publication Date: 2025-02-14HONOR DEVICE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310969916.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14
Estimated Expiration
2043-08-01

AI Technical Summary

Technical Problem

When the horizontal and vertical screen states of electronic devices change, the center of the sound field of the speaker will be offset, causing the volume of the sound heard by the user's left and right ears to be unbalanced, affecting the user's experience.

Method used

The angle of the electronic device is obtained by a gravity sensor. If the device changes between the horizontal and vertical screen states, adjust the gain of the power amplifier (PA) to adjust the volume of the speakers so that the center of the sound field is realigned to the vertical center of the device.

Benefits of technology

It realizes that the volume of sound heard by the user on the left and right ears remains consistent when the electronic device rotates, improving the user experience and preventing burst sounds caused by sudden changes in the speaker volume.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119450306A_ABST
    Figure CN119450306A_ABST
Patent Text Reader

Abstract

The invention discloses a method for adjusting the gain of a power amplifier and electronic equipment, relates to the field of electronic equipment, and is used for adjusting the gain of a power amplifier (PA) of a loudspeaker when the electronic equipment changes between a horizontal screen state and a vertical screen state. The method for adjusting the gain of the power amplifier is applied to the electronic equipment, the electronic equipment comprises a gravity sensor, a plurality of power amplifiers (PA) and a plurality of loudspeakers, the plurality of PAs are used for driving the plurality of loudspeakers, and the plurality of loudspeakers are asymmetrically distributed in the electronic equipment; the method comprises the following steps: acquiring an angle of the electronic equipment through a gravity sensor; if the angle of the electronic device indicates that the electronic device changes between the horizontal screen state and the vertical screen state, the gain of the target PA is changed, the gain of the target PA is used for adjusting the volume of a loudspeaker driven by the target PA, and the target PA refers to at least one PA in the multiple PAs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic equipment, and in particular to a method for adjusting the gain of a power amplifier and an electronic equipment. Background Art

[0002] Electronic devices such as tablets usually include multiple power amplifiers (PA) and multiple speakers, and each PA is used to amplify the power of the audio signal played by one or more speakers. If the speaker positions are asymmetrical, when playing sound, the center of the sound field will shift to the side with more speakers or the side where the speakers are closer to the ears. In particular, when the electronic device changes between the horizontal screen state and the vertical screen state, the center of the sound field will also change, causing the volume of the sound heard by the left and right ears to change, affecting the user experience. Summary of the invention

[0003] The embodiments of the present application provide a method for adjusting the gain of a power amplifier and an electronic device, which are used to adjust the gain of a PA of a speaker when the electronic device changes between a horizontal screen state and a vertical screen state.

[0004] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0005] In a first aspect, a method for adjusting the gain of a power amplifier is provided, which is applied to an electronic device, wherein the electronic device includes a gravity sensor, multiple PAs and multiple speakers, wherein the multiple PAs are used to drive the multiple speakers, and the multiple speakers are asymmetrically distributed in the electronic device; the method includes: acquiring the angle of the electronic device through the gravity sensor; if the angle of the electronic device indicates that the electronic device changes between a horizontal screen state and a vertical screen state, changing the gain of a target PA, wherein the gain of the target PA is stored in a register of the target PA, and the gain of the target PA is used to adjust the volume of the speaker driven by the target PA, and the target PA refers to at least one PA among the multiple PAs.

[0006] The power amplifier gain adjustment method provided in the embodiment of the present application, when multiple speakers are asymmetrically distributed in an electronic device, obtains the angle of the electronic device through a gravity sensor. If the angle of the electronic device indicates that the electronic device changes between a horizontal screen state and a vertical screen state, the gain of at least one PA among the multiple PAs can be changed, thereby adjusting the volume of the speaker driven by the PA, so that the volume of the left and right channels is rebalanced, and the center of the sound field of the multiple speakers returns to the vertical center line of the electronic device. In this way, no matter how the electronic device is rotated, the volume of the sound heard by the user's left and right ears can remain the same, improving the user experience.

[0007] In one possible implementation, if the angle of the electronic device indicates that the electronic device changes between a landscape state and a portrait state, the gain of the target PA is changed, including: if the angle of the electronic device indicates that the electronic device changes between a landscape state and a portrait state, and the target PA is enabled, the gain of the target PA is changed.

[0008] In actual products, some PAs also include a reset port. When the PA reset port is set to valid (e.g., high level), the PA is enabled, and the gain of the PA is allowed to be changed. When the PA reset port is set to invalid (e.g., low level), the PA is disabled. At this time, no matter how the angle of the electronic device changes, the gain of the PA is not allowed to be changed.

[0009] In a possible implementation, changing the gain of the target PA includes: if the difference between the target value and the current value of the gain of the target PA is greater than a threshold, gradually changing the gain of the target PA from the current value to the target value.

[0010] This prevents the target PA-driven speaker from experiencing sudden volume changes that could cause popping sounds.

[0011] In one possible implementation, changing the gain of a target PA includes: obtaining a weight value of the PA based on a distance of at least one speaker driven by the PA from a vertical center line of the electronic device and a current value of the gain of the PA; determining at least one PA among a plurality of PAs as a target PA; changing the gain of the target PA based on the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on an opposite side to the target PA; wherein the PA being on the same side as the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on the same side of the vertical center line of the electronic device; and the PA being on the opposite side of the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on opposite sides of the vertical center line of the electronic device.

[0012] If the distance between the PA-driven speaker and the vertical center line of the electronic device is greater, the number of PA-driven speakers is greater, and the PA gain is greater, then the weight value of the PA is also greater. The physical meaning of the weight value is that when the weight values ​​of two PAs are different, the sound field center of the speakers driven by the two PAs is closer to the speaker driven by the PA with a larger weight value.

[0013] In a possible implementation, determining at least one PA among the multiple PAs as the target PA includes: determining at least one PA corresponding to speakers located on one side or both sides of a vertical midline of the electronic device as the target PA.

[0014] That is to say, the gain of the PA corresponding to the speaker on one side of the vertical center line of the electronic device can be adjusted, and the gain of the PA corresponding to the speakers on both sides of the vertical center line of the electronic device can also be adjusted, and this application does not limit it.

[0015] In one possible implementation, the gain of the target PA is changed based on the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side of the target PA, including: if the sum of the weight values ​​of all PAs on the same side as the target PA is greater than the sum of the weight values ​​of all PAs on the opposite side of the target PA, reducing the gain of the target PA.

[0016] The larger the sum of the weight values ​​of all PAs on the same side as the target PA, the closer the center of the sound field is to the speaker on that side. By reducing the gain of the target PA, the volume of the speaker driven by the target PA is lowered, thereby moving the center of the sound field away from the speaker on that side.

[0017] In one possible implementation, the gain of the target PA is changed based on the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side of the target PA, including: if the sum of the weight values ​​of all PAs on the same side as the target PA is less than the sum of the weight values ​​of all PAs on the opposite side of the target PA, then the gain of the target PA is increased.

[0018] The smaller the sum of the weight values ​​of all PAs on the same side as the target PA, the farther the center of the sound field is from the speaker on that side. By increasing the gain of the target PA, the volume of the speaker driven by the target PA is increased, so that the center of the sound field is brought closer to the speaker on that side.

[0019] In a possible implementation, if the angle of the electronic device is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the electronic device is in a portrait state; if the angle of the electronic device is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the electronic device is in a portrait state, and Δ is a value less than or equal to 45 degrees and greater than 0 degrees.

[0020] When a user actually uses an electronic device, the angle of the electronic device is not exactly equal to 0 degrees, 180 degrees, 90 degrees, 270 degrees, etc., but is within a certain angle range. Therefore, it can be determined that the electronic device is in a horizontal or vertical state by the angle of the electronic device being within a certain angle range.

[0021] In a second aspect, an electronic device is provided, including an application processor, a memory, a gravity sensor, multiple PAs and multiple speakers, wherein the application processor is used to obtain the angle of the electronic device through the gravity sensor, and control the multiple PAs to drive the multiple speakers, wherein the multiple speakers are asymmetrically distributed in the electronic device, and the memory stores instructions, and when the processor executes the instructions, the electronic device executes the method described in the first aspect and any one of its embodiments.

[0022] According to a third aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to the first aspect and any embodiment thereof.

[0023] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed on the electronic device, the electronic device executes the method as described in the first aspect and any embodiment thereof.

[0024] In a fifth aspect, a chip system is provided, the chip system including a processor for supporting an electronic device to implement the functions involved in the first aspect. In one possible design, the device also includes an interface circuit, which can be used to receive signals from other devices (such as a memory) or send signals to other devices (such as a communication interface). The chip system may include a chip and may also include other discrete devices.

[0025] The technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0027] Figure 2 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application;

[0028] Figure 3 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0029] Figure 4 A schematic diagram of a flow chart of a method for adjusting the gain of a power amplifier provided in an embodiment of the present application;

[0030] Figure 5 A schematic diagram of directions corresponding to angles of 0 degrees, 90 degrees, 180 degrees, and 270 degrees for an electronic device provided in an embodiment of the present application;

[0031] Figure 6 A schematic diagram of calculating a weight value of a PA provided in an embodiment of the present application;

[0032] Figure 7 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] First, some concepts involved in this application are described.

[0034] The terms "first", "second", etc. involved in the embodiments of the present application are only used to distinguish features of the same type and cannot be understood as indicating relative importance, quantity, order, etc.

[0035] The terms "exemplary" or "for example" and the like in the embodiments of the present application are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the related concepts in a specific way.

[0036] The terms "coupling" and "connection" involved in the embodiments of the present application should be understood in a broad sense. For example, they may refer to a direct physical connection, or an indirect connection achieved through electronic devices, such as a connection achieved through resistors, inductors, capacitors or other electronic devices.

[0037] As mentioned above, electronic devices such as tablets usually include multiple PAs (e.g. Figure 1 The first PA 101, the second PA 102, the third PA 103, the fourth PA 104) and a plurality of speakers (eg Figure 1 The first speaker 105, the second speaker 106, the third speaker 107, the fourth speaker 108, the fifth speaker 109, and the sixth speaker 110 are shown.

[0038] Each PA is used to amplify the power of the audio signal played by one or more speakers, which is referred to as driving one or more speakers. For example, the first PA 101 is used to drive the first speaker 105, the second PA 102 is used to drive the second speaker 106, the third PA 103 is used to drive the third speaker 107 and the fourth speaker 108, and the fourth PA 104 is used to drive the fifth speaker 109 and the sixth speaker 110.

[0039] The register of the PA stores the gain of the PA, and the gain of the PA is used to adjust the volume of the speaker driven by the PA. The larger the gain stored in the register of the PA, the larger the volume of the speaker driven by the PA. For example, the gain of the first PA 101 is used to adjust the volume of the first speaker 105. The gain of the second PA 102 is used to adjust the volume of the second speaker 106. The gain of the third PA 103 is used to adjust the volume of the third speaker 107 and the fourth speaker 108; the gain of the fourth PA 104 is used to adjust the volume of the fifth speaker 109 and the sixth speaker 110.

[0040] from Figure 1 It can be seen that the multiple speakers are asymmetrically distributed in the electronic device. In this application, the multiple speakers are asymmetrically distributed in the electronic device, which means that when the electronic device is in a horizontal or vertical state, the multiple speakers are asymmetrically distributed in the electronic device. For example, Figure 1 As shown in the figure, when the electronic device is in landscape mode, the multiple speakers are symmetrically distributed in the electronic device. However, when the electronic device is in portrait mode, the multiple speakers are asymmetrically distributed in the electronic device. Assuming that the gain of each PA is the same, the center of the sound field will deviate from the vertical center line of the electronic device and be closer to the side with more speakers or the side where the speakers are closer to the ears ( Figure 1 When playing sound, the volume of the sound heard by the user's left and right ears will be different, and the volume of the sound heard by the right ear is greater than the volume of the sound heard by the left ear. In particular, when the electronic device changes between the horizontal screen state and the vertical screen state, the center of the sound field will also change, causing the volume of the sound heard by the user's left and right ears to change, affecting the user experience.

[0041] To this end, the power amplifier gain adjustment method and electronic device provided in the embodiment of the present application, if multiple speakers are asymmetrically distributed in the electronic device, the angle of the electronic device is obtained through a gravity sensor, and when the angle of the electronic device indicates that the electronic device changes between the horizontal screen state and the vertical screen state, the gain of at least one PA among the multiple PAs is changed to adjust the volume of the speaker driven by the PA, so that the volume of the left and right channels is balanced, and the center of the sound field returns to the vertical center line of the electronic device, so that the volume of the sound heard by the left and right ears of the user remains the same. For example, when the electronic device completes the rotation, if the number of speakers on the right side of the electronic device is large or it is far away from the vertical center line, the gain of the PA driving the right speaker can be reduced, or the gain of the PA driving the left speaker can be increased.

[0042] The electronic device provided in the embodiments of the present application may be a handheld device with a speaker, a vehicle-mounted device, etc., such as a mobile phone, a tablet, a smart speaker, a laptop computer, a PDA, a mobile internet device (MID), a virtual reality (VR) device, an augmented reality (AR) device, a wireless device in industrial control, a wireless device in self-driving, a wireless device in remote medical surgery, a wireless device in a smart grid, a wireless device in transportation safety, a wireless device in a smart city, a wireless device in a smart home, a cellular phone, a handheld device with a wireless communication function, a personal computer (PC), a computing device or other processing device connected to a wireless modem, a wearable device, a terminal device in a fifth generation (5G) communication network or a terminal device in a future evolved public land mobile communication network (PLMN), etc. The embodiments of the present application are not limited to this.

[0043] like Figure 2 As shown, the electronic device 10 provided in the embodiment of the present application has Figure 1 The basis shown also includes an application processor (AP) 201, an audio digital signal processor (ADSP) 202, a memory 203, an encoder 204, and a gravity sensor (G-sensor) 205. Among them, the AP 201 and the ADSP 202 can be integrated in a system on chip (SOC), and optionally, the encoder 204 can also be integrated in the SOC.

[0044] The memory 203 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. Many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM). The memory 203 may store computer program instructions for execution by the AP 201 and the ADSP 202 .

[0045] AP 201 may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a central processor unit (CPU), a network processor (NP), a microcontroller unit (MCU), a programmable logic device (PLD) or other chips. AP 201 may execute computer program instructions stored in memory 203 to execute the method for adjusting the gain of a power amplifier involved in the embodiment of the present application. For example, AP 201 may obtain the angle of the electronic device through gravity sensor 205, thereby determining whether the electronic device is in a horizontal screen state or a vertical screen state. AP 201 may also set audio parameters such as single and dual channel parameters, sound effect parameters (such as subwoofer, surround sound), mixing parameters, and set the gains of multiple PAs according to the angle of the electronic device, and send the audio parameters, the gains of multiple PAs, and the audio data to be played to ADSP 202. For the gain of PA, refer to the above description, which will not be repeated here.

[0046] ADSP 202 is used to process the audio data from AP 201 in real time according to audio parameters, such as mixing (mixing multiple sounds), adding sound effects, converting single and double channels, etc. and sends the processed audio data (in digital form) and the gains of multiple PAs to encoder 204.

[0047] The encoder 204 is used to perform digital-to-analog conversion on the audio data from the ADSP 202 to obtain an analog audio signal, and send it to multiple PAs, and send the gains of multiple PAs to multiple PAs to configure the gains of the PAs.

[0048] like Figure 3 As shown, AP 201 runs based on Taking the software architecture of AP 201 as an example, the software architecture of AP 201 may include a driver layer, a kernel layer, a hardware abstraction layer (HAL), a framework layer, and an application layer.

[0049] The application layer may include various user-oriented applications (applications, APPs). Exemplarily, the application layer may include an audio playback APP, such as a music player, a video APP, etc. The audio playback APP may send audio data to the framework layer.

[0050] The framework layer is used to provide application programming interfaces (APIs) and system resource services to applications in the application layer. The framework layer includes sensor services (SensorManager) and audio services. The sensor service in the framework layer can obtain the data of the gravity sensor (i.e., the angle of the electronic device) through the sensor HAL in the HAL and the sensor driver in the kernel layer, and send the angle of the electronic device to the audio service by communicating with the audio service. The audio service (audio server) in the framework layer can run channel processing and sound effect algorithms, for example, it can set audio parameters such as single and double channel parameters, sound effect parameters, and mixing parameters, and send audio parameters and audio data to the audio HAL in the HAL. The audio service (audio server) can also register to monitor the data change events of the gravity sensor through the SensorManager.registerListener interface. When the data of the gravity sensor changes (i.e., the electronic device rotates), the audio service (audio server) can obtain the data of the gravity sensor (i.e., the angle of the electronic device) and send the data of the gravity sensor (i.e., the angle of the electronic device) to the audio HAL in the HAL through the setParameters interface.

[0051] HAL is used to provide a virtual hardware platform to abstract the hardware. HAL hides the details of the hardware interface, making the code hardware-independent and portable on multiple platforms. For example, HAL includes audio HAL and sensor HAL. Sensor HAL is used to send data from the gravity sensor to the framework layer. Audio HAL is used to decode the audio data encoded by pulse code modulation (PCM) to obtain the original audio data, output the audio parameters and the decoded audio data to ADSP 202 through the kernel layer, and ADSP 202 processes the audio data in real time according to the audio parameters. The audio data encoded by PCM can be encoded in the moving picture experts group audio layer III (MP3), free lossless audio codec (FLAC) and other encoding formats, which can reduce the storage space occupied by audio data. Every time the audio HAL receives the data (i.e., the angle of the electronic device) from the gravity sensor of the framework layer, it can be sent to the kernel layer through the mixer_ctl control. Alternatively, the audio HAL can save the gravity sensor data from the framework layer, and the newly received gravity sensor data will overwrite the previously received gravity sensor data. In response to the user controlling the audio playback APP to play audio data, the audio HAL sends the gravity sensor data to the kernel layer when sending audio parameters and audio data to the kernel layer through the mixer_ctl control.

[0052] The kernel layer includes an operating system (OS) kernel and hardware drivers (e.g., sensor drivers, audio drivers) for driving hardware resources. The operating system kernel is used to manage the system's processes, memory, file systems, and network systems. The sensor driver is used to implement communication between the AP 201 and the gravity sensor 205. The audio driver is used to implement communication between the AP 201 and the ADSP 202. The audio driver may include multiple PA drivers (e.g., a first PA driver, a second PA driver, a third PA driver, and a fourth PA driver), each PA driver being used to configure the corresponding PA, for example, the first PA driver is used to configure the first PA, the second PA driver is used to configure the second PA, the third PA driver is used to configure the third PA, and the fourth PA driver is used to configure the fourth PA.

[0053] The audio customization service in the kernel layer sends the audio parameters and audio data to ADSP 202, and ADSP 202 processes the audio data in real time according to the audio parameters, with specific reference to the description of ADSP 202. The audio customization service also sends the angle of the electronic device to at least one PA driver (i.e., the target PA driver), that is, the audio customization service in the kernel layer can send the angle of the electronic device to all or part of the PA drivers. In actual products, some PAs also include a reset port. When the reset port of the PA is set to valid (e.g., a high level), the PA is enabled, and the gain of the PA is allowed to be changed. When the reset port of the PA is set to invalid (e.g., a low level), the PA is disabled. At this time, no matter how the angle of the electronic device changes, the gain of the PA is not allowed to be changed. Therefore, the audio customization service in the kernel layer can also determine whether the corresponding PA is enabled through each PA driver. If the PA is enabled, the audio customization service can send the angle of the electronic device to the PA driver, otherwise the angle of the electronic device is not sent to the PA driver. In this way, each PA driver can change the gain of the driven PA according to the angle of the electronic device to indicate that the electronic device changes between the horizontal screen state and the vertical screen state, and send the gain of the PA to the corresponding PA. Please refer to the relevant content of the power amplifier gain adjustment method described below for details.

[0054] like Figure 4 As shown, the method for adjusting the gain of a power amplifier provided in an embodiment of the present application includes:

[0055] S101. The sensor service in the framework layer obtains the angle of the electronic device through a gravity sensor, and sends the angle of the electronic device to the audio service by communicating with the audio service in the framework layer.

[0056] The angle of the electronic device is based on the universal serial bus (USB) interface of the electronic device. Assuming that when the USB interface of the electronic device is vertically downward, the angle of the electronic device is 0 degrees, and when the electronic device rotates counterclockwise, the angle of the electronic device increases, then the angle range of the electronic device is within [0,360]. Figure 5 The directions corresponding to the angles of the electronic device are shown as 0 degrees, 90 degrees, 180 degrees, and 270 degrees.

[0057] For information about how the sensor service in the framework layer obtains the angle of the electronic device through the gravity sensor, refer to Figure 3 The relevant description will not be repeated here.

[0058] S102: The audio service in the framework layer sends the angle of the electronic device to the kernel layer through the audio HAL in the HAL.

[0059] For information about how the audio service in the framework layer sends the angle of the electronic device to the kernel layer through the audio HAL in the HAL, refer to Figure 3 The relevant description will not be repeated here.

[0060] S103: If the angle of the electronic device indicates that the electronic device changes between the horizontal screen state and the vertical screen state, the target PA driver in the core layer changes the gain of the target PA.

[0061] like Figure 5 As shown, if the angle of the electronic device is 0 degrees and 180 degrees, the electronic device is in a portrait state, and if the angle of the electronic device is 90 degrees and 270 degrees, the electronic device is in a landscape state. It should be noted that the above angles are ideal values. In the process of users actually using electronic devices, the angles of the electronic devices will not be exactly equal to the above values, but will be within a certain angle range. Therefore, it can be determined whether the electronic device is in a landscape state or a portrait state by the angle of the electronic device being within a certain angle range. For example, if the angle of the electronic device is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the electronic device is in a portrait state; if the angle of the electronic device is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the electronic device is in a portrait state, and Δ is a value less than or equal to 45 degrees and greater than 0 degrees. If the angle of the electronic device is within other ranges, the electronic device is in a transition state between the landscape state and the portrait state. That is to say, assuming Δ is 30 degrees, if the angle of the electronic device is within [330, 30] or [150, 210], the electronic device is in portrait mode; if the angle of the electronic device is within [60, 120] or [240, 300], the electronic device is in landscape mode.

[0062] When the electronic device rotates so that the angle of the electronic device changes from the angle range corresponding to the portrait state to the angle range corresponding to the landscape state, or from the angle range corresponding to the landscape state to the angle range corresponding to the portrait state, it means that the electronic device changes between the landscape state and the portrait state. At this time, the gain of the target PA can be changed. If the speaker of the electronic device is currently playing sound, the volume of the speaker driven by the target PA will change. When the angle of the electronic device is within the angle range corresponding to the transition state between the portrait state and the landscape state, the gain of the target PA is not changed. If the speaker of the electronic device is currently playing sound, the volume of the speaker driven by the target PA will not change.

[0063] In addition, for some PAs that also include a reset port, as described above, when the reset port is set to valid (e.g., high level), the PA is enabled, and the gain of the PA is allowed to be changed. At this time, if the angle of the electronic device indicates that the electronic device changes between the horizontal screen state and the vertical screen state, and the PA is enabled, the gain of the PA (i.e., the target PA) can be changed. If the speaker of the electronic device is currently playing a sound, the volume of the speaker driven by the PA will change. When the reset port is set to invalid (e.g., low level), the PA is disabled. At this time, no matter how the angle of the electronic device changes, the gain of the PA is not allowed to be changed. If the speaker of the electronic device is currently playing a sound, the volume of the speaker driven by the PA will not change.

[0064] like Figure 3 As described in, the audio customization service in the kernel layer can send the angle of the electronic device to at least one PA driver (i.e., the target PA driver), so that the target PA driver can change the gain of at least one PA driven (i.e., the target PA) according to the angle of the electronic device. Since the PA driver and the PA are one-to-one corresponding, determining the target PA in this application can determine the corresponding target PA driver. The following describes how to determine the target PA from multiple PAs and how to change the gain of the target PA.

[0065] In a possible implementation, the audio customization service in the kernel layer can determine the target PA from multiple PAs according to preset rules, and then determine the corresponding target PA driver, send the angle of the electronic device to the target PA driver, and change the gain of the target PA by the target PA driver. The preset rules are determined by the developer through testing. The preset rules may include: when the angle of the electronic device indicates that the electronic device changes from the horizontal screen state to the vertical screen state, at least one PA among the multiple PAs is used as the first target PA, and the gain of the first target PA is changed to the first target value; when the angle of the electronic device indicates that the electronic device changes from the vertical screen state to the horizontal screen state, at least one PA among the multiple PAs is used as the second target PA, and the gain of the second target PA is changed to the second target value. The first target PA and the second target PA may be the same or different, and the first target value is different from the second target value. That is, when the electronic device changes between the horizontal screen state and the vertical screen state, which PA's gain is changed, and how much the PA's gain is changed are all determined by the preset rules.

[0066] For example, Figure 6As shown, the preset rule may include: if the angle of the electronic device indicates that the electronic device changes from the horizontal screen state to the vertical screen state, the third PA 103 and the fourth PA 104 are used as target PAs, the third PA driver and the fourth PA driver are used as target PA drivers, and the gains of the third PA 103 and the fourth PA 104 are changed to the first target value. Then, the audio customization service in the kernel layer may send the angle of the electronic device to the third PA driver and the fourth PA driver, and the third PA driver changes the gain of the third PA 103 to the first target value, and the fourth PA driver changes the gain of the fourth PA 104 to the first target value.

[0067] Similarly, the preset rules may also include: if the angle of the electronic device indicates that the electronic device changes from the portrait state to the landscape state, the first PA 101 and the second PA 102 are used as target PAs, and the gains of the first PA 101 and the second PA 102 are changed to the second target value. Then, the audio customization service in the kernel layer may send the angle of the electronic device to the first PA driver and the second PA driver, and the first PA driver changes the gain of the first PA 101 to the second target value, and the second PA driver changes the gain of the second PA 102 to the second target value.

[0068] In another possible implementation, the audio customization service in the kernel layer can autonomously determine the target PA from multiple PAs. For example, the audio customization service can randomly determine the target PA from multiple PAs, or the audio customization service can determine the target PA from multiple PAs based on the weight value of the PA and the current value of the gain of the PA, and then determine the corresponding target PA driver, and send the angle of the electronic device to the target PA driver, which changes the gain of the target PA.

[0069] First, the audio customization service can obtain the weight value of the PA according to the distance between at least one speaker driven by each PA and the vertical center line of the electronic device and the current value of the gain of the PA. The weight value W of the PA can be expressed as A*∑H i , where A represents the current value of the PA gain, H i Indicates the distance between a speaker driven by the PA and the vertical center line of the electronic device. When the PA drives multiple speakers, ∑H iThe sum of the distances of the multiple speakers driven by the PA from the vertical center line of the electronic device can be obtained. If the distance of the speakers driven by the PA from the vertical center line of the electronic device is greater, the number of speakers driven by the PA is greater, and the gain of the PA is greater, then the weight value of the PA is also greater. The physical meaning of the weight value is that when the weight values ​​of two PAs are different, the center of the sound field of the speakers driven by the two PAs is closer to the speaker driven by the PA with a larger weight value. In addition, for the sake of simplicity, the current value of the gain of all PAs is set to A by default in this application.

[0070] For example, Figure 6 As shown, after the electronic device changes from the landscape state to the portrait state, the weight value of the second PA 102 is A*H1, where H1 is the distance between the second speaker 106 driven by the second PA 102 and the vertical center line of the electronic device. The weight value of the fourth PA 104 is A*(H2+H3), where H2 is the distance between the fifth speaker 109 driven by the fourth PA 104 and the vertical center line of the electronic device, and H3 is the distance between the sixth speaker 110 driven by the fourth PA 104 and the vertical center line of the electronic device. It can be seen that the weight value of the fourth PA 104 is greater than the weight value of the second PA 102, so the sound field center of the speakers driven by these two PAs is closer to the speaker driven by the fourth PA 104. Similarly, the weight value of the third PA 103 is the same as the weight value of the fourth PA 104, and the weight value of the first PA 101 is the same as the weight value of the second PA 102. Therefore, the weight value of the third PA 103 is greater than the weight value of the first PA 101, and the sound field center of the speakers driven by these two PAs is closer to the speaker driven by the third PA 103. Therefore, overall, the sound field center of all speakers is closer to the speakers driven by the third PA 103 and the fourth PA 104, so that the sound field center of all speakers is biased to the right as a whole.

[0071] Then, the audio customization service determines at least one PA among the multiple PAs as the target PA. For example, the audio customization service determines at least one PA corresponding to a speaker located on one side or both sides of the vertical center line of the electronic device as the target PA. In other words, the gain of the PA corresponding to the speaker on one side of the vertical center line of the electronic device can be adjusted, and the gain of the PA corresponding to the speakers on both sides of the vertical center line of the electronic device can also be adjusted, which is not limited in this application.

[0072] For example, Figure 6As shown, at least one PA corresponding to the speaker on the right side of the vertical center line of the electronic device (e.g., at least one of the third PA 103 and the fourth PA 104) can be selected as the target PA. Alternatively, at least one PA corresponding to the speaker on the left side of the vertical center line of the electronic device (e.g., at least one of the first PA 101 and the second PA 102) can be selected as the target PA. Alternatively, at least one PA corresponding to the speakers on both sides of the vertical center line of the electronic device (e.g., the first PA 101 and the fourth PA 104) can be selected as the target PA.

[0073] Then, the target PA driver changes the gain of the target PA according to the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side of the target PA. The PA on the same side as the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on the same side of the vertical midline of the electronic device; the PA on the opposite side of the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on the opposite side of the vertical midline of the electronic device.

[0074] If the sum of the weight values ​​of all PAs on the same side as the target PA is greater than the sum of the weight values ​​of all PAs on the opposite side of the target PA, the gain of the target PA is reduced. As mentioned above, the larger the sum of the weight values ​​of all PAs on the same side as the target PA, the closer the center of the sound field is to the speaker on that side. By reducing the gain of the target PA, the volume of the speaker driven by the target PA is reduced, thereby moving the center of the sound field away from the speaker on that side. Figure 6 For example, as described above, after the electronic device changes from the landscape state to the portrait state, the sum of the weight values ​​of the third PA 103 and the fourth PA 104 is greater than the sum of the weight values ​​of the first PA 101 and the second PA 102, so the gain of the third PA 103 and / or the fourth PA 104 can be reduced, so that the center of the sound field of all speakers is no longer biased to the right.

[0075] If the sum of the weight values ​​of all PAs on the same side as the target PA is less than the sum of the weight values ​​of all PAs on the opposite side of the target PA, the gain of the target PA is increased. The smaller the sum of the weight values ​​of all PAs on the same side as the target PA, the farther the center of the sound field is from the speaker on that side. By increasing the gain of the target PA, the volume of the speaker driven by the target PA is increased, so that the center of the sound field is closer to the speaker on that side. Figure 6 For example, as mentioned above, after the electronic device changes from the landscape state to the portrait state, the sum of the weight values ​​of the third PA 103 and the fourth PA 104 is greater than the sum of the weight values ​​of the first PA 101 and the second PA 102, so the gain of the first PA 101 and / or the second PA 102 can be increased, so that the center of the sound field of all speakers is no longer biased to the right.

[0076] In addition, when there are multiple target PAs, the gain changes (difference between the target value and the current value) of each target PA may be the same or different. For example, if the weight value of the first target PA is greater than the weight value of the second target PA, the gain change of the first target PA may be greater than the gain change of the second target PA. The larger the weight value of the target PA, the greater the impact on the sound field center of multiple speakers. Increasing the gain change of this type of PA can make the adjustment of the sound field center of multiple speakers more obvious.

[0077] In addition, if the change in the gain of the target PA (the difference between the target value and the current value) is greater than the threshold, the gain of the target PA is gradually changed from the current value to the target value to prevent the volume of the speaker driven by the target PA from changing suddenly and producing a popping sound. For example, assuming that the gain of the target PA changes by 1, it means that the volume of the speaker driven by the PA changes by 1.5db, the current value of the gain of the target PA is 0xe (indicating that the volume of the speaker driven by the PA is 21db), and the target value is 0xb (indicating that the volume of the speaker driven by the PA is 16.5db). Then in the process of changing the gain of the target PA from the current value to the target value, 1 can be gradually reduced, that is, first change the gain of the target PA from 0xe to 0xd (indicating that the volume of the speaker driven by the PA is 19.5db), then change the gain of the target PA from 0xd to 0xc (indicating that the volume of the speaker driven by the PA is 18db), and finally change the gain of the target PA from 0xc to 0xb. Thereby, the volume of the speaker driven by the target PA changes slowly. Instead of directly changing the current value of 21db to the target value of 16.5db, a popping sound is produced.

[0078] The power amplifier gain adjustment method and electronic device provided in the embodiment of the present application, when multiple speakers are asymmetrically distributed in the electronic device, obtain the angle of the electronic device through a gravity sensor, and if the angle of the electronic device indicates that the electronic device changes between the horizontal screen state and the vertical screen state, the gain of at least one PA among the multiple PAs can be changed, thereby adjusting the volume of the speaker driven by the PA, so that the volume of the left and right channels is rebalanced, and the center of the sound field of the multiple speakers returns to the vertical center line of the electronic device. In this way, no matter how the electronic device is rotated, the volume of the sound heard by the user's left and right ears can still remain the same, improving the user experience.

[0079] like Figure 7 As shown, the embodiment of the present application also provides a chip system. The chip system 70 includes at least one processor 701 and at least one interface circuit 702. The at least one processor 701 and the at least one interface circuit 702 can be interconnected through a line. The processor 701 is used to support the electronic device to implement each step in the above method embodiment, such as Figure 4In the method shown, at least one interface circuit 702 may be used to receive signals from other devices (eg, memory) or to send signals to other devices (eg, communication interface). The chip system may include a chip and may also include other discrete devices.

[0080] The present application also provides a computer-readable storage medium, which includes instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 4 The method shown.

[0081] The present application also provides a computer program product including instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 4 The method shown.

[0082] Regarding the technical effects of the chip system, computer-readable storage medium, and computer program product, refer to the technical effects of the previous method embodiments.

[0083] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0084] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0085] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0086] In the several embodiments provided in the present application, it should be understood that the disclosed systems, 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 is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 modules, which can be electrical, mechanical or other forms.

[0087] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one device or distributed on multiple devices. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0088] In addition, each functional module in each embodiment of the present application may be integrated into one device, or each module may exist physically separately, or two or more modules may be integrated into one device.

[0089] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or may contain one or more servers, data centers and other data storage devices that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0090] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which 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. A method for adjusting the gain of a power amplifier, characterized in that: Applied to an electronic device, the electronic device comprises a gravity sensor, a plurality of power amplifiers PA and a plurality of speakers, the plurality of PAs are used to drive the plurality of speakers, and the plurality of speakers are asymmetrically distributed in the electronic device; the method comprises: Acquiring the angle of the electronic device through the gravity sensor; If the angle of the electronic device indicates that the electronic device changes between a horizontal screen state and a vertical screen state, the gain of the target PA is changed, and the gain of the target PA is stored in a register of the target PA. The gain of the target PA is used to adjust the volume of the speaker driven by the target PA. The target PA refers to at least one PA among the multiple PAs.

2. The method according to claim 1, characterized in that If the angle of the electronic device indicates that the electronic device changes between a horizontal screen state and a vertical screen state, changing the gain of a target PA includes: If the angle of the electronic device indicates that the electronic device changes between a landscape state and a portrait state, and the target PA is enabled, the gain of the target PA is changed.

3. The method according to claim 1 or 2, characterized in that: The changing the gain of the target PA comprises: If the difference between the target value and the current value of the gain of the target PA is greater than a threshold, the gain of the target PA is gradually changed from the current value to the target value.

4. The method according to any one of claims 1 to 3, characterized in that: The changing the gain of the target PA comprises: Obtaining a weight value of the PA according to a distance between at least one speaker driven by the PA and a vertical midline of the electronic device and a current value of a gain of the PA; Determine at least one PA among the plurality of PAs as the target PA; The gain of the target PA is changed according to the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side of the target PA; wherein, the PA on the same side as the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on the same side of the vertical midline of the electronic device; and the PA on the opposite side of the target PA means that the speaker driven by the PA and the speaker driven by the target PA are located on opposite sides of the vertical midline of the electronic device.

5. The method according to claim 4, characterized in that The determining at least one PA among the plurality of PAs as the target PA comprises: At least one PA corresponding to the speakers located on one side or both sides of the vertical midline of the electronic device is determined as the target PA.

6. The method according to claim 4 or 5, characterized in that: The step of changing the gain of the target PA according to the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side to the target PA comprises: If the sum of the weight values ​​of all PAs on the same side as the target PA is greater than the sum of the weight values ​​of all PAs on the opposite side to the target PA, the gain of the target PA is reduced.

7. The method according to any one of claims 4 to 6, characterized in that: The step of changing the gain of the target PA according to the weight values ​​of all PAs on the same side as the target PA and the weight values ​​of all PAs on the opposite side to the target PA comprises: If the sum of weight values ​​of all PAs on the same side as the target PA is less than the sum of weight values ​​of all PAs on the opposite side to the target PA, the gain of the target PA is increased.

8. The method according to any one of claims 1 to 7, characterized in that: If the angle of the electronic device is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the electronic device is in a portrait state; if the angle of the electronic device is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the electronic device is in a portrait state, and Δ is a value less than or equal to 45 degrees and greater than 0 degrees.

9. An electronic device, characterized in that: It includes an application processor, a memory, a gravity sensor, multiple power amplifiers PA and multiple speakers, the application processor is used to obtain the angle of the electronic device through the gravity sensor, control the multiple PAs to drive the multiple speakers, the multiple speakers are asymmetrically distributed in the electronic device, the memory stores instructions, and when the processor executes the instructions, the electronic device executes the method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Sound effect adjustment method and mobile terminal

    CN107547987A

  • Loudspeaker module, electronic equipment and control method

    CN113766053A

  • Audio data processing method and electronic equipment

    CN114253503A

  • Audio output device and method, electronic equipment and computer readable storage medium

    CN114979933A

  • Audio playing method and electronic equipment

    CN116347320A