A loudness adjustment method and related apparatus

CN122802843APending Publication Date: 2026-09-22HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510769076.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-03-21
Filing Date
2025-06-09
Publication Date
2026-09-22

Smart Images

  • Figure CN122802843A_ABST
    Figure CN122802843A_ABST
Patent Text Reader

Abstract

This application discloses a loudness adjustment method and related apparatus. The method can determine the loudness change value based on the loudness of the audio and the target loudness, and then adjust the loudness of the audio according to the loudness change value so that the loudness of the adjusted audio is close to or equal to the target loudness. In this way, the electronic device can play the audio according to the specified loudness standard and ensure that the loudness of each audio is consistent as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal and computer technology, and in particular to a loudness adjustment method and related apparatus. Background Technology

[0002] The loudness of audio refers to the amplitude of the sound recorded at various moments in an audio file. It can be regarded as the size or intensity of the sound. It is a subjective quantity of the listener's perception of the sound size and a key factor in the human ear's experience of sound. Summary of the Invention

[0003] This application provides a loudness adjustment method and related apparatus, which achieves consistent loudness of audio played by the device.

[0004] In a first aspect, embodiments of this application provide a loudness adjustment method applied to an electronic device. The method includes: acquiring a first audio signal and its loudness; determining a first loudness change value based on the loudness of the first audio signal and a target loudness; and adjusting the loudness of the first audio signal based on the first loudness change value, such that the loudness of the adjusted first audio signal is close to or equal to the target loudness.

[0005] Implementing the method provided in the first aspect can ensure consistent loudness across all audio files. For example, it can achieve consistent volume across different songs, different versions (stereo, spatial), etc. It can ensure consistent loudness when playing from different external devices, such as speakers and headphones, and across different products, such as computers, tablets, and mobile phones. It can also ensure consistent volume across different playback devices. Furthermore, it can ensure consistent volume even on the same playback device, for example, consistent volume across different songs, different quality levels, or different versions.

[0006] In conjunction with the first aspect, in one implementation, the first loudness change value includes: a first value, which is determined based on the difference between the loudness of the first audio and the target loudness.

[0007] In other words, the loudness of an audio file can be adjusted based on the difference between its loudness and the target loudness, thereby reducing the gap between the two.

[0008] In conjunction with the first aspect, in one implementation, the first loudness change value includes: a second value. Determining the first loudness change value specifically includes: determining the second value based on the playback path of the first audio in the electronic device, wherein the playback path corresponds to the processing of the first audio from the framework layer to the hardware abstraction layer.

[0009] In other words, the loudness of the audio can be adjusted according to the playback path of the audio in the device, thereby reducing or eliminating the loudness differences between the audio files introduced by the playback path, and ensuring that the loudness of each audio file remains consistent as much as possible.

[0010] In conjunction with the first aspect, in one implementation, the first loudness change value includes: a third value, which determines the first loudness change value by: determining the third difference based on the rendering algorithm used to calculate the loudness of the first audio, or by determining the third difference based on the rendering algorithm used to calculate the loudness of the first audio and the configuration parameters of the rendering algorithm.

[0011] In other words, the loudness of audio can be adjusted according to the rendering algorithm, thereby reducing or eliminating the loudness differences caused by different rendering algorithms used for different audio, and ensuring that the loudness of each audio is kept consistent as much as possible.

[0012] In conjunction with the first aspect, in one implementation, the first loudness change value includes: a fourth value; determining the first loudness change value specifically includes: determining the fourth value based on the playback device; after adjusting the loudness of the first audio based on the first loudness change value, the method further includes: playing the loudness-adjusted first audio through the playback device.

[0013] In other words, the loudness of the audio can be adjusted according to the audio playback device, thereby reducing or eliminating the loudness differences introduced by using different playback devices for different audio, and ensuring that the loudness of each audio is kept consistent as much as possible.

[0014] In conjunction with the first aspect, in one implementation, the first loudness change value includes: a fifth value, which is determined by: determining the playback environment of the electronic device; and determining the fifth value based on the noise level of the playback environment.

[0015] In other words, the loudness of the audio can be adjusted according to the playback environment of the electronic device, thereby reducing or eliminating the loudness differences introduced by the Broadcom playback environment of different audio, and ensuring that the loudness of each audio is kept consistent as much as possible.

[0016] In conjunction with the first aspect, in one implementation, adjusting the loudness of the first audio based on a first loudness change value specifically includes: adjusting the loudness of the first audio based on the loudness change value when it is determined that the loudness change value exceeds a first preset range; the method further includes: not adjusting the loudness of the first audio when it is determined that the first loudness change value is within a first preset range.

[0017] In other words, if the adjustment range of audio loudness is small, no loudness adjustment is performed; if the adjustment range of audio loudness is large, loudness adjustment is performed. This can save the trouble of adjusting loudness when the adjustment range of audio loudness is small, and reduce the power consumption of electronic devices.

[0018] In conjunction with the first aspect, in one implementation, before adjusting the loudness of the first audio based on the first loudness change value, the method further includes: determining the device scenario as a loudness-priority scenario.

[0019] In other words, if the loudness adjustment range is large and the device scenario is a loudness-priority scenario, the loudness of the audio can be adjusted to keep the audio loudness consistent as much as possible.

[0020] In conjunction with the first aspect, in one implementation, adjusting the loudness of the first audio based on a first loudness change value specifically includes: adjusting the loudness of the first audio based on the first loudness change value when it is determined that the first loudness change value is within a second preset range; the method further includes: not adjusting the loudness of the first audio when it is determined that the first loudness change value exceeds the second preset range.

[0021] In other words, if the adjustment range of audio loudness is large, then no loudness adjustment will be performed; if the adjustment range of audio loudness is small, then loudness adjustment will be performed. This can avoid the loudness after audio adjustment being too different from the loudness before adjustment.

[0022] In conjunction with the first aspect, in one implementation, before adjusting the loudness of the first audio based on the first loudness change value, the method further includes: determining that the device scenario is a sound quality priority scenario.

[0023] In other words, if the loudness adjustment range is large and the device scenario prioritizes sound quality, the loudness of the audio can be adjusted to avoid excessive changes in the sound quality of the adjusted audio.

[0024] In conjunction with the first aspect, in one implementation, the device scenario is determined based on any one of the following: the device attributes of the playback device, the playback environment, or the device scenario selected by the user.

[0025] As can be seen, the device scenario can be determined based on the playback device, playback environment, user selection, etc., and then it can be determined whether to adjust the audio loudness when the loudness adjustment range is large, so as to meet the user's loudness needs in different scenarios.

[0026] In conjunction with the first aspect, in one implementation, before obtaining the first audio and its loudness, the method further includes: detecting an operation to play the first audio; after adjusting the loudness of the first audio based on a first loudness change value, the method further includes: playing the loudness-adjusted first audio.

[0027] It is evident that electronic devices can initiate audio playback based on user input, thereby adjusting the loudness of the audio before playback to ensure that the loudness of the played audio is as close as possible to the target loudness, and to ensure that the loudness of each audio track played by the electronic device remains consistent.

[0028] In conjunction with the first aspect, in one implementation, detecting the operation of playing the first audio specifically includes: detecting the operation of playing the first audio on the first application; the target loudness corresponding to the first application; and obtaining the first audio and the loudness of the first audio, specifically including: obtaining the first audio and the loudness of the first audio from the server corresponding to the first application through the first application.

[0029] As can be seen, by applying a standard for the loudness of each audio file, the loudness of all audio files played on the same application can be adjusted according to this standard.

[0030] In conjunction with the first aspect, in one implementation, determining the loudness of the first audio and the first loudness change value of the target loudness specifically includes: determining the loudness of the first audio and the first loudness change value of the target loudness through the framework layer of the electronic device or the first application; adjusting the loudness of the first audio based on the first loudness change value specifically includes: adjusting the loudness of the first audio based on the first loudness change value through the framework layer of the electronic device.

[0031] As can be seen, the difference between the loudness of the audio and the target loudness can be determined through the device's framework layer or application, and the loudness of the audio can be adjusted based on the framework layer of the electronic device to ensure that the loudness of each audio played by the device remains consistent.

[0032] In conjunction with the first aspect, in one implementation, the method further includes: acquiring the loudness of a second audio and a second audio; determining a second loudness change value based on the loudness of the second audio and a target loudness; and adjusting the loudness of the second audio based on the second loudness change value so that the loudness of the adjusted second audio is close to or equal to the target loudness.

[0033] It is evident that electronic devices can adjust the loudness of different audio frequencies according to the same target loudness, so that the loudness of different audio frequencies is close to or equal to the target loudness, thus ensuring that the loudness of each audio frequency remains consistent as much as possible.

[0034] In conjunction with the first aspect, in one implementation, when the loudness of the first audio and the loudness of the second audio are different, the first loudness change value includes a first value compared to the second loudness change value, the first value being determined based on the difference between the loudness of the audio and the target loudness.

[0035] It can be seen that audio with different loudness can be kept in the same loudness by using the difference δ1 between the loudness of the audio and the target loudness.

[0036] In conjunction with the first aspect, in one implementation, when the playback devices for the first and second audio are different, the first loudness change value includes a fourth value, corresponding to the loudness difference introduced by the playback devices, compared to the second loudness change value.

[0037] It is evident that audio with different playback methods can maintain consistent loudness through the loudness difference δ4 introduced by the playback device.

[0038] In conjunction with the first aspect, in one implementation, the first loudness change value also includes a second value, which corresponds to the loudness difference introduced by the playback link, compared to the second loudness change value.

[0039] It is evident that audio played in different ways may have different playback paths. Therefore, the loudness difference δ2 introduced by the playback path can be combined to ensure that the loudness of the audio remains consistent.

[0040] In conjunction with the first aspect, in one implementation, when the versions of the first and second audio are different, the first loudness change value includes a third value compared to the second loudness change value. The third value corresponds to the loudness difference introduced by the rendering algorithm used to calculate the loudness of the audio.

[0041] It is evident that different versions of audio (such as spatial sound and stereo) can maintain consistent loudness by calculating the loudness difference δ3 introduced by the rendering algorithm used when calculating the audio.

[0042] In conjunction with the first aspect, in one implementation, when the playback environments of the first and second audio are different, the first loudness change value includes a fifth value, which corresponds to the loudness difference introduced by the playback environment, compared to the second loudness change value.

[0043] It is evident that the loudness of audio can be kept consistent under different playback environments by using the loudness difference δ5 introduced by the playback environment.

[0044] In a second aspect, embodiments of this application provide an electronic device, including: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method as described in the first aspect or any implementation thereof.

[0045] Thirdly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in the first aspect or any implementation thereof.

[0046] Fourthly, embodiments of this application provide a computer program product, which includes a computer program that, when executed by a processor, implements the method described in the first aspect or any of the implementations of the first aspect.

[0047] Fifthly, embodiments of this application provide a chip system including a processing circuit and an interface circuit. The interface circuit is used to receive computer instructions and transmit them to the processing circuit. The processing circuit is used to execute the computer instructions to implement the method described in the first aspect or any implementation thereof. Attached Figure Description

[0048] Figure 1 Here are some schematic diagrams of the interfaces related to loudness control methods;

[0049] Figure 2 A schematic diagram of a communication system 1000 provided in an embodiment of this application;

[0050] Figure 3 A schematic diagram of the interaction flow of a loudness adjustment method provided in an embodiment of this application;

[0051] Figure 4 A schematic diagram illustrating the principle of measuring audio loudness, provided for an embodiment of this application;

[0052] Figure 5 This is a schematic diagram of the internal interaction of a loudness adjustment method provided in an embodiment of this application;

[0053] Figure 6 This is a schematic diagram illustrating the internal interaction of another loudness adjustment method provided in an embodiment of this application.

[0054] Figure 7 A schematic diagram of the hardware structure of the electronic device 100 provided in this application embodiment;

[0055] Figure 8 A schematic diagram of the software structure of the electronic device 100 provided in the embodiments of this application. Detailed Implementation

[0056] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings.

[0057] Loudness is the most critical factor in the human ear's experience of sound. The loudness of stereo and multi-channel audio varies greatly, and the loudness also differs depending on the device used for playback. Therefore, it is difficult to guarantee the consistency of loudness when playing audio.

[0058] Specifically, when playing audio through electronic devices, the loudness of the audio is easily affected by a variety of factors. For example, different playback platforms use different audio loudness standards; some platforms use -14 LUFS, while others use -12 LUFS. Therefore, even when playing the same song, the loudness of the song may differ between platforms. Furthermore, differences in the hardware and software of different playback devices can also lead to variations in the loudness of the same audio file. Additionally, different audio producers may use different loudness standards, resulting in different loudness levels for different audio files. Moreover, the loudness of a song can also be influenced by factors such as musical style and emotional tone; songs of different styles may have different loudness levels.

[0059] It is evident that, because loudness is easily affected by a variety of factors, it is difficult for a device to maintain consistent loudness when playing audio.

[0060] Figure 1 This is a schematic diagram of the interface for some loudness control methods.

[0061] like Figure 1 As shown in (a), the loudness of the audio can be adjusted using the "Volume Balance" function displayed in option 1. Figure 1 As shown in (b), the loudness of the audio can be adjusted using the "Volume Balance" function shown in Option 2 and the "Loudness Adaptive" function shown in Option 3.

[0062] It is evident that existing loudness control methods primarily involve adjusting the loudness during application.

[0063] This application provides a loudness adjustment method. When playing audio, the method determines a loudness change value based on the loudness of the audio and a target loudness, and then adjusts the loudness of the audio according to the loudness change value so that the loudness of the adjusted audio is close to or equal to the target loudness.

[0064] As can be seen, this method can specify a loudness level, so that each audio can be adjusted and played according to the specified loudness level as much as possible during playback. This allows the loudness adjustment to be completed on the terminal, ensuring that the audio loudness remains as consistent as possible when different audios are played on different devices. It also ensures that the loudness playback experience is consistent across different songs and different devices.

[0065] It should be noted that, in the embodiments of this application, audio can also be referred to as sound source, audio source, audio program source, audio stream, etc., and the embodiments of this application do not limit the name.

[0066] Figure 2 This is a schematic diagram of a communication system 1000 provided in an embodiment of this application.

[0067] like Figure 2 As shown, the communication system 1000 may include: electronic device 100 and server 200. Wherein:

[0068] The electronic device 100 can be used to adjust the loudness of audio. In some embodiments, the electronic device 100 can obtain audio from the server 200, and optionally, obtain the loudness of the audio from the server 200. In some embodiments, the electronic device 100 can also be used to play audio. Exemplarily, the electronic device 100 can be a device such as a mobile phone, watch, bracelet, tablet, or computer; the embodiments of this application do not limit the type of device 100.

[0069] Server 200 can be used to store audio and send specified audio to electronic device 100 when electronic device 100 requests it. In some embodiments, server 200 can also be used to calculate the loudness of audio. In some embodiments, server 200 can also encode and store the loudness of audio as audio metadata. Thus, when server 200 sends audio to electronic device 100, the loudness of the audio can be sent as audio metadata. In some embodiments, server 200 can also adjust the loudness of audio according to the audio loudness standard of the playback platform so that the loudness of the audio conforms to the audio playback standard of the playback platform. For example, if the audio loudness standard of the playback platform is -10 LUFS to -9 LUFS, and if an audio producer uploads a song with a loudness of -11 LUFS, server 200 can return the song to the audio producer, who can then re-upload a song that conforms to the audio loudness standard to server 200.

[0070] This application does not limit the communication connection method between the electronic device 100 and the server 200. Specifically, the communication connection can be a wired connection or a wireless connection. The wireless connection can be a short-range connection such as Wi-Fi, Bluetooth, infrared, NFC, or ZigBee, or a long-range connection, including but not limited to long-range connections based on 2G, 3G, 4G, 5G, and subsequent standard protocols of mobile networks. For example, the server 200 can send audio to the electronic device 100 via a wireless connection.

[0071] Additionally, it should be noted that the server mentioned in the embodiments of this application, such as server 200, can be a single server or a server cluster composed of multiple servers.

[0072] In addition, the communication system 1000 may include more devices, such as... Figure 2As shown, the communication system 1000 may further include an electronic device 300, which can be used to play audio after the loudness of the electronic device 100 has been adjusted. The electronic device 300 can establish a communication connection with the electronic device 100, such as a Bluetooth connection. For example, the electronic device 300 can be a headset, speaker, large screen, vehicle terminal, mobile phone, watch, or other device.

[0073] Figure 3 This is a schematic diagram of the interactive process of a loudness adjustment method provided in an embodiment of this application.

[0074] like Figure 3 As shown, the loudness adjustment method includes the following steps:

[0075] S101, Electronic device 100 detects the user's operation of playing the first audio.

[0076] In this context, electronic device 100 can refer to devices such as mobile phones, tablets, computers, watches, and wristbands. This application embodiment does not limit the type of electronic device 100.

[0077] For example, the operation can be a touch operation on a touchscreen, a physical operation on a button, or a voice command, etc. This application embodiment does not limit the form of the operation.

[0078] The first audio element can be audio from a song, recording, voice message, or video. Taking a song as an example, when the electronic device 100 detects a user playing the first audio element, it can refer to the electronic device 100 playing a song on a music playback application. Furthermore, the first audio element can be stereo, spatial, surround sound, or other versions of audio; this embodiment does not limit the version of the first audio element.

[0079] S102, Electronic device 100 requests server 200 to obtain the first audio.

[0080] In this device, the electronic device 100 can respond to the user's operation of playing the first audio by sending a request to the server 200 to obtain the first audio.

[0081] It is understandable that if the first audio is stored locally, the electronic device 100 does not need to obtain the first audio through the server 200, that is, steps S102-S103 are optional steps.

[0082] S103, Server 200 sends a first audio signal and the loudness of the first audio signal to Electronic Device 100.

[0083] Server 200 can store one or more audio files. Taking a song as the first audio file, server 200 can be a cloud platform corresponding to a music playback application on electronic device 100 used to play the first audio file. Server 200 can manage and maintain a music library corresponding to the music playback application. This music library can store a large number of songs. Electronic device 100 can display playlists corresponding to these songs through the music playback application. Electronic device 100 can detect the user's operation of playing a song, retrieve the song from the music library of server 200, and play the song.

[0084] For example, after the server 200 receives a request from the electronic device 100 to obtain the first audio, the server 200 can find the first audio in the music library and send the first audio and its loudness to the electronic device 100.

[0085] The loudness of the first audio signal can be measured (or calculated) by server 200. For example, server 200 can encode and store the loudness of the first audio signal as metadata of the first audio signal.

[0086] It is understandable that if server 200 encodes and stores the loudness of the first audio as metadata of the first audio, the data sent by server 200 to electronic device 100 can be the encoded first audio. Electronic device 100 can decode the encoded first audio to obtain the first audio and the loudness of the first audio.

[0087] It is understood that the loudness of the first audio signal can also be calculated by the electronic device 100, and the embodiments of this application do not limit the source of the loudness of the first audio signal.

[0088] For example, Figure 4 This is a schematic diagram illustrating the principle of measuring audio loudness, provided as an embodiment of this application.

[0089] like Figure 4As shown, audio can include various versions, such as stereo, surround sound, objectless 3D sound, and object-containing 3D sound, etc. The loudness measurement methods can differ for different versions of audio. For stereo, surround sound, and objectless 3D sound, loudness measurement can be performed based on ITU-RBS.1770 and EBU R.128 to obtain the audio loudness. ITU-RBS.1770 is an audio loudness measurement standard developed by the International Telecommunication Union (ITU), primarily used for loudness standardization of audio programs in broadcast television, streaming media, and other fields. EBU R.128 is an audio loudness standardization specification developed by the European Broadcasting Union (EBU), aiming to solve the problem of frequent volume adjustments by listeners due to loudness differences in broadcast and streaming media content. For object-containing 3D sound, object pre-rendering can be performed first to obtain audio with sound bed signals. Then, loudness measurement can be performed based on ITU-RBS.1770 and EBU R.128 to obtain the audio loudness. For example, object pre-rendering of audio can be performed using object panning schemes, such as the vector-based amplitude panning (VBAP) algorithm. VBAP is a multi-channel image localization algorithm based on vector amplitude adjustment, which can be used to render audio to a specific speaker configuration.

[0090] After measuring the loudness of the audio, a target loudness value (in LUFS) can be used to adjust the loudness of the audio to obtain the adjusted audio. For a detailed description of loudness adjustment, please refer to subsequent steps S104-S106, which will not be elaborated here.

[0091] S104, Electronic device 100 determines the loudness change value δ based on the loudness of the first audio and the target loudness.

[0092] For example, the electronic device 100 may have a preset target loudness. The electronic device 100 can use this target loudness to regulate the loudness of the electronic device 100 when playing different audio.

[0093] In some implementations, the target loudness may differ across playback platforms. For example, the operation in step S101 could be a user playing first audio on a first application, and the target loudness could correspond to the first application. The first application could refer to the application corresponding to the playback platform used to play the audio, such as Huawei Music or Kugou Music. In other words, the target loudness can differ depending on the first application.

[0094] In some implementations, the loudness change value δ may include the difference δ1 between the loudness of the first audio and the target loudness. Thus, the electronic device 100 can adjust the loudness of the first audio based on the magnitude of the difference between the loudness of the first audio and the target loudness.

[0095] S105, Electronic device 100 adjusts the loudness of the first audio based on the loudness change value δ.

[0096] For example, the electronic device 100 can increase or decrease the loudness of the first audio according to the loudness change value δ, so that the loudness of the first audio is close to or equal to the target loudness.

[0097] Understandably, the loudness change value δ can be a value containing a positive or negative sign. For example, assuming the loudness change value δ is the difference δ1 between the loudness of the first audio and the target loudness, if the loudness change value δ is positive, it means that the loudness of the first audio is greater than the target loudness. When the electronic device 100 adjusts the loudness of the first audio based on the loudness change value δ, it can reduce the loudness of the first audio so that the loudness of the first audio is close to or equal to the target loudness. If the loudness change value δ is negative, it means that the loudness of the first audio is less than the target loudness. When the electronic device 100 adjusts the loudness of the first audio based on the loudness change value δ, it can increase the loudness of the first audio so that the loudness of the first audio is close to or equal to the target loudness.

[0098] S106, Electronic device 100 plays the first audio after loudness adjustment.

[0099] For example, electronic device 100 may be equipped with a speaker, through which electronic device 100 can play a first audio with adjusted loudness.

[0100] In some implementations, the electronic device 100 can also play the loudness-adjusted first audio through another playback device, such as headphones, speakers, watches, large screens, etc. In this case, the electronic device 100 can identify the playback device before playing the first audio, and then play the loudness-adjusted first audio through that playback device.

[0101] As can be seen, this application provides an audio adjustment method in which audio can be acquired first, such as an audio stream or audio metadata, and then the loudness can be measured (or calculated), and / or the object can be pre-rendered. After that, the loudness can be adjusted and the adjusted audio can be output.

[0102] As can be seen from steps S101-S106, when the electronic device 100 detects the user's operation of playing different audio, the electronic device 100 can adjust the loudness of the audio according to the steps S101-S106, so that the loudness of the audio can be as close as possible to a uniform loudness, and ensure that the loudness of different audio played by the electronic device 100 remains consistent as much as possible.

[0103] Furthermore, considering that the loudness of audio playback is affected by a variety of factors, the electronic device 100 can specifically calculate the loudness differences introduced by various factors, and adjust the loudness of the audio based on these loudness differences, thereby reducing or eliminating the influence of these factors on the audio loudness.

[0104] For example, the loudness of audio may be affected by one or more of the following factors:

[0105] 1) Playback Link

[0106] The playback path corresponds to the processing of the audio stream from the Framework (FWK) layer through the Hardware Abstraction Layer (HAL). When the electronic device 100 plays different audio, it may pass through different playback paths; that is, different processing may occur when the audio stream passes from the Framework layer to the HAL. For example, if the audio is played through a speaker, the playback path may be for speaker playback; if the audio is played through headphones, the playback path may be for headphone playback. The algorithms and audio processing used in different playback paths may differ, potentially leading to different loudness levels of the audio ultimately played by the electronic device 100.

[0107] For example, the electronic device 100 can determine the playback path of the audio based on the relevant settings of the audio when the user plays the audio. These relevant settings may include playback method, rendering mode, sound effects, etc.

[0108] Therefore, the electronic device 100 can calculate the loudness difference δ2 introduced by the playback link, and then adjust the loudness when playing the first audio based on the loudness difference δ2.

[0109] 2) Rendering algorithm

[0110] Among them, the rendering algorithm can refer to the algorithm used to render audio when calculating the loudness of the audio.

[0111] Different rendering algorithms may result in differences in loudness during audio playback.

[0112] Therefore, the electronic device 100 can calculate the loudness difference δ3 corresponding to the rendering algorithm, and then adjust the loudness when playing the first audio based on the loudness difference δ3.

[0113] Furthermore, even when using the same rendering algorithm, different algorithm configuration parameters may result in differences in the loudness of the audio playback.

[0114] Therefore, the electronic device 100 can calculate the loudness difference δ3 based on the rendering algorithm and its configuration parameters, and then adjust the loudness when playing the first audio based on this loudness difference δ3. In this way, compared to calculating the loudness difference using only the rendering algorithm, the loudness difference introduced by different rendering algorithms can be determined more accurately.

[0115] The rendering algorithm and algorithm configuration parameters used in the first audio can be sent from the server 200 to the electronic device 100.

[0116] For example, the electronic device 100 may have preset loudness differences corresponding to different rendering algorithms and algorithm configuration parameters, and then find the loudness difference δ3 corresponding to the first audio according to the rendering algorithm and algorithm configuration parameters used by the first audio.

[0117] 3) Playback device

[0118] Different playback devices may cause differences in the loudness of audio playback. For example, the loudness of a song played on a speaker and a mobile phone may be different.

[0119] Therefore, the electronic device 100 can determine the playback device used when playing audio, find the loudness difference δ4 corresponding to the playback device, and then adjust the loudness when playing the first audio based on the loudness difference δ4.

[0120] For example, the electronic device 100 may have preset loudness differences corresponding to different playback devices, and then the loudness difference δ4 corresponding to the playback device used to play the first audio can be found.

[0121] 4) Playback environment

[0122] The playback environment refers to the environment in which the first audio is played. Since loudness is a subjective quantity that listeners perceive as the volume of a sound, the noise and quietness of the environment will also affect the loudness when the first audio is played.

[0123] Therefore, the electronic device 100 can determine the loudness difference δ5 based on the noise level of the playback environment, and then adjust the loudness when playing the first audio based on the loudness difference δ5.

[0124] Based on the loudness differences δ2-δ5 introduced above, the electronic device 100 can adjust the loudness of the first audio based on the difference δ1 and any one or more of the loudness differences δ2-δ5 when performing step S105.

[0125] It can be seen that the loudness change value δ calculated by the electronic device 100 may include one or more of the loudness differences δ2-δ5, in addition to the difference δ1.

[0126] For example, electronic device 100 can adjust the audio loudness based on δ1 and δ2. Specifically, electronic device 100 can calculate δ1+δ2 and then adjust the loudness when playing the first audio based on δ1+δ2. In this way, electronic device 100 can keep the loudness of different audios as consistent as possible, while also minimizing the impact of the playback link on the audio loudness.

[0127] For example, electronic device 100 can adjust the audio loudness based on δ1, δ2, and δ3. Specifically, electronic device 100 can adjust the loudness when playing the first audio based on δ1+δ2+δ3. In this way, electronic device 100 tries to keep the loudness of different audios consistent, while also minimizing the impact of playback links and rendering algorithms on audio loudness.

[0128] For example, electronic device 100 can adjust the audio loudness based on δ1, δ2, and δ4. Specifically, electronic device 100 can adjust the loudness when playing the first audio based on δ1+δ2+δ4. In this way, electronic device 100 tries to keep the loudness of different audios consistent, while also minimizing the influence of the playback link and playback device on the audio loudness.

[0129] As can be seen, if the electronic device 100 adjusts the loudness when playing the first audio based on the difference δ1 and any one or more of the loudness differences δ2-δ5, the electronic device 100 can calculate the total loudness change value δ, and then adjust the loudness when playing the first audio based on the loudness change value δ.

[0130] Understandably, if the loudness of the first audio signal equals the target loudness, then the difference δ1 is 0. Therefore, the electronic device 100 does not need to adjust the loudness of the audio signal based on the difference δ1. In this case, the electronic device 100 can adjust the loudness of the first audio signal based on any one or more of the loudness differences δ2-δ5. That is, the loudness change value δ can include any one or more of δ1-δ5, and the electronic device 100 can adjust the loudness of the audio signal based on any one or more of δ1-δ5.

[0131] In some implementations, the electronic device 100 may also select whether to adjust the loudness based on whether the loudness change value δ exceeds a preset range.

[0132] For example, if the loudness change value δ exceeds the preset range, no loudness adjustment will be performed.

[0133] This is because if the loudness change value δ exceeds the preset range, it means that the loudness adjustment range may be large. In order to avoid excessive loudness adjustment affecting the original sound quality of the audio, the electronic device 100 can refrain from loudness adjustment when the loudness change value δ exceeds the preset range.

[0134] As can be seen, this situation applies to devices that prioritize sound quality. If the electronic device 100 prioritizes the sound quality of the audio when playing audio, then no loudness adjustment will be made when the loudness change value δ exceeds the preset range.

[0135] For example, if the loudness change value δ exceeds the preset range, then loudness adjustment will be performed.

[0136] This is because if the loudness change value δ exceeds the preset range, although the loudness adjustment range may be large, the adjustment can ensure that the audio loudness is within the specified range. Therefore, the electronic device 100 can adjust the loudness when the loudness change value δ exceeds the preset range.

[0137] For example, dynamic range control (DRC) and multiband dynamic range control (MBDRC) techniques can be introduced during loudness adjustment. DRC and MBDRC are dynamic range adjustment techniques used in audio signal processing.

[0138] As can be seen, this situation applies to devices that prioritize loudness. If the electronic device 100 prioritizes the loudness of the audio when playing audio, then even if the loudness change value δ exceeds the preset range, the electronic device 100 can still adjust the loudness.

[0139] For example, if the loudness change value δ is within the preset range, then no loudness adjustment will be performed.

[0140] This is because if the loudness change value δ is within the preset range, the adjustment range of the loudness may be too small, and the difference before and after the loudness adjustment may not be easily noticed by the user. In this case, the electronic device 100 does not need to adjust the loudness, saving the trouble of adjusting the loudness and reducing the power consumption of the electronic device 100.

[0141] It is understandable that if the loudness change value δ is a value containing a positive or negative sign, the loudness change value δ exceeds the preset range. This can mean that if the loudness change value δ is negative, then the loudness change value is less than the minimum value of the preset range, and if the loudness change value δ is positive, then the loudness change value is greater than the maximum value of the preset range.

[0142] Furthermore, the electronic device 100 can also determine the device scenario in any of the following ways:

[0143] 1) Determine the device scenario based on the device attributes of the playback device.

[0144] Device attributes can be used to describe the characteristics and status of the playback device. For example, device attributes may include: device type, device model, device function, etc.

[0145] For example, electronic device 100 can identify the device scenario when playing audio based on the device type. For instance, if the playback device is a speaker, headphones, a large screen, or an in-vehicle terminal, electronic device 100 can determine that the device scenario prioritizes sound quality. In this case, if the difference δ exceeds a preset range, electronic device 100 may not adjust the audio loudness. Conversely, if the playback device is a mobile phone or a watch, electronic device 100 can determine that the device scenario prioritizes loudness. In this case, if the difference δ exceeds a preset range, electronic device 100 may adjust the audio loudness.

[0146] 2) Determine the device scenario based on the user's playback environment.

[0147] In one example, electronic device 100 can determine the device scene based on the noise level of the user's playback environment. For instance, if the user's playback environment is noisy, electronic device 100 can determine that the device scene prioritizes loudness; if the user's playback environment is quiet, electronic device 100 can determine that the device scene prioritizes sound quality. This is because users are more likely to hear sound details in a quiet environment compared to a noisy one. Therefore, the loudness adjustment can be determined based on the noise level of the user's environment to avoid the user perceiving an overly abrupt loudness change.

[0148] In another example, electronic device 100 can determine the device scene based on whether the user's playback environment is indoors or outdoors. For example, if the user's playback environment is indoors, electronic device 100 can determine that the device scene prioritizes sound quality; if the user's playback environment is outdoors, electronic device 100 can determine that the device scene prioritizes loudness. This is because, considering that users are more likely to hear sound details indoors compared to outdoors, the loudness adjustment can be determined based on whether the user is indoors or outdoors, avoiding overly abrupt loudness adjustments perceived by the user.

[0149] 3) Determine the device scenario based on user operations.

[0150] For example, the electronic device 100 can provide users with options for loudness priority and sound quality priority, allowing users to choose whether to adjust the audio loudness according to loudness priority or sound quality priority.

[0151] It is understood that the electronic device 100 can also determine the device scenario in other ways, and this application embodiment does not limit this.

[0152] Figure 5This is a schematic diagram of the internal interaction of a loudness adjustment method provided in an embodiment of this application.

[0153] like Figure 5 As shown, the loudness adjustment method provided in this application embodiment involves the application layer, framework layer (FWK), and hardware abstraction layer (HAL) in the software framework of electronic device 100. The application layer includes APP, which can refer to an application on electronic device 100 used for playing audio. Taking the played audio as a song as an example, the application can be a music playback application.

[0154] The APP can be used to request audio from the server via a 200 request, while the FWK can be used to adjust the loudness of the audio.

[0155] like Figure 5 As shown, the electronic device 100 can first request audio and metadata from the server 200 (Step 1, Step 2), then the APP calculates the loudness change value δ (Step 3), and sends the audio and audio-related data to the FWK through the API interface (Step 4). The FWK then calculates and / or adjusts the loudness (Step 5), and finally outputs it to an audio device, which can be a speaker, a large screen, etc. In some embodiments, the audio device can also be the terminal itself.

[0156] In some implementations, the audio loudness can be calculated in the cloud (i.e., server 200) and adjusted according to platform (APP-side) specifications. The audio loudness can be encoded and stored as audio metadata.

[0157] Combining the steps S101-S106 above, Figure 5 The step 1 shown can correspond to step S101, step 2 can correspond to steps S102-S103, step 3 and step 4 can correspond to step S104, step 5 can correspond to step S105, and the subsequent process of audio being transmitted from electronic device 100 to electronic device 300 can correspond to step S106.

[0158] Understandably, in Figure 5 In addition to being calculated by APP, the loudness change value δ can also be calculated by FWK. This application does not limit this calculation. Figure 5 Taking HarmonyOS as an example of the operating system of electronic devices 100 and 300, in other embodiments of this application, the operating system of electronic devices 100 and 300 may be other operating systems, and this application does not limit this.

[0159] Figure 6 exist Figure 5 Based on this, taking the loudness change value δ including the difference δ1 as an example, a schematic diagram of the internal interaction of another loudness adjustment method provided in the embodiment of this application is shown.

[0160] Figure 6 (a) and (b) in the figure illustrate two different internal interaction processes in the loudness adjustment method.

[0161] exist Figure 6 In step (a), in conjunction with steps S101-S105 above, if the loudness change value in step S104 includes the difference δ1 between the loudness of the audio and the target loudness, during the execution of step S101 by the electronic device 100, the FWK in the electronic device 100 can request audio from the APP (Step 1). During the execution of steps S102-S103 between the electronic device 100 and the server 200, specifically, the interaction between the APP in the electronic device 100 and the server 200 is as follows: the APP obtains the audio and the loudness of the audio from the music library in the server 200 (Step 2). The electronic device 100 executes step S104, specifically, the APP in the electronic device 100 calculates the difference δ1 between the loudness of the audio and the target loudness (Step 3), and the APP sends the audio and the difference δ1 to the FWK (Step 4). The electronic device 100 executes step S105, specifically, the FWK in the electronic device 100 adjusts the loudness of the audio based on the difference δ1 (Step 5).

[0162] In other words, after obtaining the audio and metadata, the APP can calculate the difference δ1 between the audio loudness and the target loudness; send δ1 to the system FWK through the API interface; and then the FWK adjusts the audio loudness based on the difference δ1.

[0163] exist Figure 6 In (b) of the middle, compared to Figure 6 The difference from (a) is that the electronic device 100 performs step S104, which specifically includes: the APP in the electronic device 100 sending audio, the loudness of the audio and the target loudness to the FWK (Step3'), and the FWK in the electronic device 100 calculating the difference δ1 between the loudness of the audio and the target loudness (Step4').

[0164] contrast Figure 6 (a) and Figure 6 As can be seen from (b) in the diagram, in the internal implementation of loudness adjustment in the electronic device 100, the difference δ1 between the loudness of the audio and the target loudness can be calculated by the APP or by the FWK.

[0165] Furthermore, if the loudness change value δ in step S104 also includes one or more of the loudness differences δ2-δ5, that is, if the electronic device 100, in addition to the difference δ1, also considers the influence of one or more of the playback link, rendering algorithm, playback device, and playback environment on the audio loudness, then, combined with Figure 6 Before Step 5, FWK may be used to calculate one or more of δ2-δ5, and the audio loudness may be adjusted according to one or more of δ2-δ5 when Step 5 is performed.

[0166] It should be noted that if the electronic device 100 considers the impact of the rendering algorithm on the audio loudness, the rendering algorithm, and further, the configuration parameters of the rendering algorithm, can also be sent to the electronic device 100 by the server 200 in Step 2. Then, when the APP sends the audio to the FWK, it can also send the rendering algorithm, and further, the configuration parameters of the rendering algorithm, to the FWK so that the FWK can calculate the loudness difference δ3 corresponding to the rendering algorithm.

[0167] Taking the loudness change value δ, which includes the difference δ1 and the loudness change value δ2, as an example, the APP sends audio containing audio loudness, sends the target loudness through the API, FWK decodes the audio loudness, first calculates δ1, and then calculates the loudness change value δ2 introduced by the playback link according to the loudness standard. FWK adjusts the loudness of the audio according to δ1+δ2, and finally the loudness of the device playback is consistent with the target loudness.

[0168] Taking the loudness change value δ, which includes the difference δ1, loudness change value δ2, and loudness change value δ3, as an example, the APP sends audio containing audio loudness, and sends the target loudness and the corresponding rendering algorithm and its algorithm configuration parameters through the API. The difference in perceived loudness between different rendering algorithms and their algorithm configuration parameters is defined as the loudness change value δ3. After FWK decodes the audio source loudness, it first calculates δ1, and then calculates the loudness change δ2 introduced by the playback link according to the loudness standard. FWK adjusts the loudness of the audio according to δ1+δ2+δ3, so that the final playback loudness of the device is consistent with the target loudness.

[0169] Taking the loudness change value δ, which includes the difference δ1, loudness change value δ2, and loudness change value δ4, as an example, the APP sends audio containing audio loudness, and sends the target loudness and the corresponding rendering algorithm and its algorithm configuration parameters through the API; the difference in perceived loudness between different devices is defined as the loudness change value δ4. After FWK decodes the audio loudness, it first calculates δ1, and then calculates the loudness change δ2 introduced by the playback link according to the loudness standard. FWK adjusts the loudness of the audio according to δ1+δ2+δ4, so that the final playback loudness of the device is consistent with the target loudness.

[0170] In some implementations, the loudness adjustment method provided in this application also relates to an electronic device 300, such as... Figure 6 (a) and Figure 6 As shown in (b), if electronic device 100 plays audio through other devices, such as electronic device 300, electronic device 100 can also send the loudness-adjusted audio to electronic device 300 so that electronic device 300 can play the loudness-adjusted audio. Electronic device 100 can also determine the aforementioned δ4 based on electronic device 300, so that electronic device 100 adjusts the loudness of the audio according to δ4, minimizing loudness differences introduced by the playback device.

[0171] As can be seen, the loudness adjustment method provided in this application embodiment can consider the influence of various factors on audio loudness. For example, in a music playback scenario, the loudness of songs with different loudness can be adjusted by calculating the difference δ1 introduced by the difference between the audio loudness and the target loudness, so that the loudness of different songs played by the electronic device 100 remains consistent. For another example, for different versions of audio, such as stereo and spatial sound, the loudness of different versions of audio can be adjusted by calculating the loudness difference δ3 introduced by different rendering algorithms, so that the audio loudness remains consistent. For another example, for different playback methods, such as audio played through external speakers and audio played through headphones, the loudness difference δ4 introduced by different playback devices and the loudness difference δ2 introduced by different playback links can be calculated to keep the audio loudness consistent under different playback methods. For another example, for audio played in different playback environments, the loudness difference δ5 introduced by different playback environments can be calculated to keep the audio loudness consistent under different playback environments. For another example, the electronic device 100 can also make the loudness of different products, such as mobile phones, tablets, computers, etc., consistent, thereby improving the user's auditory experience.

[0172] Figure 7 A schematic diagram of the hardware structure of the electronic device 100 provided in this application embodiment.

[0173] Electronic device 100 may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device and / or smart city device. The embodiments of this application do not impose any special restrictions on the specific type of electronic device.

[0174] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0175] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0176] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0177] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0178] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0179] In some implementations, the processor 110 may be used to acquire a first audio signal and its loudness, determine a first loudness change value based on the loudness of the first audio signal and a target loudness, and adjust the loudness of the first audio signal based on the first loudness change value. Here, the first audio signal may refer to any audio signal played by the user, and the first loudness change value may refer to... Figure 3 The loudness change value δ is shown.

[0180] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0181] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0182] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the electronic device 100. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0183] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0184] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with networks and other devices through wireless communication technology.

[0185] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0186] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In some embodiments, an electronic device may include one or N displays screens 194, where N is a positive integer greater than 1.

[0187] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0188] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0189] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0190] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0191] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0192] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM).

[0193] In some implementations, the internal memory 121 may be used for a first audio frequency, the loudness of the first audio frequency and a target loudness, and a first loudness change value determined based on the loudness of the first audio frequency and the target loudness.

[0194] The random access memory can be directly read and written by the processor 110. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.

[0195] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110.

[0196] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0197] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.

[0198] Figure 8 A schematic diagram of the software structure of the electronic device 100 provided in the embodiments of this application.

[0199] The electronic device 100 provided in this application embodiment can run an operating system (OS). This operating system can be various operating systems used in industry, such as an operating system based on OpenHarmony, like HarmonyOS; or other operating systems such as Android. TM An operating system can refer to the iOS mobile operating system; it can also refer to various open-source operating systems or their derivatives, such as Linux OS and other embedded operating systems; or it can refer to future new operating systems, such as AI operating systems based on artificial intelligence. An operating system is a set of interconnected system software programs that manage and control the operation of electronic devices, utilize and run hardware and software resources, and provide public services to organize user interactions. In electronic devices, the operating system connects downwards to the physical devices at the hardware layer and upwards to provide a runtime environment for application software.

[0200] An operating system typically includes a kernel layer, a middleware layer, and an application layer. The application layer includes applications, which can include system applications and third-party applications. The middleware layer includes a suite of software providing various services to application developers, or frameworks providing services such as databases, multimedia, and graphics, or capabilities such as distributed scheduling and system scaling. For example, the middleware layer may include a framework layer and / or a system service layer. The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The system service layer includes the system's core capabilities, providing services to applications through the framework layer. The kernel layer is the layer between hardware and software. The kernel layer may include hardware drivers and the operating system kernel. In addition to providing hardware drivers, the kernel layer also supports functions such as memory management and system process management.

[0201] The electronic devices we use in our daily lives come in various types and forms, and are applied in a wide range of scenarios. Therefore, based on the different forms and functions of electronic devices, different application scenarios, and different user needs, the operating systems used in these devices may also differ. The basic functions implemented by the electronic device 100 provided in this application can be implemented using a general-purpose operating system or a dedicated operating system. To more clearly illustrate the implementation of the embodiments of this application under a specific operating system, the architecture of HarmonyOS is shown below. Those skilled in the art can deduce the implementation of the embodiments of this application under other specific operating systems, such as Android. TM Implementation under operating systems, etc.

[0202] like Figure 8 As shown, the software architecture of electronic device 100 can be divided into several layers. In some implementations, from bottom to top, these layers are: kernel layer, system service layer, framework layer, and application layer. Layers communicate with each other through software interfaces. System functions can be tailored, added, or combined at the subsystem granularity in different device deployment scenarios, and each subsystem can also be tailored, added, or combined at the functional granularity.

[0203] The Kernel Abstraction Layer (KAL) provides basic kernel capabilities to upper layers by shielding the differences between multiple kernels, including but not limited to process / thread management, memory management, file system, network management, and peripheral device management.

[0204] Kernel Subsystem: Supports the selection of a suitable OS kernel for different resource-constrained devices, including but not limited to Linux kernel, HarmonyOS kernel, LiteOS (Lite Operating System), etc.

[0205] Driver Subsystem: The driver framework is the foundation for the open system hardware ecosystem, providing unified peripheral access capabilities and a framework for driver development and management. The driver framework includes: display drivers, camera drivers, audio drivers, Bluetooth drivers, sensor drivers, etc.

[0206] The system service layer comprises the core capabilities of the system, providing services to applications through the framework layer. This layer includes, but is not limited to, the following subsystems:

[0207] The system's basic capability subsystem set provides fundamental capabilities for the operation, scheduling, and migration of distributed applications across multiple devices. This set may include distributed soft bus, distributed data management, distributed task scheduling, and Ark multi-language runtime; it may also include multi-modal input subsystem, graphics subsystem, security subsystem, and AI business subsystem.

[0208] The AI ​​business subsystem provides a unified AI (Artificial Intelligence) engine framework, enabling rapid plug-in integration of algorithm capabilities. The framework mainly includes modules for plug-in management, module management, and communication management, providing lifecycle management and on-demand deployment of AI algorithm capabilities.

[0209] Basic software service subsystem set: provides public and general software services; the basic software service subsystem set may include event notification subsystem, telephone service subsystem, multimedia subsystem, etc.

[0210] Enhanced software service subsystem suite: Provides differentiated enhanced software services for different devices; the enhanced software service subsystem suite may include smart screen proprietary business subsystem, wearable proprietary business subsystem, IoT proprietary business subsystem, etc.

[0211] Hardware service subsystem set: Provides hardware services; the hardware service subsystem set may include location service subsystem, user IAM (Identity and Access Management) subsystem, wearable proprietary hardware service subsystem, biometric identification, IoT proprietary hardware service subsystem, etc.

[0212] Distributed task scheduling enables distributed service management (discovery, synchronization, registration, and invocation), supporting remote startup, remote invocation, remote connection, and migration of applications across devices.

[0213] Distributed data management enables data synchronization, data storage, data sharing, and data access across all scenarios and devices.

[0214] The distributed soft bus provides communication-related capabilities for seamless interconnection between multiple devices, including: WLAN service capabilities, Bluetooth service capabilities, soft bus, inter-process communication RPC (Remote Procedure Call), and StarFlash communication capabilities.

[0215] Ark Multilingual Runtime is a unified compilation runtime platform designed to support the joint compilation and execution of multiple programming languages ​​and multiple chip platforms.

[0216] The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The framework layer includes: the ArkUI framework (which provides a complete infrastructure for UI development of system applications, including UI functions such as components, layouts, animations, and interactive events, as well as a real-time interface preview tool), the user application framework, and the Ability framework. Different devices may run different operating systems, and therefore support different APIs.

[0217] An Ability is a lightweight application. The Ability framework can schedule and manage the operation and lifecycle of Abilities (meta-capabilities). An Ability is a fundamental component of an application, the smallest unit for system-managed applications, and a component capable of performing an independent function. An application can contain one or more Abilities. Abilities are divided into two types: Feature Abilities (FA) and Particle Abilities (PA). An application can consist of one or more FAs or PAs. FAs have a user interface, providing the ability to interact with the user; while PAs do not have a user interface, but provide the ability to run background tasks and a unified data access abstraction.

[0218] The HarmonyOS API is a series of open capabilities provided to support HarmonyOS application development. The HarmonyOS API can be set at the framework layer or independently of the framework layer. The HarmonyOS API includes the Audio API (audio service), Push API (push service), and Account API (account service), among others.

[0219] In this embodiment, the electronic device 100 can calculate the loudness of audio through a frame layer. Combined with... Figure 5 For details on the role of the framing layer in loudness adjustment, please refer to [link to relevant documentation]. Figure 5 The relevant description of FWK in the document.

[0220] At the application layer, applications can include system applications and extended / third-party applications. System applications can include the desktop, control bar, settings, contacts, phone, camera, etc., while extended / third-party applications can include social applications, travel applications, etc.

[0221] For example, in this embodiment, the application layer may include applications that can be used to play audio, such as music playback applications, video playback applications, recording applications, etc. These applications can refer to system applications or third-party applications. For instance, electronic device 100 can detect a user's operation of playing a song on a music playback application and play the song displayed on the music playback application. As another example, electronic device 100 can detect a user's operation of playing a video on a video playback application and play the video displayed on the video playback application. Playing the video may include displaying the video image on a screen and playing the audio of the video through a speaker or other playback device.

[0222] Understandably, in combination Figure 5 and Figure 6 The application that plays audio can refer to Figure 5 and Figure 6 The apps mentioned in the text.

[0223] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0224] This application also provides an electronic device that may include a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method performed by the electronic device as described in any of the above embodiments.

[0225] This application also provides a chip system including a processing circuit and an interface circuit. The interface circuit is used to receive computer instructions and transmit them to the processing circuit. The processing circuit is used to execute the computer instructions to implement the method performed by the electronic device as in any of the above embodiments.

[0226] This application also provides a chip system including at least one processor for implementing the methods executed by the electronic device in any of the above embodiments. In one possible design, the chip system further includes a memory for storing program instructions and data, the memory being located within or outside the processor.

[0227] A chip system can consist of chips or include chips and other discrete components.

[0228] Optionally, there may be one or more processors in the chip system. The processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0229] Optionally, the chip system may contain one or more memories. These memories may be integrated with the processor or disposed separately; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0230] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0231] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method executed by the electronic device in any of the above embodiments.

[0232] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method executed by the electronic device as described in any of the above embodiments.

[0233] The various embodiments of this application can be combined arbitrarily to achieve different technical effects.

[0234] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as 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, all or part of the processes or functions described in 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 website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) 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 such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0235] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0236] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0237] The terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0238] In summary, the above description is merely an embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made based on the disclosure of this application should be included within the scope of protection of this application.

Claims

1. A loudness adjustment method, characterized in that, The method is applied to an electronic device, and the method includes: Obtain the first audio value and its loudness; The first loudness change value is determined based on the loudness of the first audio and the target loudness; The loudness of the first audio is adjusted based on the first loudness change value, so that the loudness of the adjusted first audio is close to or equal to the target loudness.

2. The method according to claim 1, characterized in that, The first loudness change value includes: a first value, which is determined based on the difference between the loudness of the first audio and the target loudness.

3. The method according to claim 1 or 2, characterized in that, The first loudness change value includes: a second value, and determining the first loudness change value specifically includes: The second value is determined based on the playback path of the first audio in the electronic device, where the playback path corresponds to the processing of the first audio from the framework layer to the hardware abstraction layer.

4. The method according to any one of claims 1-3, characterized in that, The first loudness change value includes: a third value, which determines the first loudness change value, specifically including: The third difference is determined based on the rendering algorithm used to calculate the loudness of the first audio, or by the rendering algorithm used to calculate the loudness of the first audio and the configuration parameters of the rendering algorithm.

5. The method according to any one of claims 1-4, characterized in that, The first loudness change value includes: a fourth value, which determines the first loudness change value, specifically including: The fourth value is determined based on the playback device; After adjusting the loudness of the first audio based on the first loudness change value, the method further includes: The first audio, with its loudness adjusted, is played through the playback device.

6. The method according to any one of claims 1-5, characterized in that, The first loudness change value includes: a fifth value, which determines the first loudness change value, specifically including: Determine the playback environment of the electronic device; The fifth value is determined based on the noise level of the playback environment.

7. The method according to any one of claims 1-6, characterized in that, Adjusting the loudness of the first audio based on the first loudness change value specifically includes: If it is determined that the loudness change value exceeds a first preset range, the loudness of the first audio is adjusted based on the loudness change value; The method further includes: If the loudness change value is determined to be within a first preset range, the loudness of the first audio signal is not adjusted.

8. The method according to claim 7, characterized in that, Before adjusting the loudness of the first audio based on the first loudness change value, the method further includes: The device scenario is determined to be a loudness-priority scenario.

9. The method according to any one of claims 1-8, characterized in that, Adjusting the loudness of the first audio based on the first loudness change value specifically includes: If it is determined that the first loudness change value is within a second preset range, the loudness of the first audio is adjusted based on the first loudness change value; The method further includes: If it is determined that the first loudness change value exceeds the second preset range, the loudness of the first audio signal will not be adjusted.

10. The method according to claim 9, characterized in that, Before adjusting the loudness of the first audio based on the first loudness change value, the method further includes: The device scenario is determined to be a scenario prioritizing sound quality.

11. The method according to claim 8 or 10, characterized in that, The device scenario is determined based on any one of the following: the device attributes of the playback device, the playback environment, or the device scenario selected by the user.

12. The method according to any one of claims 1-11, characterized in that, Before obtaining the first audio and its loudness, the method further includes: The operation to play the first audio file was detected. After adjusting the loudness of the first audio based on the first loudness change value, the method further includes: Play the first audio file with adjusted loudness.

13. The method according to claim 12, characterized in that, The operation of playing the first audio was detected, specifically including: An operation to play the first audio was detected in the first application; the target loudness corresponds to the first application. Obtaining the first audio and its loudness specifically includes: The first audio and its loudness are obtained from the server corresponding to the first application.

14. The method according to claim 13, characterized in that, Determining the first loudness change value between the loudness of the first audio and the target loudness specifically includes: The loudness of the first audio and the first loudness change value of the target loudness are determined by the frame layer of the electronic device or the first application; Adjusting the loudness of the first audio based on the first loudness change value specifically includes: The loudness of the first audio signal is adjusted based on the first loudness change value through the frame layer of the electronic device.

15. The method according to any one of claims 1-14, characterized in that, The method further includes: Obtain the second audio and its loudness; The second loudness change value is determined based on the loudness of the second audio and the target loudness; The loudness of the second audio is adjusted based on the second loudness change value, so that the loudness of the adjusted second audio is close to or equal to the target loudness.

16. The method according to claim 15, characterized in that, When the loudness of the first audio and the loudness of the second audio are different, the first loudness change value includes a first value compared to the second loudness change value. The first value is determined based on the difference between the loudness of the audio and the target loudness.

17. The method according to claim 15 or 16, characterized in that, When the playback devices for the first audio and the second audio are different, the first loudness change value includes a fourth value, which corresponds to the loudness difference introduced by the playback device, compared to the second loudness change value.

18. The method according to claim 16, characterized in that, Compared to the second loudness change value, the first loudness change value also includes a second value, which corresponds to the loudness difference introduced by the playback link.

19. The method according to any one of claims 15-18, characterized in that, In cases where the versions of the first audio and the second audio are different, the first loudness change value includes a third value, which corresponds to the loudness difference introduced by the rendering algorithm used to calculate the loudness of the audio, compared to the second loudness change value.

20. The method according to any one of claims 15-19, characterized in that, When the playback environments of the first audio and the second audio are different, the first loudness change value includes a fifth value, which corresponds to the loudness difference introduced by the playback environment, compared to the second loudness change value.

21. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the method as described in any one of claims 1-20.

22. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which, when executed by a processor, implements the method as described in any one of claims 1-20.

23. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-20.

24. A chip system, characterized in that, The chip system includes a processing circuit and an interface circuit. The interface circuit is used to receive computer instructions and transmit them to the processing circuit. The processing circuit is used to execute the computer instructions to implement the method as described in any one of claims 1-20.