Method for adjusting gain of power amplifier and electronic device
By sensing the device's rotation using a gravity sensor, the power amplifier gain is adjusted to balance the speaker volume, thus solving the sound field shift problem caused by the asymmetrical position of the speakers and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-01
- Publication Date
- 2026-03-31
AI Technical Summary
When electronic devices switch between landscape and portrait modes, the asymmetrical position of the speakers causes the sound field center to shift, affecting the user experience.
By using a gravity sensor to detect changes in the angle of electronic devices, the gain of the power amplifier is adjusted to balance the volume of the left and right channels, ensuring that the center of the sound field returns to the vertical center line of the device.
Maintaining consistent volume between the left and right ears during device rotation enhances the user experience and prevents sudden changes in speaker volume from producing popping sounds.
Smart Images

Figure CN119450306B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic devices, and more particularly to a method for adjusting the gain of a power amplifier and an electronic device. Background Technology
[0002] Tablets and other electronic devices typically include multiple power amplifiers (PAs) and multiple speakers. Each PA amplifies the audio signal played from one or more speakers. If the speakers are asymmetrically positioned, the sound field center will shift to the side with more speakers or the side with speakers closer to the ears. This shift in sound field center is particularly noticeable when the device changes between landscape and portrait orientations, causing a change in the volume of sound heard by the left and right ears, thus affecting the user experience. Summary of the Invention
[0003] This application provides a method and electronic device for adjusting the gain of a power amplifier, used to adjust the gain of a speaker's PA when the electronic device changes between landscape and portrait modes.
[0004] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0005] In a first aspect, a method for adjusting the gain of a power amplifier is provided, applied to an electronic device including a gravity sensor, multiple power amplifiers (PAs), and multiple speakers, wherein the multiple PAs 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 via the gravity sensor; if the angle of the electronic device indicates a change between a landscape state and a portrait state, then changing the gain of a target PA, the gain of the target PA being stored in a register of the target PA, the gain of the target PA being used to adjust the volume of the speakers driven by the target PA, wherein the target PA refers to at least one of the multiple PAs.
[0006] The power amplifier gain adjustment method provided in this 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 a change between landscape and portrait modes, the gain of at least one of the power amplifiers (PAs) can be changed, thereby adjusting the volume of the speaker driven by that PA. This rebalances the left and right channel volumes, bringing the sound field center of the multiple speakers back to the vertical centerline of the electronic device. In this way, regardless of how the electronic device rotates, the volume of the sound heard by the user's left and right ears remains the same, improving the user experience.
[0007] In one possible implementation, if the angle of the electronic device indicates that the electronic device is changing between a landscape state and a portrait state, then changing the gain of the target PA includes: if the angle of the electronic device indicates that the electronic device is changing between a landscape state and a portrait state, and the target PA is enabled, then changing the gain of the target PA.
[0008] In actual products, some power amplifiers (PAs) also include a reset port. When the PA's reset port is enabled (e.g., high level), the PA is enabled, allowing changes to the PA's gain. When the PA's reset port is disabled (e.g., low level), the PA is deenabled, and in this case, changes to the PA's gain are not permitted regardless of the angle of the electronic device.
[0009] In one 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, then gradually changing the gain of the target PA from the current value to the target value.
[0010] This can prevent sudden changes in the volume of the speaker driven by the target PA from producing a popping sound.
[0011] In one possible implementation, changing the gain of the target PA includes: obtaining a weight value for the PA based on the distance of at least one speaker driven by the PA from the vertical centerline of the electronic device, and the current value of the PA's gain; identifying at least one PA among a plurality of PAs as the target PA; and 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 the opposite side of the target PA; wherein, 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 centerline of the electronic device; 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 centerline of the electronic device.
[0012] The greater the distance between the speaker driven by the PA and the vertical center line of the electronic device, the more speakers the PA drives, and the greater the gain of the PA, the greater the weight value of that PA. The physical meaning of the weight value is that when two PAs have different weight values, the sound field center of the speakers driven by those two PAs is closer to the speaker driven by the PA with the larger weight value.
[0013] In one possible implementation, identifying at least one PA among a plurality of PAs as a target PA includes: identifying at least one PA corresponding to a speaker located on one or both sides of the vertical centerline of the electronic device as a target PA.
[0014] 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, or the gain of the PA corresponding to the speakers on both sides of the vertical center line of the electronic device can be adjusted; this application does not limit this.
[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, then the gain of the target PA is reduced.
[0016] The greater the sum of the weights 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, thus 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: increasing the gain of the target PA 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.
[0018] The smaller the sum of the weights of all PAs on the same side as the target PA, the further 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, thereby bringing the center of the sound field closer to the speaker on that side.
[0019] In one possible implementation, if the angle of the electronic device is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the electronic device is in portrait mode; if the angle of the electronic device is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the electronic device is in portrait mode, where Δ is a value less than or equal to 45 degrees and greater than 0 degrees.
[0020] In actual use, the angle of an electronic device is not exactly 0 degrees, 180 degrees, 90 degrees, or 270 degrees, but falls within a certain range. Therefore, the orientation of the electronic device (landscape or portrait) can be determined by observing its angle within this range.
[0021] In a second aspect, an electronic device is provided, comprising an application processor, a memory, a gravity sensor, multiple power amplifiers (PAs), and multiple speakers. The application processor is used to acquire the angle of the electronic device via the gravity sensor and control the multiple PAs to drive the multiple speakers, which are asymmetrically distributed in the electronic device. Instructions are stored in the memory, and when the processor executes the instructions, the electronic device performs the method as described in the first aspect and any embodiment thereof.
[0022] Thirdly, a computer-readable storage medium is provided, including instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in the first aspect and any embodiment thereof.
[0023] Fourthly, a computer program product containing instructions is provided, which, when executed on the aforementioned electronic device, cause the electronic device to perform the method as described in the first aspect and any embodiment thereof.
[0024] Fifthly, a chip system is provided, including a processor for supporting electronic devices in implementing the functions described in the first aspect above. In one possible design, the device further includes interface circuitry for receiving signals from other devices (e.g., memory) or sending signals to other devices (e.g., 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. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0027] Figure 2 This is a schematic diagram of the structure of another electronic device provided in an embodiment of this application;
[0028] Figure 3 A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;
[0029] Figure 4 A flowchart illustrating a method for adjusting the gain of a power amplifier provided in an embodiment of this application;
[0030] Figure 5 This is a schematic diagram showing the directions corresponding to the angles of an electronic device provided in this application when the angle is 0 degrees, 90 degrees, 180 degrees, and 270 degrees, respectively.
[0031] Figure 6 A schematic diagram illustrating the calculation of the weight value of PA, provided as an embodiment of this application;
[0032] Figure 7 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0033] First, some concepts involved in this application will be described.
[0034] The terms "first" and "second" used in the embodiments of this application are only used to distinguish features of the same type and should not be construed as indicating relative importance, quantity, order, etc.
[0035] The terms "exemplary" or "for example" used in the embodiments of this application are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0036] The terms "coupling" and "connection" used in the embodiments of this application should be interpreted broadly. For example, they can refer to a physical direct 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 typically include multiple PAs (e.g., Figure 1 The first PA 101, the second PA 102, the third PA 103, and the fourth PA 104 shown) and multiple speakers (e.g. Figure 1 The speakers shown are: first speaker 105, second speaker 106, third speaker 107, fourth speaker 108, fifth speaker 109, and sixth speaker 110.
[0038] Each PA is used to amplify the audio signal played by one or more speakers, or simply to drive one or more speakers. For example, the first PA 101 drives the first speaker 105, the second PA 102 drives the second speaker 106, the third PA 103 drives the third speaker 107 and the fourth speaker 108, and the fourth PA 104 drives the fifth speaker 109 and the sixth speaker 110.
[0039] The register of a PA stores the PA's gain, which is used to adjust the volume of the speaker driven by that PA. The higher the gain stored in the PA's register, the louder the speaker driven by that 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; and 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 As can be seen, multiple speakers are asymmetrically distributed within the electronic device. In this application, asymmetrical distribution of multiple speakers within the electronic device refers to the left-right asymmetrical distribution of multiple speakers within the electronic device when it is in landscape or portrait mode. For example, as... Figure 1 As shown, while the multiple speakers are symmetrically distributed horizontally when the electronic device is in landscape mode, they become asymmetrically distributed horizontally when in portrait mode. Assuming all PAs have the same gain, this causes the sound field center to deviate from the vertical center line of the electronic device, moving closer to the side with more speakers or the side with the speakers closer to the ears. Figure 1 (The middle refers to the right side). When playing sound, the volume of the sound heard by the user's left and right ears will differ; 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 electronic devices switch between landscape and portrait modes, the sound field center also changes, causing the volume of the sound heard by the user's left and right ears to change, thus affecting the user experience.
[0041] Therefore, the power amplifier gain adjustment method and electronic device provided in this application, if multiple speakers are asymmetrically distributed in the electronic device, obtains the angle of the electronic device through a gravity sensor. When the angle of the electronic device indicates that the electronic device is changing between landscape and portrait modes, the gain of at least one of the multiple power amplifiers (PAs) is changed to adjust the volume of the speaker driven by that PA, so that the volume of the left and right channels is balanced and the sound field center returns to the vertical center line of the electronic device, thereby ensuring that the volume of the sound heard by the user's left and right ears remains the same. For example, after the electronic device has rotated, if there are more speakers on the right side of the electronic device or if the speakers are farther 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 devices provided in this application embodiment can be handheld devices with speakers, vehicle-mounted devices, etc., such as mobile phones, tablets, smart speakers, laptops, PDAs, mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, wireless devices in industrial control, wireless devices in self-driving, wireless devices in remote medical surgery, wireless devices in smart grids, wireless devices in transportation safety, wireless devices in smart cities, wireless devices in smart homes, cellular phones, handheld devices with wireless communication capabilities, personal computers (PCs), computing devices or other processing devices connected to wireless modems, wearable devices, terminal devices in 5G communication networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc., and this application embodiment is not limited to these.
[0043] like Figure 2 As shown, the electronic device 10 provided in this application embodiment, in Figure 1 The system 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. AP 201 and ADSP 202 can be integrated into a system-on-chip (SOC), and optionally, the encoder 204 can also be integrated into the SOC.
[0044] Memory 203 can be volatile memory or non-volatile memory, or may include both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which serves 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 linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). The memory 203 can store computer program instructions for execution by the AP 201 and ADSP 202.
[0045] AP 201 can be a field-programmable gate array (FPGA), application-specific integrated circuit (ASIC), central processing unit (CPU), network processor (NP), microcontroller unit (MCU), programmable logic device (PLD), or other chip. AP 201 can execute computer program instructions stored in memory 203 to perform the power amplifier gain adjustment method involved in the embodiments of this application. For example, AP 201 can obtain the angle of the electronic device through gravity sensor 205 to determine whether the electronic device is in landscape or portrait mode. AP 201 can also set audio parameters such as mono / stereo parameters, sound effect parameters (e.g., bass boost, surround sound), mixing parameters, and set the gain 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. The PA gain is described above and will not be repeated here.
[0046] ADSP 202 is used to process audio data from AP 201 in real time according to audio parameters, such as mixing (blending multiple sounds), adding sound effects, converting between mono and stereo, etc., and then sending the processed audio data (in digital form) and the gain 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, as well as to send the gain of multiple PAs to multiple PAs to configure the gain of the PAs.
[0048] like Figure 3 As shown, running AP 201 based on Taking the software architecture of AP 201 as an example, the software architecture can include driver layer, kernel layer, hardware abstraction layer (HAL), framework layer, and application layer.
[0049] The application layer can include various user-facing applications (APPs). For example, the application layer can include audio playback APPs, such as music players and video apps. The audio playback APP can send audio data to the framework layer.
[0050] The framework layer provides application programming interfaces (APIs) and system resource services to applications in the application layer. The framework layer includes a sensor service (SensorManager) and an audio service. The sensor service in the framework layer can acquire gravity sensor data (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 it. The audio service in the framework layer can run channel processing and sound effect algorithms, such as setting mono / stereo parameters, sound effect parameters, mixing parameters, etc., and sending audio parameters and audio data to the audio HAL in the HAL. The audio service can also register to listen for gravity sensor data change events through the SensorManager.registerListener interface. When the gravity sensor data changes (i.e., the electronic device rotates), the audio service can acquire the gravity sensor data (i.e., the angle of the electronic device) and send the gravity sensor data (i.e., the angle of the electronic device) to the audio HAL in the HAL through the setParameters interface.
[0051] HAL (Hardware Access Layer) provides a virtual hardware platform to abstract hardware. HAL hides hardware interface details, making the code hardware-independent and portable across multiple platforms. For example, HAL includes an audio HAL and a sensor HAL. The sensor HAL sends data from the gravity sensor to the frame layer. The audio HAL decodes the PCM-encoded audio data to obtain the raw audio data, outputting the audio parameters and decoded audio data to the ADSP 202 through the kernel layer. The ADSP 202 then processes the audio data in real time based on the audio parameters. The PCM-encoded audio data can use encoding formats such as Moving Picture Experts Group Audio Layer III (MP3) or Free Lossless Audio Codec (FLAC), which reduce the storage space occupied by the audio data. The audio HAL sends data (i.e., the angle of the electronic device) received from the gravity sensor in the frame layer to the kernel layer via the mixer_ctl control. Alternatively, the audio HAL can store data from the gravity sensor in the framework layer, with newly received gravity sensor data overwriting previously received data. In response to a user-controlled audio playback app, the audio HAL sends the gravity sensor data to the kernel layer along with the audio parameters and data via the mixer_ctl control.
[0052] The kernel layer includes the operating system (OS) kernel and hardware drivers (such as sensor drivers and audio drivers) that drive hardware resources. The OS kernel manages system processes, memory, file systems, and network systems. Sensor drivers enable communication between AP 201 and gravity sensor 205. Audio drivers enable communication between AP 201 and ADSP 202. Audio drivers can include multiple PA drivers (e.g., first PA driver, second PA driver, third PA driver, and fourth PA driver), each configuring its corresponding PA. For example, the first PA driver configures the first PA, the second PA driver configures the second PA, the third PA driver configures the third PA, and the fourth PA driver configures the fourth PA.
[0053] The audio customization service in the kernel layer sends audio parameters and audio data to the ADSP 202, which then processes the audio data in real time based on the audio parameters (see the description of the ADSP 202 for details). The audio customization service also sends the angle of the electronic device to at least one PA driver (i.e., the target PA driver). In other words, the audio customization service in the kernel layer can send the angle of the electronic device to all or some PA drivers. In actual products, some PAs also include a reset port. When the PA's reset port is enabled (e.g., high level), the PA is enabled, allowing changes to the PA's gain. When the PA's reset port is disabled (e.g., low level), the PA is deenabled, and changes to the PA's gain are not allowed regardless of changes in the electronic device's angle. Therefore, the audio customization service in the kernel layer can also determine whether a 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 that PA driver; otherwise, it will not. In this way, each PA driver can change the gain of the PA driven by the electronic device according to the angle of the electronic device, so as to change the electronic device between landscape and portrait modes. The gain of the PA is then sent to the corresponding PA. For details, please refer to the relevant content of the power amplifier gain adjustment method described below.
[0054] like Figure 4 As shown in the embodiments of this application, the method for adjusting the gain of a power amplifier includes:
[0055] S101. The sensor service in the frame layer obtains the angle of the electronic device through the gravity sensor and sends the angle of the electronic device to the audio service by communicating with the audio service in the frame layer.
[0056] The angle of an electronic device is referenced to its Universal Serial Bus (USB) interface. Assuming the USB interface is pointing vertically downwards, the angle of the electronic device is 0 degrees. As the device rotates counter-clockwise, the angle increases. Therefore, the angle range of the electronic device is within [0, 360]. Figure 5 The diagram shows the directions corresponding to the angles of the electronic device at 0 degrees, 90 degrees, 180 degrees, and 270 degrees.
[0057] Regarding how the sensor service in the framework layer obtains the angle of electronic devices through gravity sensors, refer to... Figure 3 The relevant descriptions 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] Regarding how the audio service in the framework layer sends the electronic device's perspective to the kernel layer via the audio HAL in the HAL, please refer to... Figure 3 The relevant descriptions will not be repeated here.
[0060] S103. If the angle of the electronic device indicates that the electronic device changes between landscape and portrait modes, the target PA driver in the kernel layer changes the gain of the target PA.
[0061] like Figure 5 As shown, if the angle of the electronic device is 0 degrees or 180 degrees, the device is in portrait mode; if the angle is 90 degrees or 270 degrees, the device is in landscape mode. It should be noted that these angles are ideal values. In actual use, the angle of the electronic device will not be exactly the above values, but will fall within a certain range. Therefore, the orientation of the electronic device can be determined by the angle within a certain range. For example, if the angle is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the device is in portrait mode; if the angle is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the device is in portrait mode, where Δ is a value less than or equal to 45 degrees and greater than 0 degrees. If the angle is outside this range, the device is in a transitional state between landscape and portrait modes. In other words, 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 an electronic device rotates, causing its angle to change from the angle range corresponding to portrait mode to the angle range corresponding to landscape mode, or vice versa, it indicates that the electronic device is transitioning between portrait and landscape modes. In this case, the gain of the target power amplifier (PA) can be changed. If the electronic device's speaker is currently playing sound, the volume of the speaker driven by the target PA will change. When the electronic device's angle is within the angle range corresponding to the transition state between portrait and landscape modes, the gain of the target PA remains unchanged. If the electronic device's speaker is currently playing sound, the volume of the speaker driven by the target PA will not change.
[0063] Additionally, in scenarios where some PAs also include a reset port, as mentioned earlier, when the reset port is enabled (e.g., high level), the PA is enabled, allowing its gain to be changed. In this case, if the angle of the electronic device indicates a change between landscape and portrait modes, and the PA is enabled, the gain of that PA (i.e., the target PA) can be changed. If the electronic device's speaker is currently playing sound, the volume of the speaker driven by this PA will change. When the reset port is disabled (e.g., low level), the PA is deenabled, and in this case, regardless of the angle of the electronic device, the gain of the PA cannot be changed. If the electronic device's speaker is currently playing sound, the volume of the speaker driven by this PA will not change.
[0064] like Figure 3 As described, 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), allowing the target PA driver to change the gain of at least one PA (i.e., the target PA) according to the angle of the electronic device. Since there is a one-to-one correspondence between PA drivers and PAs, determining the target PA in this application is sufficient to determine the corresponding target PA driver. The following explains how to determine the target PA from multiple PAs and how to change the gain of the target PA.
[0065] In one possible implementation, the audio customization service in the kernel layer can determine a target PA from multiple PAs according to preset rules, and then determine the corresponding target PA driver. The angle of the electronic device is sent to the target PA driver, which then changes the gain of the target PA. These preset rules are determined by developers through testing. The preset rules may include: when the angle of the electronic device indicates a change from landscape to portrait mode, at least one PA from the multiple PAs is designated as the first target PA, and its gain is changed to a first target value; when the angle of the electronic device indicates a change from portrait to landscape mode, at least one PA from the multiple PAs is designated as the second target PA, and its gain is changed to a second target value. The first and second target PAs can be the same or different, and the first and second target values can be different. In other words, which PA's gain is changed and by how much when the electronic device changes between landscape and portrait modes are determined by the preset rules.
[0066] For example, such as Figure 6As shown, the preset rules may include: if the angle of the electronic device indicates that the electronic device is changing from landscape mode to portrait mode, then the third PA 103 and the fourth PA 104 are designated as target PAs, the third PA driver and the fourth PA driver are designated as target PA drivers, and the gain 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 can send the angle of the electronic device to the third PA driver and the fourth PA driver, which will change the gain of the third PA 103 to the first target value, and the fourth PA driver will change the gain of the fourth PA 104 to the first target value.
[0067] Similarly, the preset rules could also include: if the angle of the electronic device indicates that the electronic device is changing from portrait mode to landscape mode, then the first PA 101 and the second PA 102 are designated 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 can send the angle of the electronic device to the first PA driver and the second PA driver, with the first PA driver changing the gain of the first PA 101 to the second target value, and the second PA driver changing 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 PA's weight value and the current value of the PA's gain, thereby determining the corresponding target PA driver, and sending the angle of the electronic device to the target PA driver, which then changes the gain of the target PA.
[0069] First, the audio customization service can derive the weight value of a PA based on the distance of at least one speaker driven by each PA from the vertical centerline of the electronic device, and the current gain value of that PA. The weight value W of the PA can be expressed as A*∑H i Where A represents the current value of the gain of PA, and H i This represents the distance of a speaker driven by the PA from the vertical center line of the electronic device. When the PA drives multiple speakers, it is represented by ∑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. The greater the distance of the speakers driven by the PA from the vertical center line of the electronic device, the more speakers the PA drives, the greater the PA's gain, and the greater the PA's weight value. The physical meaning of the weight value is that when two PAs have different weight values, the sound field center of the speakers driven by these two PAs is closer to the speaker driven by the PA with the larger weight value. Furthermore, for simplicity, the current gain value of all PAs in this application is assumed to be A.
[0070] For example, such as Figure 6 As shown, after the electronic device changes from landscape to portrait mode, the weight value of the second PA 102 is A*H1, where H1 is the distance of the second speaker 106 driven by the second PA 102 from 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 of the fifth speaker 109 driven by the fourth PA 104 from the vertical center line of the electronic device, and H3 is the distance of the sixth speaker 110 driven by the fourth PA 104 from the vertical center line of the electronic device. It can be seen that the weight value of the fourth PA 104 is greater than that of the second PA 102; therefore, 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 that of the fourth PA 104, and the weight value of the first PA 101 is the same as that of the second PA 102. Therefore, the weight value of the third PA 103 is greater than that 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. So overall, the sound field center of all speakers is closer to the speakers driven by the third PA 103 and the fourth PA 104, making the overall sound field center of all speakers shift to the right.
[0071] Then, the audio customization service identifies at least one PA among a plurality of PAs as the target PA. For example, the audio customization service identifies at least one PA corresponding to a speaker located on one or both sides of the vertical center line of the electronic device as the target PA. That is, the gain of the PA corresponding to the speaker on one side of the vertical center line of the electronic device can be adjusted, or the gain of the PA corresponding to the speakers on both sides of the vertical center line of the electronic device can be adjusted; this application does not limit this.
[0072] For example, such as Figure 6As shown, at least one PA (e.g., at least one of the third PA 103 and the fourth PA 104) corresponding to the speaker on the right side of the vertical center line of the electronic device can be selected as the target PA. Alternatively, at least one PA (e.g., at least one of the first PA 101 and the second PA 102) corresponding to the speaker on the left side of the vertical center line of the electronic device can be selected as the target PA. Alternatively, at least one PA (e.g., the first PA 101 and the fourth PA 104) corresponding to the speakers on both sides of the vertical center line of the electronic device can be selected as the target PA.
[0073] Then, the target PA driver changes 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 the opposite side of the target PA. Here, "PA on the same side as the target PA" means that the speaker driven by the target PA and the speaker driven by the target PA are located on the same side of the vertical center line of the electronic device; "PA on the opposite side of the target PA" means that the speaker driven by the target PA and the speaker driven by the target PA are located on opposite sides of the vertical center line of the electronic device.
[0074] If the sum of the weights of all PAs on the same side as the target PA is greater than the sum of the weights of all PAs on the opposite side of the target PA, then the gain of the target PA is reduced. As mentioned earlier, the larger the sum of the weights 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, thus moving the center of the sound field away from the speaker on that side. (Continuing with...) Figure 6 For example, as mentioned above, after the electronic device changes from landscape mode to portrait mode, 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. Therefore, the gain of the third PA 103 and / or the fourth PA 104 can be reduced so that the sound field center of all speakers is no longer shifted to the right.
[0075] If the sum of the weights of all PAs on the same side as the target PA is less than the sum of the weights of all PAs on the opposite side of the target PA, then the gain of the target PA is increased. The smaller the sum of the weights of all PAs on the same side as the target PA, the further 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, thus bringing the center of the sound field closer to the speaker on that side. (Continuing with...) Figure 6 For example, as mentioned above, after the electronic device changes from landscape mode to portrait mode, 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. Therefore, the gain of the first PA 101 and / or the second PA 102 can be increased so that the sound field center of all speakers is no longer shifted to the right.
[0076] Furthermore, when there are multiple target PAs, the change in gain (the difference between the target value and the current value) of each target PA can 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, then the change in gain of the first target PA can be greater than the change in gain of the second target PA. The larger the weight value of the target PA, the greater its influence on the sound field center of multiple speakers. Increasing the change in gain of such PAs can make the adjustment of the sound field center of multiple speakers more obvious.
[0077] Additionally, if the change in the target PA's gain (the difference between the target value and the current value) exceeds a threshold, the target PA's gain is gradually changed from the current value to the target value to prevent sudden changes in the volume of the speaker driven by the target PA, which could produce a popping sound. For example, suppose that each change of 1 in the target PA's gain represents a 1.5 dB change in the volume of the speaker driven by the PA. The current value of the target PA's gain is 0xe (meaning the volume of the speaker driven by the PA is 21 dB), and the target value is 0xb (meaning the volume of the speaker driven by the PA is 16.5 dB). Then, in the process of changing the target PA's gain from the current value to the target value, it can be gradually decreased by 1. That is, first change the target PA's gain from 0xe to 0xd (meaning the volume of the speaker driven by the PA is 19.5 dB), then change the target PA's gain from 0xd to 0xc (meaning the volume of the speaker driven by the PA is 18 dB), and finally change the target PA's gain from 0xc to 0xb. This results in a slow change in the volume of the speaker driven by the target PA. Instead of directly changing the current value of 21dB to the target value of 16.5dB to produce a popping sound.
[0078] The power amplifier gain adjustment method and electronic device provided in this application, when multiple speakers are asymmetrically distributed within the electronic device, obtain the angle of the electronic device via a gravity sensor. If the angle of the electronic device indicates a change between landscape and portrait modes, the gain of at least one of the power amplifiers (PAs) can be changed, thereby adjusting the volume of the speaker driven by that PA. This rebalances the left and right channel volumes, bringing the sound field center of the multiple speakers back to the vertical centerline of the electronic device. In this way, regardless of how the electronic device rotates, the volume of the sound heard by the user's left and right ears remains the same, improving the user experience.
[0079] like Figure 7 As shown, this 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 are interconnected via lines. The processor 701 is used to support an electronic device in implementing the various steps in the above method embodiments, for example... Figure 4The method shown allows at least one interface circuit 702 to be used to receive signals from other devices (e.g., memory) or to send signals to other devices (e.g., a communication interface). The chip system may include a chip and may also include other discrete components.
[0080] This application also provides a computer-readable storage medium including instructions that, when executed on the electronic device, cause the electronic device to perform the steps described in the method embodiments, such as executing... Figure 4 The method shown.
[0081] This application also provides a computer program product including instructions, which, when executed on the aforementioned electronic device, cause the electronic device to perform the various steps in the method embodiments described above, such as executing... Figure 4 The method shown.
[0082] The technical effects of the chip system, computer-readable storage medium, and computer program product are described in the preceding method embodiments.
[0083] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply 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 this application.
[0084] Those skilled in the art will recognize that the modules and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0085] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0086] In the several embodiments provided in this 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 merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.
[0087] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located on one device or distributed across multiple devices. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0088] In addition, the functional modules in the various embodiments of this application can be integrated into one device, or each module can exist physically separately, or two or more modules can be integrated into one device.
[0089] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks, SSDs), etc.
[0090] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of adjusting the gain of a power amplifier, characterized by, The method is applied to an electronic device, the electronic device comprising a gravity sensor, a plurality of power amplifiers (PAs) and a plurality of loudspeakers, the plurality of PAs being configured to drive the plurality of loudspeakers, the plurality of loudspeakers being asymmetrically distributed in the electronic device; the method comprising: obtaining an angle of the electronic device by the gravity sensor; if the angle of the electronic device indicates that the electronic device changes between a landscape state and a portrait state, changing a gain of a target PA, the gain of the target PA being stored in a register of the target PA, the gain of the target PA being configured to adjust a volume of a loudspeaker driven by the target PA, the target PA referring to at least one PA in the plurality of PAs; the changing of the gain of the target PA comprising: obtaining a weight value of the PA according to a distance of at least one loudspeaker driven by the PA to a vertical centerline of the electronic device and a current value of the gain of the PA; determining at least one PA in the plurality of PAs as the target PA; changing the gain of the target PA according to the weight values of all PAs on the same side of the target PA and the weight values of all PAs on the opposite side of the target PA; wherein if a sum of the weight values of all PAs on the same side of the target PA is greater than a sum of the weight values of all PAs on the opposite side of the target PA, the gain of the target PA is decreased; PAs on the same side of the target PA refer to that the loudspeakers driven by the PAs are on the same side of the vertical centerline of the electronic device as the loudspeaker driven by the target PA; PAs on the opposite side of the target PA refer to that the loudspeakers driven by the PAs are on the opposite side of the vertical centerline of the electronic device as the loudspeaker driven by the target PA.
2. The method of claim 1, wherein, the changing of the gain of the target PA if the angle of the electronic device indicates that the electronic device changes between the landscape state and the portrait state, comprising: the changing of the gain of the target PA if the angle of the electronic device indicates that the electronic device changes between the landscape state and the portrait state and the target PA is enabled.
3. The method according to claim 1 or 2, characterized in that, the changing of the gain of the target PA, comprising: if a difference between a target value and a current value of the gain of the target PA is greater than a threshold value, gradually changing the gain of the target PA from the current value to the target value.
4. The method of claim 1, wherein, the determining of the at least one PA in the plurality of PAs as the target PA, comprising: determining at least one PA corresponding to a loudspeaker on one side or both sides of the vertical centerline of the electronic device as the target PA.
5. The method according to claim 1 or 4, characterized in that, the changing of the gain of the target PA according to the weight values of all PAs on the same side of the target PA and the weight values of all PAs on the opposite side of the target PA, comprising: if a sum of the weight values of all PAs on the same side of the target PA is less than a sum of the weight values of all PAs on the opposite side of the target PA, increasing the gain of the target PA.
6. The method of claim 1 or 2, wherein, If the angle of the electronic device is within [0-Δ, 0+Δ] or [180-Δ, 180+Δ], the electronic device is in a portrait screen state; if the angle of the electronic device is within [90-Δ, 90+Δ] or [270-Δ, 270+Δ], the electronic device is in a portrait screen state, Δ is a value less than or equal to 45 degrees and greater than 0 degrees.
7. An electronic device, comprising: The electronic device comprises an application processor, a memory, a gravity sensor, a plurality of power amplifiers (PAs) and a plurality of speakers, the application processor is configured to acquire an angle of the electronic device by the gravity sensor, control the plurality of PAs to drive the plurality of speakers, the plurality of speakers are asymmetrically distributed in the electronic device, and the memory stores instructions, when the processor executes the instructions, the electronic device performs the method in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The electronic device comprises instructions, when the instructions are executed on the electronic device, the electronic device performs the method in any one of claims 1-6.
Citation Information
Patent Citations
Audio data processing method and electronic equipment
CN114253503A
Audio output device and method, electronic equipment and computer readable storage medium
CN114979933A