CN114979347B - Audio playing method, electronic equipment and chip system - Google Patents

Audio playing method, electronic equipment and chip system Download PDF

Info

Publication number
CN114979347B
CN114979347B CN202110194834.0A CN202110194834A CN114979347B CN 114979347 B CN114979347 B CN 114979347B CN 202110194834 A CN202110194834 A CN 202110194834A CN 114979347 B CN114979347 B CN 114979347B
Authority
CN
China
Prior art keywords
source data
sound source
sound
sound effect
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110194834.0A
Other languages
Chinese (zh)
Other versions
CN114979347A (en
Inventor
刘世涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202110194834.0A priority Critical patent/CN114979347B/en
Publication of CN114979347A publication Critical patent/CN114979347A/en
Application granted granted Critical
Publication of CN114979347B publication Critical patent/CN114979347B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10KSOUND-PRODUCING DEVICES; METHODS OR DEVICES FOR PROTECTING AGAINST, OR FOR DAMPING, NOISE OR OTHER ACOUSTIC WAVES IN GENERAL; ACOUSTICS NOT OTHERWISE PROVIDED FOR
    • G10K15/00Acoustics not otherwise provided for
    • G10K15/08Arrangements for producing a reverberation or echo sound
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones

Abstract

The application provides a method for playing audio and electronic equipment, and relates to the technical field of terminals, wherein the method comprises the steps that the electronic equipment obtains first sound source data based on a first application program, the electronic equipment obtains a first sound effect strategy corresponding to the first application program, the electronic equipment processes the sound effect of the first sound source data based on the first sound effect strategy to obtain second sound source data, and the electronic equipment plays audio based on the second sound source data. According to the technical scheme, the optimizing effect on the sound source data can be improved, and the differentiated requirements of users are met.

Description

Audio playing method, electronic equipment and chip system
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a method for playing audio, an electronic device, and a chip system.
Background
With the continuous popularization of electronic devices such as mobile phones and large screen devices, the requirements of users on the electronic devices are not limited to the capability of emitting sound, but rather, a better or personalized sound experience is desired, so that a method for playing audio is needed.
In the prior art, when any sound source data is acquired by the electronic device, the sound source data can be played after being subjected to sound effect processing based on a sound effect strategy preset by a user. However, the processing effects expected to be achieved by the user in different scenes are different, so that the different requirements of the user cannot be met by adopting the sound effect strategy preset by the user.
Disclosure of Invention
In view of this, the present application provides a method, an electronic device, and a chip system for playing audio, which can improve the optimizing effect on audio data, and meet the differentiated requirements of users.
To achieve the above object, in a first aspect, an embodiment of the present application provides a method for playing audio, including:
the electronic equipment acquires first sound source data based on a first application program;
the electronic equipment acquires a first sound effect strategy corresponding to the first application program;
the electronic equipment performs sound effect processing on the first sound source data based on the first sound effect strategy to obtain second sound source data;
the electronic device plays audio based on the second sound source data.
The first application program may be any application program in the electronic device, the first sound source data may be sound source data generated by the first application program, and the first sound source data may include a sound track.
The sound effect policy may include an effect parameter for indicating a manner of performing sound effect processing on the sound source data, where the sound effect processing may refer to a processing operation of editing a sound effect of the sound source data. In some embodiments, the effect parameter may include a response value corresponding to at least one frequency band, thereby indicating that the sound of the at least one frequency band in the audio source data is to be gained or suppressed. In some embodiments, the at least one frequency band may include at least one of 31 hz, 62 hz, 125 hz, 250 hz, 500 hz, 1 khz, 2 khz, 4 khz, 8 khz, and 16 khz. Of course, in practical application, the number of the at least one frequency band and the width of each frequency band may be determined according to the requirement of the practical sound effect processing, and the dividing manner of the at least one frequency band is not specifically limited in the embodiment of the present application.
In the embodiment of the application, since the scene of playing the audio of the first application program can be fixed or regular, the electronic device can acquire the first sound source data based on the first application program, respectively acquire the first sound effect strategies corresponding to the first application program, perform sound effect processing on the first sound source data of the first application program according to the first sound effect strategies, and play the audio based on the second sound source data obtained by the sound effect processing, thereby ensuring that the sound effect processing requirements of the first sound effect strategies and the first sound source data are matched, improving the optimizing effect on the sound source data, and meeting the differentiated requirements of users.
Optionally, the method further comprises:
the electronic equipment acquires third sound source data based on a second application program;
the electronic device plays audio based on the second sound source data, including:
the electronic equipment performs sound mixing processing on the second sound source data and the third sound source data to obtain mixed sound source data;
the electronic device plays audio based on the mixed sound source data.
The second application program may be any application program in the electronic device, and the third sound source data may be sound source data generated by the second application program. In some embodiments, the second application and the first application may be the same application. For example, the first sound source data may be background music of the game 1, and the third sound source data may be a voice call of the instant messaging 1; alternatively, the first sound source data may be background music of the game 1, and the third sound source data may be special sound effects such as footstep sound and gunshot sound in the game 1.
Note that, the mixing processing may include mixing the audio tracks of more than one audio source data to obtain mixed audio source data of one single audio track.
Optionally, before the electronic device plays the audio based on the second audio source data, the method further comprises:
The electronic equipment acquires a second sound effect strategy corresponding to the second application program;
the electronic equipment performs sound effect processing on the third sound source data based on the second sound effect strategy to obtain fourth sound source data;
the electronic device performs audio mixing processing on the second audio data and the third audio data to obtain mixed audio data, including:
and the electronic equipment performs sound mixing processing on the second sound source data and the fourth sound source data to obtain mixed sound source data.
It should be noted that, if the second application program is the same as the first application program, and the electronic device obtains the first sound effect policy and the second sound effect policy from the corresponding relationship between the application identifier and the sound effect policy based on the application identifier of the first application program (or the second application program), the first sound effect policy and the second sound effect policy may be the same, that is, the electronic device may use the same sound effect processing manner for different sound source data of the same application program, and the sound source types of the different sound source data may be the same or different. If the second application program is the same as the first application program and the electronic device is an application identifier of the first application program and an application identifier of the second application program respectively, and the first sound effect strategy and the second sound effect strategy are obtained from the application identifier and the corresponding relation between the sound source type and the sound effect strategy, the first sound effect strategy and the second sound effect strategy can be different, that is, the electronic device can respectively adopt corresponding sound effect processing modes for different sound source data of the same application program according to the sound source type of each sound source data, so that the sound effect processing modes can be more in accordance with the playing scene of the sound source data, and the sound effect processing effect is further improved.
The electronic equipment can acquire at least one sound source data based on at least one application program, acquire sound effect strategies corresponding to the application programs respectively, and perform sound effect processing on the sound source data of the application programs according to the sound effect strategies. On the other hand, the sound effect strategy corresponding to one application program in at least one application program can not influence the sound effect processing process of the sound source data of other application programs, and the electronic equipment can accurately acquire the sound effect strategy for processing the sound effect of each sound source data no matter how many sound source data are acquired by the electronic equipment and process the sound effect of the sound source data based on the sound effect strategy. Therefore, when the audio is mixed and played based on the audio source data after the audio effect processing, the method can fully adapt to the playing requirement under the complex scene, and better playing effect and user experience are provided.
Optionally, the electronic device obtains a first sound effect policy corresponding to the first application program, including:
The electronic device obtains the first sound effect strategy based on the application identification of the first application program.
The application identifier may include at least one of an application packet name, an application process identifier (process identifier, PID), an application User Identifier (UID), and the like. The application package name may be set by a developer of the application. The application PID is used for identifying the process of the application program, the application UID can be distributed by the electronic equipment when the application program runs, and when the application program rerun, the electronic equipment can distribute a new application PID to the application program; the application UID is used to identify the user that initiated the application, but since each application may have an application UID, the UID may also be used to distinguish between different applications.
Optionally, the electronic device obtains the first sound effect policy based on the application identifier of the first application program, including any one of the following:
the electronic equipment acquires the first sound effect strategy from the corresponding relation between the application UID and the sound effect strategy based on the application UID of the first application program;
and the electronic equipment acquires the first sound effect strategy from the corresponding relation between the application PID and the sound effect strategy based on the application PID of the first application program.
Optionally, the electronic device obtains the first sound effect policy based on the application identifier of the first application program, including:
the electronic device obtains the first sound effect strategy based on the application identifier of the first application program and the sound source type of the first sound source data.
In some embodiments, the electronic device may obtain the first sound effect policy from a correspondence between the application UID, the sound source type, and the sound effect policy based on the application UID of the first application program and the sound source type of the first sound source data; or, the electronic device may acquire the first sound effect policy from a correspondence between the application PID, the sound source type, and the sound effect policy based on the application PID of the first application program and the sound source type of the first sound source data.
Optionally, the electronic device obtains the first sound effect policy based on the application identifier of the first application program and the sound source type of the first sound source data, including:
if the electronic equipment determines that each first sound effect enhancement condition in at least one first sound effect enhancement condition is met, the electronic equipment acquires the first sound effect strategy based on the application identification of the first application program and the sound source type of the first sound source data;
Wherein the at least one first sound enhancement condition includes one or more of: the sound effect enhancement function of the electronic equipment is in an on state; the application identifier of the first application program belongs to a first white list; the first application program and the second application program are the same application program; one of the first sound source data and the third sound source data is of a media stream type and the other of the first sound source data and the third sound source data is of a call stream type.
The sound enhancement function includes processing sound source data based on the application and the sound source type of the sound source data. The electronic equipment can automatically control whether to carry out sound effect enhancement on sound source data by providing the switch with the sound effect enhancement function, so as to provide diversified and controllable audio playing experience for the user and fully meet the user requirements.
The first whitelist may be an audio enhancement whitelist, and the audio enhancement whitelist may include application identifiers of at least one application program. The sound effect enhancement white list can enable the electronic equipment to rapidly and accurately enhance the sound effect of the sound source data of a specific application program or not, and improves the efficiency of playing the audio.
When the first application program and the second application program are the same application program, the first sound source data and the third sound source data are sound source data generated by the same application program, and the sound source types of the two sound source data may be different, for example, one sound source type is a media stream type, and the other is a call stream type, so that the electronic device can provide finer sound effect processing modes for the two sound source data respectively. When the sound source type of the first sound source data is different from the sound source type of the third sound source data, that is, when there are a plurality of sound source types of sound source data concurrent, the electronic device can provide corresponding sound effect processing modes for the sound source data of various sound source types respectively.
Similarly, the electronic device may obtain the second sound effect policy based on the application identifier of the second application program.
Optionally, the electronic device obtains the second sound effect policy based on the application identifier of the second application program, including any one of the following:
the electronic equipment acquires the second sound effect strategy from the corresponding relation between the application UID and the sound effect strategy based on the application user identification UID of the second application program;
And the electronic equipment acquires the second sound effect strategy from the corresponding relation between the application PID and the sound effect strategy based on the application process identification PID of the second application program.
Optionally, the electronic device obtains the second sound effect policy based on the application identifier of the second application program, including:
and the electronic equipment acquires the second sound effect strategy based on the application identifier of the second application program and the sound source type of the third sound source data.
Optionally, the electronic device obtains the second sound effect policy based on the application identifier of the second application program and the sound source type of the third sound source data, including:
if the electronic equipment determines that each second sound effect enhancement condition in at least one second sound effect enhancement condition is met, the electronic equipment acquires the second sound effect strategy based on the application identification of the second application program and the sound source type of the third sound source data;
wherein the at least one second sound enhancement condition includes one or more of: the sound effect enhancement function of the electronic equipment is in an on state; the application identifier of the second application program belongs to a first white list; the first application program and the second application program are the same application program; one of the first sound source data and the third sound source data is of a media stream type and the other of the first sound source data and the third sound source data is of a call stream type.
In some embodiments, the audio source type of one of the first audio source data and the third audio source data in the at least one first audio enhancement condition and the at least one second audio enhancement condition is a media stream type and the audio source type of the other is a call stream type may be replaced by: the sound source type of the first sound source data is different from the sound source type of the third sound source data.
Optionally, before the electronic device performs the audio mixing processing on the second audio source data and the third audio source data to obtain mixed audio source data, the method includes:
if the electronic equipment determines that each first sound effect enhancement condition in the at least one first sound effect enhancement condition is met, the electronic equipment independently sets the volume of the first sound source data and the volume of the third sound source data;
and if the electronic equipment determines that one or more first sound effect enhancement conditions in the at least one first sound effect enhancement condition are not met, the electronic equipment performs volume processing on the first sound source data and the third sound source data, so that the volume of the first sound source data after processing is smaller than the volume of the third sound source data after processing.
The sound source type of the first sound source data may be a media stream type, and the sound source type of the third sound source data may be a call stream type. When the electronic equipment independently sets the volume of the first sound source data and the volume of the third sound source data, the user can freely adjust the volume of each sound source data, the individual differences such as habits and preferences of the user can be met, and the playing effect is further improved. When the electronic device makes the volume of the first sound source data after processing smaller than the volume of the second sound source data after processing, the playing effect of a certain sound source data can be preferentially ensured.
In some embodiments, if the electronic device determines that one or more of the at least one first sound effect enhancement conditions are not met, when the electronic device receives a call flow volume submitted by a user, the first volume may be set as a volume threshold of a media flow volume, where the first volume may be less than or equal to the call flow volume.
For example, when the media stream type and the call stream type of sound source data are not concurrent, the volume of the media stream type of sound source data may be 80% of the maximum volume, and the volume of the call stream type of sound source data may be 20% of the maximum volume. When the audio data of the media stream type and the call stream type are not concurrent, if the electronic device adopts the second volume policy to perform volume processing, the volume of the audio data of the media stream type cannot be greater than or equal to 20% of the maximum volume, and the volume of the audio data of the call stream type can be 20% of the maximum volume, that is, the volume of the audio data of the media stream type is smaller than the volume of the audio data of the call stream type. When the audio data of the media stream type and the call stream type are not concurrent, if the electronic device adopts the first volume policy to perform volume processing, the volume of the audio data of the media stream type may still be 80% of the maximum volume, and the volume of the audio data of the call stream type may be 20% of the maximum volume, that is, the volume of the audio data of the media stream type and the volume of the audio data of the call stream type are not interfered with each other.
The electronic device may perform sound effect processing on the acquired sound source data and then perform sound volume processing, or may perform sound volume processing on the acquired sound source data and then perform sound effect processing. Taking the example that the at least one sound source data acquired by the electronic device includes first sound source data, the electronic device may perform volume processing on the first sound source data first, and then perform sound effect processing on the first sound source data after the volume processing, so as to obtain second sound source data. Or the electronic device may perform sound effect processing on the first sound source data to obtain second sound source data, and then perform volume processing on the second sound source data.
Optionally, the method further comprises:
when the electronic device determines that the sound effect enhancement function of the electronic device is in an on state, the first application program and the second application program are the same application program, one of the first sound source data and the third sound source data is of a media stream type, and the other sound source type is of a call stream type, if the electronic device receives a sound effect enhancement on operation based on the first application program, the electronic device adds an application identifier of the first application program to the first whitelist.
Wherein, the sound source type of one of the first sound source data and the third sound source data is a media stream type and the sound source type of the other is a call stream type, which can be replaced by: the sound source type of the first sound source data is different from the sound source type of the third sound source data.
The electronic device can determine whether the sound effect enhancement function is effective for the first application program or not subjectively by the user under the condition that the sound source type of one of the first sound source data and the third sound source data is a call flow type and the sound source type of the other one is a media flow type and the first application program and the second application program are the same application program, so that the flexibility of whether the sound effect enhancement is performed for the first application program or not is further improved.
Optionally, the electronic device obtains a first sound effect policy corresponding to the first application program, including:
if the electronic equipment determines that the self-defined sound effect function of the electronic equipment is started and the second white list comprises the application identifier of the first application program, the electronic equipment acquires the first sound effect strategy corresponding to the first application program; or if the electronic equipment determines that the custom sound effect function of the electronic equipment is started, the electronic equipment acquires the first sound effect strategy corresponding to the first application program; or if the electronic device determines that the second white list includes the application identifier of the first application program, the electronic device acquires the first sound effect policy corresponding to the first application program.
The custom sound effect function comprises processing sound source data of an application program based on the application program. The first sound source data is processed, for example, based on the first application. In some embodiments, the electronic device sets the custom sound function to an on state if the electronic device receives a first preset operation submitted by a user. And if the electronic equipment receives a second preset operation submitted by the user, setting the self-defined sound effect function to be in a closed state. That is, the user can autonomously control the audio playing mode, that is, whether to respectively perform differentiated audio processing on the audio source data of different application programs according to different factors such as the application programs, so as to provide diversified and controllable audio playing experience for the user, and fully meet the user requirements.
The second whitelist may be a custom sound whitelist, and the custom sound whitelist may include application identifiers of at least one application program. The electronic equipment can rapidly and accurately determine whether to acquire a corresponding sound effect strategy based on a certain application program through the custom sound effect white list so as to perform sound effect processing on the sound source data of the application program, thereby improving the efficiency of being capable of audio frequency. And the user can also control whether the self-defined sound effect function is effective for the application program by adding the application identifier of a certain application program to the self-defined sound effect white list or deleting the application identifier from the self-defined white list, namely, the user can be provided with diversified and controllable audio playing experience.
In some embodiments, the custom sound effect white list includes application package names of at least one application program and file identifications of corresponding sound effect files, and a sound effect policy may be included in the sound effect files. Taking the establishment of the corresponding relation between the application UID and the sound effect strategies as an example, the electronic equipment can load and analyze a preset custom sound effect white list to obtain the application package name of at least one application program and the file identification of the corresponding sound effect file, and each sound effect file can comprise one sound effect strategy. The electronic equipment acquires an application UID corresponding to the application package name of each application program in the at least one application program, and then establishes a corresponding relation between the application UID and the file identifier.
Optionally, the method further comprises:
if the electronic device determines that the self-defined sound effect function of the electronic device is closed, the application identifier of the first application program is not included in the second white list, or the electronic device does not acquire the first sound effect strategy, the electronic device acquires a preset third sound effect strategy;
the electronic equipment performs sound effect processing on the first sound source data based on the third sound effect strategy to obtain fifth sound source data;
The electronic device plays audio based on the fifth sound source data.
Similarly, if the electronic device determines that the custom sound function of the electronic device is closed, the second white list does not include the application identifier of the first application program, or the second sound policy is not acquired, the stored fifth sound policy may be acquired, and sound processing is performed on the third sound source data based on the fifth sound policy, so as to obtain sixth sound source data.
The third sound effect strategy and the fifth sound effect strategy can be used for performing sound effect processing on the sound source data of the application program when the electronic equipment cannot determine the corresponding sound effect strategy based on the application program or is configured to not determine the corresponding sound effect strategy based on the application program, so that the reliability of processing the sound source data is ensured.
It should be noted that the third sound effect policy and the fifth sound effect policy may be the same.
Optionally, the method further comprises:
the electronic equipment updates the third sound effect strategy to obtain a fourth sound effect strategy;
the electronic device establishes a correspondence between the first application program and the fourth sound effect strategy.
In some embodiments, the electronic device may update the first sound effect policy.
In some embodiments, the electronic device may obtain a first sound effect policy corresponding to the first application upon detecting that the sound effect policy customization function is triggered. And if so, displaying the first sound effect strategy to the user, and updating the first sound effect strategy based on the first setting operation of the user. And if not, displaying the third sound effect strategy to the user, and updating the third sound effect strategy based on the second setting operation of the user to obtain a fourth sound effect strategy. That is, the electronic device can provide the audio policy customizing function for different users, thereby meeting personalized playing requirements and further improving the audio playing effect and user experience. And because the updated first sound effect data or fourth sound effect strategy corresponds to the first application program, the sound effect processing process of the sound source data of other application programs is not influenced, and the playing requirement of the complex scene can be met.
In some embodiments, the electronic device may not perform audio processing on part or all of the audio data before performing the mixing processing on the audio data, so the electronic device may perform audio processing on the mixed audio data through a preset sixth audio policy before playing audio based on the mixed audio data, and accordingly, the electronic device may play audio based on the mixed audio data after the audio processing, thereby further improving the audio playing effect.
In a second aspect, embodiments of the present application provide an apparatus for playing audio, where the apparatus may be provided in an electronic device, and the apparatus is capable of implementing a method according to any one of the first aspects.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor, the memory for storing a computer program; the processor is configured to perform the method of any of the above first aspects when the computer program is invoked.
In a fourth aspect, embodiments of the present application provide a chip system comprising a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the method of any one of the first aspects.
The chip system can be a single chip or a chip module formed by a plurality of chips.
In a fifth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method according to any one of the first aspects.
In a sixth aspect, embodiments of the present application provide a computer program product for, when run on an electronic device, causing the electronic device to perform the method of any one of the first aspects.
It will be appreciated that the advantages of the second to sixth aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 2 is a software structural block diagram of an electronic device according to an embodiment of the present application;
fig. 3 is a flowchart of a method for playing audio according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a method for initializing an audio service according to an embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a method for determining an audio policy according to an embodiment of the present disclosure;
fig. 6 is a flowchart of another method for playing audio according to an embodiment of the present application;
fig. 7 is a schematic diagram of a sound setting menu according to an embodiment of the present application;
FIG. 8 is a schematic diagram of an application display interface according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
FIG. 10 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
FIG. 11 is a flowchart illustrating a method for audio processing according to an embodiment of the present disclosure;
FIG. 12 is a flowchart illustrating another method for audio processing according to an embodiment of the present disclosure;
FIG. 13 is a flowchart illustrating another method for audio processing according to an embodiment of the present disclosure;
FIG. 14 is a flowchart illustrating another method for audio processing according to an embodiment of the present disclosure;
fig. 15 is a flowchart of a method for setting an audio policy according to an embodiment of the present application;
FIG. 16 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
FIG. 17 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
FIG. 18 is a schematic diagram of another application display interface provided in an embodiment of the present application;
FIG. 19 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
FIG. 20 is a flowchart illustrating another method for playing audio according to an embodiment of the present disclosure;
FIG. 21 is a schematic diagram of another application display interface according to an embodiment of the present disclosure;
fig. 22 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
Detailed Description
The method for playing audio provided by the embodiment of the application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (augmented reality, AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA), embedded devices and the like, and the embodiment of the application does not limit the specific types of the electronic devices.
Fig. 1 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application. Electronic device 100 may include a processor 110, memory 120, and audio module 160, among other things.
Processor 110 may include one or more processing units, among other things, and memory 120 is used to store program codes and data. In the embodiment of the present application, the processor 110 may execute computer-executable instructions stored in the memory 120 for controlling and managing the actions of the electronic device 100.
Alternatively, the memory 120 may include at least one of a Double Data Rate (DDR) memory and an embedded multimedia controller (embedded multimedia card, eMMC).
The audio module 160 may be provided on a sound card. The audio module 160 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 160 may also be used to encode and decode audio signals. In some embodiments, the audio module 160 may be disposed in the processor 110, or some functional modules of the audio module 160 may be disposed in the processor 160.
Optionally, the electronic device 110 further comprises a speaker 161, a receiver 162, a microphone 163, and an earphone interface 164. The electronic device 100 may implement audio functions through an audio module 160, a speaker 161, a receiver 162, a microphone 163, an ear-headphone interface 164, an application processor, and the like. Such as music playing, recording, etc.
The speaker 161, also called "horn", is used to convert an audio electrical signal into a sound signal. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 161.
A receiver 162, also known as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be heard by placing receiver 162 in close proximity to the human ear.
A microphone 163, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 163 through the mouth, inputting a sound signal to the microphone 163. The electronic device 100 may be provided with at least one microphone 163. In other embodiments, the electronic device 100 may be provided with two microphones 163, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 163 to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 164 is used to connect a wired earphone. The earphone interface 164 may be a USB interface or a 3.5mm open mobile electronic device platform (open mobile terminalplatform, OMTP) standard interface, a american cellular telecommunications industry association (cellulartelecommunications industry association of the USA, CTIA) standard interface.
Optionally, the electronic device 100 comprises a communication module 130. The communication module 130 may be used for communication between various internal modules of the electronic device 100, communication between the electronic device 100 and other external electronic devices, or the like. By way of example, if the electronic device 100 communicates with other electronic devices by way of a wired connection, the communication module 130 may include an interface, such as a USB interface, which may be an interface conforming to the USB standard specification, specifically, a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface may be used to connect a charger to charge the electronic device 200, or may be used to transfer data between the electronic device 200 and a peripheral device. The interface may also be used to connect other electronic devices, such as AR devices, etc.
Alternatively, the communication module 130 may include a radio frequency circuit, a bluetooth chip, a wireless fidelity (Wi-Fi) chip, a near-field communication (NFC) module, etc., and interaction between the electronic device 100 and other electronic devices may be implemented in a variety of different manners.
Optionally, the electronic device 100 may further include a display screen 140, where the display screen 140 may display images or videos in a human-machine interaction interface, and so on.
Optionally, the electronic device 100 may also include a peripheral device 150, such as a mouse, keyboard, speaker, microphone, etc.
It should be understood that the structure of the electronic device 100 is not particularly limited in the embodiments of the present application, except for the various components or modules listed in fig. 1. In other embodiments of the present application, electronic device 100 may also include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application exemplifies a layered architecture in an android system, and illustrates a software structure of the electronic device 100.
Fig. 2 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the architecture may include three layers, from top to bottom, an application layer, an application framework layer, and a driver layer, respectively.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications capable of generating audio data for calls, games, music, videos, instant messaging, and the like. Of course, in practical applications, the application layer may also include other applications, such as map, navigation, bluetooth, and so on.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions.
As shown in fig. 2, the application framework layer may include a system server (system server) module, an application package management service (package manager service) module, an audio server (audio server) module, and an audio service (audio service) module.
The system server module is a core service module in an android system, and can be used for initializing various service (service) modules and service manager modules in an application framework layer and can also call various services. In some embodiments, the android system may start up and load the system server module at power-on, and the system server module may load a system service module such as an audio service (audio service) module.
The application package management service module may manage data related to the application. For example, the application package management service module may obtain information such as an application identifier of the application program. Wherein the application identification may include at least one of an application packet name, an application PID, an application ID, and the like. The application package name may be set by a developer of the application. The application PID is used for identifying the process of the application program, the application UID can be distributed by the electronic equipment when the application program runs, and when the application program rerun, the electronic equipment can distribute a new application PID to the application program; the application UID is used to identify the user that initiated the application, but since each application may have an application UID, the UID may also be used to distinguish between different applications.
The audio service module may include an audio whitelist management module. The sound effect white list management module can load and analyze a stored self-defined sound effect white list, and the self-defined sound effect white list can comprise application identifiers of at least one application program. In some embodiments, if the application identifier of any application belongs to the custom sound effect white list, the electronic device 100 may perform specific processing on the sound effect of the sound source data of the application based on the sound effect policy corresponding to the application. In some embodiments, the sound effect white list management module may load and parse a stored sound effect enhancement white list, where the sound effect enhancement white list may include an application identifier of at least one application, and if the application identifier of a certain application belongs to the sound effect enhancement white list, the electronic device may perform a specific process on at least one of the sound source data when the sound source data of the application includes sound source data of a call flow type and sound source data of other types (such as a media flow type).
In some embodiments, the audio service module may establish a correspondence between the application identifier and the sound effect policy through the application package management module.
The audio server module may be disposed on the audio module 160, including an audio effect processing module, a volume processing module, and an audio policy module. The audio policy module may determine an audio policy to employ for audio processing for the audio data. The sound effect processing module can load the sound effect strategy determined by the audio strategy module and process sound effect on the sound source data. The volume processing module may perform volume processing on the sound source data, including increasing or decreasing the volume when playing audio based on the sound source data.
The audio driving module can drive the audio playing device to play audio based on the audio source data processed by the application framework layer.
The workflow of the electronic device 100 software and hardware is illustrated below in connection with the scenario of playing music.
The processor 110 runs a certain music application of the application layer and generates sound source data. The audio module 160 obtains the sound source data, and performs sound effect processing and/or volume processing on the sound source data to obtain processed sound source data. The audio driving module of the driving layer drives the speaker 161 to play audio based on the processed sound source data.
In order to facilitate understanding of the technical solutions in the embodiments of the present application, the application scenario of the embodiments of the present application will be described first.
From the foregoing, it is known that various applications capable of generating audio data, such as games, music, video, and calls, may be included in the electronic device, and the electronic device may acquire the audio data to play audio. However, with the continuous development of terminal technology, users also want electronic devices to improve the playing effect on the basis of playing audio, so the problem of how to provide users with a better sound experience is receiving attention.
In some embodiments, a plurality of sound effect strategies for different play scenes may be preset in the electronic device, and a user may select one of the plurality of sound effect strategies. When the electronic device obtains any first sound source data to be played, sound effect processing can be performed on the first sound source data based on the sound effect strategy selected by the user, and second sound source data are obtained. The electronic device can then play audio based on the second sound source data.
However, it will be understood that the electronic device may acquire sound source data of different application programs, and the sound source data generated by different application programs may correspond to different audio playing scenes, so that there are different requirements for sound effect processing, for example, the game may highlight sound effects of special effects of various game props and background music, and the conversation needs to suppress noise except human voice. In the above embodiment, although the electronic device presets multiple sound effect policies, when processing sound effect data, the sound effect policies can only be processed according to a fixed sound effect policy selected by a user in advance, and the different requirements of the user cannot be met. That is, the manner of playing audio provided by the above embodiment may result in poor optimizing effect on the audio data, and is difficult to adapt to different playing requirements under different scenes, and thus is difficult to effectively improve the user experience of playing audio.
In order to at least partially solve the above technical problems, another method for playing audio is provided in an embodiment of the present application. In the embodiment of the application, since the scene of playing the audio of the first application program can be fixed or regular, the electronic device can acquire the first sound source data based on the first application program, respectively acquire the first sound effect strategies corresponding to the first application program, perform sound effect processing on the first sound source data of the first application program according to the first sound effect strategies, and play the audio based on the second sound source data obtained by the sound effect processing, thereby ensuring that the sound effect processing requirements of the first sound effect strategies and the first sound source data are matched, improving the optimizing effect on the sound source data, and meeting the differentiated requirements of users.
The technical scheme of the present application is described in detail below with specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
The sound effect enhancement white list may be a first white list, and the custom sound effect white list may be a second white list.
Referring to fig. 3, a flowchart of a method for playing audio according to an embodiment of the present application is provided. It should be noted that the method is not limited by the specific order shown in fig. 3 and described below, and it should be understood that, in other embodiments, the order of some steps in the method may be interchanged according to actual needs, or some steps in the method may be omitted or deleted. The method comprises the following steps:
S301, initializing an audio service by the electronic equipment.
In order to enable the electronic equipment to accurately adopt different sound effect strategies for sound effect processing aiming at different sound source data in the subsequent audio playing process, the electronic equipment can initialize sound effect services.
The audio source data is data generated by an application program in the electronic device and can be used for playing audio, wherein one audio source data can comprise one audio track. The audio source type of the audio source data may include various types such as media stream, call stream, and system prompt. Wherein, the audio source data of the media stream type can be generated by the application program when playing the multimedia content, such as background sound in the game application and audio in the movie played by the video application; the call flow type audio source data may be generated by an application program when the electronic device establishes a voice or video call with another electronic device; the system prompt type sound source data may be generated by an application program when prompting a user, such as a telephone ring, a short message ring, a power-on ring, a lock screen ring, a touch prompt, and so on. Of course, in practical applications, the audio source types of the audio source data may also include more types, and the embodiment of the present application does not specifically limit the types or the division basis of the audio source types.
The sound effect policy may include an effect parameter for indicating a manner of performing sound effect processing on the sound source data, where the sound effect processing may refer to a processing operation of editing a sound effect of the sound source data. In some embodiments, the effect parameter may include a response value corresponding to at least one frequency band, thereby indicating that the sound of the at least one frequency band in the audio source data is to be gained or suppressed. In some embodiments, the at least one frequency band may include at least one of 31 hz, 62 hz, 125 hz, 250 hz, 500 hz, 1 khz, 2 khz, 4 khz, 8 khz, and 16 khz. Of course, in practical application, the number of the at least one frequency band and the width of each frequency band may be determined according to the requirement of the practical sound effect processing, and the dividing manner of the at least one frequency band is not specifically limited in the embodiment of the present application.
In some embodiments, the electronic device may obtain a correspondence between the application identification and the sound effect policy. That is, each application program may correspond to one sound effect policy, so that the electronic device may perform different sound effect processing on the sound source data of each application program accurately.
Taking the establishment of the corresponding relation between the application UID and the sound effect strategies as an example, the electronic equipment can load and analyze a preset custom sound effect white list to obtain the application package name of at least one application program and the file identification of the corresponding sound effect file, and each sound effect file can comprise one sound effect strategy. The electronic equipment acquires an application UID corresponding to the application package name of each application program in the at least one application program, and then establishes a corresponding relation between the application UID and the file identifier.
For example, a preset custom sound effect white list in the electronic device is "whistelist. Xml", and at least one sound effect file is "effective d0.xml", "effective d1.xml", "effective d2.xml", "effective d3.xml", and "effective d4.xml", etc. The "whistelist. Xml" may include 4 applications such as "HW music", "HW video", "game 1" and "game 2", for example, where an application package of the application is named "com. Music", and a file identifier of a corresponding sound effect file is 1, that is, the sound effect file is "effective 1.Xml". In addition, "effected0.xml" may be a default sound effect policy, and when the electronic device cannot determine the corresponding sound effect policy based on the application program or is configured to not determine the corresponding sound effect policy based on the application program, the electronic device may directly perform sound effect processing on the sound source data through the default sound effect policy.
<resources>
<whiteapp
name= "HW music"
package=“com.HW.music”
effected=1>
<whiteapp
name= "HW video"
package=“com.HW.himovie”
effected=2>
<whiteapp
name= "Game 1"
package=“com.game1.music”
effected=3>
<whiteapp
name= "Game 2"
package=“com.game2.music”
effected=4>
</resources>
It should be noted that the custom sound white list and at least one sound file may be stored in a first preset storage location. For example, the location where "whistelist. Xml" is stored may be/odm/etc/audioeffect/whistelist. Xml.
It should be further noted that, the electronic device may acquire the custom sound effect white list in advance, for example, the electronic device may receive the custom sound effect white list transmitted by other devices, or may receive the custom sound effect white list submitted by the user or related technicians. And in some embodiments, the custom sound white list may include application identifications (e.g., application package names and application names) of at least one application program; in other embodiments, the custom audio white list may include application identifiers of at least one application program and audio policies (e.g., file identifiers of audio files) corresponding to each application program.
In some embodiments, the electronic device may obtain the application program and the correspondence between the sound source types and the sound effect policies, so that the electronic device accurately provides different sound effect processing modes for the sound source data of different sound source types in the same application program.
Taking an android system as an example, the manner in which the electronic device initializes the audio service may be as shown in fig. 4 below.
In some embodiments, the electronic device may load and parse the audio enhancement white list to obtain application package names of at least one application program, and determine an application UID and/or an application PID corresponding to the application package name of each application program in the at least one application program.
It should be noted that, the manner of acquiring the sound effect enhancement white list by the electronic device may be similar to the manner of acquiring the custom sound effect white list. And the sound effect enhancement white list can be stored in a second preset storage position. For example, the file identifier of the sound effect enhancement white list may be "audio_effect. Xml", and the storage location may be/odm/etc/audio effect/audio_effect.
It should be noted that, the electronic device may determine the application program and the corresponding relationship between the sound source type and the sound effect policy by initializing the sound effect service in S301, so as to facilitate the electronic device to obtain the corresponding sound effect policy when performing the sound effect processing. In practical application, the electronic device may execute the operation of initializing the sound effect service in S301 at other occasions; alternatively, the electronic device may determine the sound effect policy in other manners, and accordingly, the operation of initializing the sound effect service in S301 may be omitted.
S302, the electronic equipment acquires at least one sound source data based on at least one application program.
The electronic device may start at least one application program and create a sound track corresponding to each application program in the at least one application program, thereby obtaining sound source data of the application program. And it should be noted that each application may generate one or more audio source data.
In some embodiments, the at least one application may include a first application, and the at least one sound source data may include first sound source data generated by the first application. In some embodiments, the at least one application further comprises a second application, and the at least one sound source data further comprises third sound source data generated by the second application. For example, the first sound source data may be background music of the game 1, and the third sound source data may be a voice call of the instant communication 1.
The first application program and the second application program can be any application program in the electronic device. In some embodiments, the first application and the second application may be the same application. For example, the first sound source data may be background music of the game 1, and the third sound source data may be special sound effects such as footstep sounds and gunshot sounds in the game 1.
S303, the electronic equipment performs sound effect processing on the sound source data of each application program based on the sound effect strategy corresponding to each application program.
Because the sound source data generated by different application programs may correspond to different audio playing scenes, the electronic device can respectively acquire the sound effect strategies corresponding to the application programs, and the sound effect strategies can indicate the mode of performing sound effect processing on the sound source data, so that the sound effect processing is performed on the sound source data of the application programs according to the sound effect strategies, namely, the sound effect processing mode can be ensured to be matched with the audio playing scenes corresponding to the sound source data, and the optimizing effect on the sound source data is improved. And the sound effect strategy corresponding to one application program in the at least one application program can not influence the sound effect processing process of the sound source data of other application programs, no matter how many sound source data are acquired by the electronic equipment, the electronic equipment can accurately acquire the sound effect strategy for performing sound effect processing on each sound source data, and the sound effect processing is performed on the sound source data based on the sound effect strategy, so that the playing requirement under a complex scene can be fully adapted, and the user experience is effectively improved.
In some embodiments, if the at least one application includes a first application and the at least one sound source data includes first sound source data, the electronic device may acquire a first sound effect policy corresponding to the first application, and perform sound effect processing on the first sound source data based on the first sound effect policy to obtain second sound source data.
The electronic device may obtain the first sound effect policy from a correspondence between the application identifier and the sound effect policy based on the application identifier of the first application program. In some embodiments, the electronic device may obtain the first sound effect policy from a correspondence between the application UID and the sound effect policy based on the application UID of the first application program; or, the electronic device may obtain the first sound effect policy from a correspondence between the application PID and the sound effect policy based on the application PID of the first application program. Or, the electronic device may acquire the first sound effect policy from the application identifier and the correspondence between the sound source type and the sound effect policy based on the application identifier of the first application program and the sound source type of the first sound source data. In some embodiments, the electronic device may obtain the first sound effect policy from a correspondence between the application UID, the sound source type, and the sound effect policy based on the application UID of the first application program and the sound source type of the first sound source data; or, the electronic device may acquire the first sound effect policy from a correspondence between the application PID, the sound source type, and the sound effect policy based on the application PID of the first application program and the sound source type of the first sound source data.
For example, as shown in fig. 5, if the electronic device acquires the sound source data of the game 1, the electronic device determines that the application UID of the game 1 is 50789 and the file identifier corresponding to the application UID50789 is 3, so that the electronic device acquires the sound effect file "effected3.xml" with the file identifier of 3 and performs sound effect processing on the sound source data based on the sound effect policy in the sound effect file.
In some embodiments, if the at least one application further includes a second application and the at least one sound source data further includes third sound source data, the electronic device may further obtain a second sound effect policy corresponding to the second application, and process the third sound source data based on the second sound effect policy to obtain fourth sound source data. The manner in which the electronic device obtains the second sound effect policy may be similar to the manner in which the first sound effect policy is obtained.
It should be noted that, if the second application program is the same as the first application program, and the electronic device obtains the first sound effect policy and the second sound effect policy from the corresponding relationship between the application identifier and the sound effect policy based on the application identifier of the first application program (or the second application program), the first sound effect policy and the second sound effect policy may be the same, that is, the electronic device may use the same sound effect processing manner for different sound source data of the same application program, and the sound source types of the different sound source data may be the same or different. If the second application program is the same as the first application program and the electronic device is an application identifier of the first application program and an application identifier of the second application program respectively, and the first sound effect strategy and the second sound effect strategy are obtained from the application identifier and the corresponding relation between the sound source type and the sound effect strategy, the first sound effect strategy and the second sound effect strategy can be different, that is, the electronic device can respectively adopt corresponding sound effect processing modes for different sound source data of the same application program according to the sound source type of each sound source data, so that the sound effect processing modes can be more in accordance with the playing scene of the sound source data, and the sound effect processing effect is further improved.
In some embodiments, the electronic device may also perform volume processing on the acquired sound source data, so that the volumes of at least one sound source data acquired after processing can be coordinated with each other, so as to achieve a good audio playing effect. It should be noted that, the electronic device may perform sound effect processing on the acquired sound source data before performing sound volume processing, or may perform sound volume processing on the acquired sound source data before performing sound effect processing.
Taking the example that the at least one sound source data acquired by the electronic device includes first sound source data, the electronic device may perform volume processing on the first sound source data first, and then perform sound effect processing on the first sound source data after the volume processing, so as to obtain second sound source data. Or the electronic device may perform sound effect processing on the first sound source data to obtain second sound source data, and then perform volume processing on the second sound source data.
S304, the electronic equipment performs sound mixing processing on at least one sound source data to obtain mixed sound source data.
If the electronic equipment acquires more than one sound source data after sound effect processing, the more than one sound source data can be subjected to sound mixing processing to obtain mixed sound source data; if the electronic device acquires one sound source data of the sound effect process, the mixing process of S304 is not required, but the audio may be played directly in S305 described below.
From the foregoing, it is understood that one audio data may include one audio track, and thus, in some embodiments, the electronic device may combine the audio tracks of more than one audio data to obtain a single-track mixed audio data. It is to be understood that the electronic device may also perform the mixing process by other mixing process methods, and the embodiment of the present application is not limited to the specific method of the mixing process.
S305, the electronic device plays audio based on the mixed sound source data.
The electronic device may control the audio driving module to drive the speaker to play audio based on the mixed sound source data.
In the embodiment of the application, because the audio playing scene of the same application program can be fixed or regular, the electronic device can acquire at least one sound source data based on at least one application program, respectively acquire sound effect strategies corresponding to each application program, and perform sound effect processing on the sound source data of the application program according to the sound effect strategies, on one hand, the sound effect processing mode can be ensured to be matched with the audio playing scene corresponding to the sound source data, the optimizing effect on the sound source data is improved, and the differentiated requirements of users are met. On the other hand, the sound effect strategy corresponding to one application program in at least one application program can not influence the sound effect processing process of the sound source data of other application programs, and the electronic equipment can accurately acquire the sound effect strategy for processing the sound effect of each sound source data no matter how many sound source data are acquired by the electronic equipment and process the sound effect of the sound source data based on the sound effect strategy. Therefore, when the audio is mixed and played based on the audio source data after the audio effect processing, the method can fully adapt to the playing requirement under the complex scene, and better playing effect and user experience are provided.
Referring to fig. 4, a flowchart of a method for initializing an audio service according to an embodiment of the present application is provided.
S401, starting up.
When the electronic device is started up, an operating system in the electronic device can start up a system server module.
S402, the system server module starts an audio service module.
S403, the audio service module analyzes a preset custom sound effect white list.
S404, the audio service module obtains the application package name of at least one application program from the application package management service module.
S405, the audio service module obtains an application UID of at least one application program based on the application package name of the at least one application program.
Through S405, the audio service module may determine an application package name of each application program and an application UID corresponding to each package name.
S406, the audio service module establishes a corresponding relation between the application UID and the sound effect strategy.
The audio service module may obtain a file identifier of an audio file corresponding to the application program from the custom audio white list based on an application package name of the application program, and then the application UID of the application program is stored corresponding to the file identifier.
S407, the audio service module sends the corresponding relation between the application UID and the sound effect strategy to the sound effect processing module.
In some embodiments, S407 may be omitted, that is, the audio service module may not actively send the corresponding relationship between the application UID and the sound effect policy to the sound effect processing module, but the sound effect processing module obtains the corresponding relationship between the application UID and the sound effect policy from the audio service module when the sound effect policy corresponding to a certain application program needs to be obtained.
Referring to fig. 6, a method for playing audio provided in the embodiments of the present application will be described below by taking a case where at least one audio data includes a first audio data and a second audio data as an example. The first sound source data are acquired by the electronic equipment based on the first application program, and the third sound source data are acquired by the electronic equipment based on the second application program. And it will be appreciated that the electronic device may play audio based on more audio source data in a similar manner.
S601, the electronic equipment acquires first sound source data and third sound source data.
The manner in which the electronic device performs S601 to obtain the first sound source data and the third sound source data may be similar to the manner in which S302 obtains at least one sound source data based on at least one application program, which is not described herein in detail.
S602, the electronic device judges whether the custom sound function is started. If yes, S603 and S604 are performed, otherwise S613 is performed.
In order to facilitate the control of the audio playing mode by the user, namely whether to perform differentiated sound effect processing on the sound source data of different application programs according to different factors such as application programs, diversified and controllable audio playing experience is provided for the user, so that the user requirements are fully met, and the electronic equipment can judge whether the custom sound effect function is started. If the custom sound function is in the on state, the electronic device may independently execute two branching steps of S603, S605, S607, S608, and S611, and S604, S606, S609, S610, and S612 described below, so as to perform corresponding sound processing on the first sound source data and the third sound source data based on the first application program and the second application program, respectively, otherwise, S613 may be executed.
The self-defining sound effect function comprises processing sound source data of an application program based on the application program. The first sound source data is processed, for example, based on the first application.
In some embodiments, the electronic device sets the custom sound function to an on state if the electronic device receives a first preset operation submitted by a user. And if the electronic equipment receives a second preset operation submitted by the user, setting the self-defined sound effect function to be in a closed state.
It should be noted that, the manner of the first preset operation or the second preset operation may be configured in advance by a related technician.
For example, the electronic device may provide a sound setting menu as shown in fig. 7, which includes a switching option of a custom sound effect function, and the first preset operation and the second preset operation may include a click operation. If the electronic equipment receives clicking operation of the user based on the switching option, the current switching state of the self-defined sound effect function is switched from the first state to the second state. Wherein, when the first state is on, the second state may be off; the second state may be on when the first state is off. In addition, as can be seen from fig. 7, the sound setting menu may further include setting options for more sounds, including a lock screen prompting sound, a touch prompting sound, a starting bell sound and an audio enhancement function, and the user may control the on or off states of the functions of the lock screen prompting sound, the touch prompting sound, the starting bell sound and the audio enhancement function in a manner of controlling the on or off of the custom audio function. And the starting bell is currently in the on state as shown by the sound setting menu in fig. 7, and the other 4 functions including the custom sound effect function are all in the off state.
S603, the electronic device judges whether the application identifier of the first application program belongs to a custom sound effect white list, if yes, S605 is executed, otherwise S613 is executed.
The electronic equipment can rapidly and accurately determine whether to acquire a corresponding sound effect strategy based on a certain application program through the custom sound effect white list so as to perform sound effect processing on the sound source data of the application program, thereby improving the efficiency of being capable of audio frequency. And the user can also control whether the custom sound effect function is effective for the application program by adding the application identifier of the application program to the custom sound effect white list or deleting the application identifier from the custom white list.
For example, the electronic device obtains the application package name of the inverted first application program as "com.game1.music", and the custom sound effect white list includes 4 application package names of "com.hw.music", "com.hw.himovie", "com.game1.music", and "com.game2.music", so the electronic device can determine that the application identifier of the first application program belongs to the custom sound effect white list.
In addition, the electronic device may execute S604 to determine whether the application identifier of the second application program is on the custom sound white list, if so, execute S606, otherwise execute S613. It should be noted that, the manner in which the electronic device performs S604 to determine whether the application identifier of the second application program is in the custom sound effect white list may be similar to the manner in which S603 is performed to determine whether the application identifier of the first application program is in the custom sound effect white list, which is not described in detail herein.
S605, the electronic device judges whether each first sound effect enhancement condition in the at least one first sound effect enhancement condition is met, if yes, S608 is executed, otherwise S607 is executed.
The sound effect enhancement function includes processing the sound source data based on the application program and the sound source type of the sound source data, for example, processing the first sound source data based on the first application program and the sound source type of the first sound source data, so that the electronic device can adopt different processing modes for the sound source data based on different sound source types of the acquired sound source data. The electronic device may determine whether each of the at least one first sound enhancement condition is currently satisfied, so as to determine whether to provide a more accurate and fine sound processing manner for the acquired sound source data.
In some embodiments, the at least one first sound enhancement condition may include one or more of: the first application program and the second application program are the same application program, the sound source type of the first sound source data is different from the sound source type of the third sound source data, the sound effect enhancement function is started, and the application identifier of the first application program belongs to a sound effect enhancement white list.
When the first application program and the second application program are the same application program, the first sound source data and the third sound source data are sound source data generated by the same application program, and the sound source types of the two sound source data may be different, for example, one sound source type is a media stream type, and the other sound source type is a call stream type, so that the electronic device can provide finer sound effect processing modes for the two sound source data respectively. When the sound source type of the first sound source data is different from the sound source type of the third sound source data, that is, when there are a plurality of sound source types of sound source data concurrent, the electronic device can provide corresponding sound effect processing modes for the sound source data of various sound source types respectively. The electronic equipment can automatically control whether to carry out sound effect enhancement on sound source data by providing the switch with the sound effect enhancement function, so as to provide diversified and controllable audio playing experience for the user and fully meet the user requirements. The sound effect enhancement white list can enable the electronic equipment to rapidly and accurately enhance the sound effect of the sound source data of a specific application program or not, and improves the efficiency of playing the audio.
In some embodiments, the sound source type of the first sound source data in the first sound effect enhancement condition is different from the sound source type of the third sound source data, and may be replaced by: one of the first sound source data and the third sound source data is of a call stream type, and the other is of a media stream type.
It should be noted that, when the electronic device determines whether each first sound effect enhancement condition of the at least one first sound effect enhancement condition is satisfied, the electronic device may sequentially perform the determination whether each first sound effect enhancement condition is satisfied, and the order in which the electronic device determines whether each first sound effect enhancement condition is satisfied in the embodiment of the present application is not limited.
For example, the electronic device may determine whether the first application program and the second application program are the same application program, if yes, determine whether one of the first audio source data and the second audio source data is of a call flow type, and if yes, determine whether the audio enhancement function is turned on, if yes, determine that the application identifier of the first application program belongs to an audio enhancement white list, and if yes, the electronic device determines that each first audio enhancement condition in at least one first audio enhancement condition is satisfied, thereby executing S608. If the electronic device determines that the first sound effect enhancement condition that is not satisfied currently exists in the above-mentioned determining process, S607 is executed, without determining whether other first sound effect enhancement conditions are satisfied.
In some embodiments, when the electronic device determines that the sound effect enhancement function is turned on and determines that the at least one first sound effect enhancement condition includes that one of the sound source type of the first sound source data and the third sound source data is a call flow type, and the other sound source type is a media flow type, and the first application program and the second application program are the same application program, if the electronic device receives the sound effect enhancement on operation based on the first application program, the electronic device may add the application identifier of the first application program to the sound effect enhancement whitelist.
The sound effect enhancement starting operation is used for enabling the sound effect enhancement function to be effective to the first application program. The manner in which the sound effect enhancement is operated may be determined in advance by the electronic device. In some embodiments, during the running of the first row of application program, if the electronic device is based on the clicking operation of the first volume key, a first sound control window as shown in fig. 8 may be displayed, where the first sound control window includes an audio enhancement state indication button, and the audio enhancement state indication button may indicate an audio enhancement state of the first application program. When the state displayed by the sound effect enhancement state indication button is "on", it is indicated that the sound effect enhancement function is active for the first application program. When the state displayed by the sound effect enhancement state indication button is "off", it indicates that the sound effect enhancement function is not effective for the first application program. If the electronic device receives a click operation based on the sound effect enhancement state indication button, the state displayed by the sound effect enhancement state indication button can be switched. In some embodiments, if the electronic device switches the state displayed by the sound enhancement state indication button from "off" to "on", the electronic device may add the application identification of the first application to the sound enhancement white list; if the electronic device switches the state displayed by the sound effect enhancement state indication button from "on" to "off", the electronic device may delete the application identifier of the first application program from the sound effect enhancement white list.
Further, fig. 9 and 10 may be referred to. Fig. 9 is a first sound control window displayed based on a click operation in the case where the electronic device turns off the sound enhancement function, and at least one first sound enhancement condition includes that one of the first sound source data and the third sound source data has a sound source type of a call flow type, and the other sound source type has a media flow type, and the first application program and the second application program are the same application program, based on a first volume key. Fig. 10 is a diagram showing a first sound control window displayed based on a first volume key click operation in a case where the electronic device detects only first sound source data of a media stream type with the sound effect enhancing function turned off. Or, fig. 10 is a schematic diagram of a first sound control window displayed by the electronic device according to the click operation based on the first volume key when the sound enhancement function is turned on and only the first sound source data of the media stream type is detected. Comparing fig. 8 with fig. 9 and fig. 10, it can be known that when determining that the sound effect enhancement function is turned on, and determining that at least one of the first sound effect enhancement conditions includes that one of the first sound source data and the third sound source data is of a call flow type, and the other of the first sound source data and the third sound source data is of a media flow type, the electronic device displays a sound effect enhancement status indication button, that is, when determining that the sound effect enhancement function can be turned on for the first application, the electronic device determines subjectively whether the sound effect enhancement function is effective for the first application, so as to further improve flexibility of whether the sound effect enhancement is performed for the first application.
In addition, the electronic device may execute S606 to determine whether each of the at least one second sound effect enhancement condition is satisfied, if so, execute S610, otherwise execute S609. It should be noted that, the manner in which the electronic device performs S606 to determine whether each of the at least one second sound effect enhancement condition is satisfied may be similar to the manner in which S605 determines whether each of the at least one first sound effect enhancement condition is satisfied, which is not described in detail herein.
Wherein the at least one second sound enhancement condition may include one or more of: the first application program and the second application program are the same application program, the sound source type of the first sound source data is different from the sound source type of the third sound source data, the sound effect enhancement function is started, and the application identifier of the second application program belongs to a sound effect enhancement white list. In some embodiments, the sound source type of the first sound source data in the second sound effect enhancement condition is different from the sound source type of the third sound source data, and may be replaced by: one of the first sound source data and the second sound source data is of a call stream type, and the other is of a media stream type.
S607, the electronic device obtains the first sound effect strategy based on the application identifier of the first application.
The electronic device can acquire a first sound effect strategy corresponding to the first application from the corresponding relation between the application identifier and the sound effect strategy through the application identifier of the first application.
For example, before the electronic device obtains the sound source data, the electronic device has determined the correspondence between the application UID (or the application PID) and the file identifier of the sound effect file by initializing the sound effect service, or, the electronic device may obtain the corresponding first file identifier based on the application UID (or the application PID) of the first application, and obtain the first sound effect file based on the first file identifier.
In addition, the electronic device may execute S609 to obtain the second sound effect policy based on the application identifier of the second application. It should be noted that, the manner in which the electronic device executes S609 to obtain the second sound effect policy based on the application identifier of the second application may be similar to the manner in which S607 obtains the first sound effect policy based on the application identifier of the first application, which is not described herein in detail.
S608, the electronic device acquires a first sound effect strategy based on the application identifier of the first application and the sound source type of the first sound source data.
In some embodiments, the electronic device may obtain, through an application identifier of the first application and a sound source type of the first sound source data, a first sound effect policy corresponding to the first application from the application identifier and a correspondence between the sound source type and the sound effect policy.
In addition, the electronic device may perform S610 to obtain the second sound effect policy based on the application identifier of the second application and the sound source type of the third sound source data. It should be noted that, the manner in which the electronic device executes S610 to obtain the second sound effect policy based on the application identifier of the second application and the sound source type of the third sound source data may be similar to the manner in which S608 obtains the first sound effect policy based on the application identifier of the first application and the sound source type of the first sound source data, which is not described in detail herein.
S611, the electronic device performs sound effect processing on the first sound source data based on the first sound effect strategy to obtain second sound source data.
In addition, the electronic device may execute S612 to perform an audio process on the third audio data based on the second audio policy, to obtain fourth audio data. It should be noted that, the manner in which the electronic device executes S612 to perform the audio processing on the third audio data based on the second audio policy to obtain the fourth audio data may be similar to the manner in which S611 performs the audio processing on the first audio data based on the first audio policy to obtain the second audio data, which is not described in detail herein.
In some embodiments, if the custom sound function is closed, the second whitelist does not include the application identifier of the first application program, or the electronic device does not acquire the first sound effect policy based on S607 or S608, the stored third sound effect policy may be acquired, and the sound effect processing is performed on the first sound source data based on the third sound effect policy, so as to obtain fifth sound source data, so that it is ensured that the sound effect processing can be performed on the first sound source data. Similarly, if the custom sound function is closed, the second whitelist does not include the application identifier of the second application program, or the electronic device does not acquire the second sound effect policy through S609 or S610, the stored fifth sound effect policy may be acquired, and sound effect processing is performed on the third sound source data based on the fifth sound effect policy, so as to obtain sixth sound source data. The third sound effect policy and the fifth sound effect policy may be used for performing sound effect processing on sound source data of the application program when the electronic device cannot determine the corresponding sound effect policy based on the application program or is configured to determine the corresponding sound effect policy not based on the application program, and the third sound effect policy and the fifth sound effect policy may be the same.
For example, the third and fifth sound effect policies may be sound effect policies included in the sound effect file "effectid0.xml" described above.
From the foregoing, it can be seen that the electronic device may determine the manner of acquiring the first sound effect policy by performing a plurality of determining steps such as S602, S603, and S605, or may determine the manner of acquiring the second sound effect policy by performing a plurality of determining steps such as S602, S604, and S606. It will be appreciated that at least one of S602, S603, and S605 may be omitted and/or at least one of S602, S604, and S606 may be omitted in order to reduce the interaction with the user, reduce the difficulty of user operations, and provide a more compact playback experience. In some embodiments, if the electronic device does not perform S605, the electronic device may perform S607 or S608. In some embodiments, if the electronic device performs S605 and there is a first sound effect enhancement condition that is not satisfied by the electronic device in the at least one first sound effect enhancement condition, S607 and S611 may not be performed, but S613 may be performed. Similarly, in some embodiments, if the electronic device does not perform S606, the electronic device may perform S609 or S610. In some embodiments, if the electronic device performs S606 and the electronic device determines that there is a second sound effect enhancement condition that is not satisfied by the electronic device among the at least one second sound effect enhancement condition, S609 and S611 may not be performed, but S613 may be performed.
For example, the first application program and the second application program are game 1, the first sound source data is game background sound, the sound source type is media stream type, the third sound source data is voice call with teammates, the sound source type is call stream type, the sound effect enhancing function processes the on state, and the application identifier of the first application program belongs to a sound effect enhancing white list. The electronic device may acquire a corresponding media sound effect policy based on game 1 and the media stream type through S608, and perform sound effect processing on the game background sound based on the media sound effect policy through S611. The electronic device may also acquire a corresponding call sound effect policy based on game 1 and call flow type through S610, and perform sound effect processing on the voice call based on the call sound effect policy through S612. Alternatively, the electronic device may not perform sound effect processing on the voice call, but directly perform the steps after S612. That is, the electronic device may perform the sound effect processing on the sound source data of the media stream type through the media sound effect policy under the condition that the sound source data of the media stream type and the sound source data of the call stream type of the same application program are concurrent, and perform the sound effect processing on the sound source data of the call stream type through the call sound effect policy, or may not perform the sound effect processing on the sound source data of the call stream type, so that the differential sound effect processing mode is provided according to the application program and the sound source type under the condition that the sound source data of the call stream type and the sound source data of the media stream type are concurrent, and further the sound effect processing effect is improved.
It should be noted that, if the electronic device obtains the sound source data of multiple sound source types of the same application program, the electronic device may perform the sound effect processing on each sound source data based on the same sound effect processing policy.
And S613, the electronic equipment performs sound mixing processing on the plurality of sound source data to obtain mixed sound source data.
As can be seen from the foregoing, the electronic device may obtain the combination of the plurality of sound source data through the foregoing steps, where the combination may include: the electronic device may mix one of the first, second, and fifth sound source data and one of the third, fourth, and sixth sound source data, thereby obtaining mixed sound source data.
S614, the electronic device plays audio based on the mixed sound source data.
It should be noted that, the manners of executing S613 and S614 and the manner of executing S304 and S305 may be the same as those of executing S613 and S614, respectively, and will not be described in detail here.
In some embodiments, as can be seen from the foregoing, when the electronic device executes S613, it is possible that part or all of the sound source data is not subjected to the sound effect processing in S611 or S612, so before the electronic device executes S614, the electronic device may perform the sound effect processing on the mixed sound source data through the preset sixth sound effect policy, and accordingly, in S614, the electronic device may play audio based on the mixed sound source data after the sound effect processing, thereby further improving the effect of playing audio. The sixth sound effect policy may be determined in advance by the electronic device, and of course, no matter whether the electronic device has sound source data that is not subjected to the sound effect processing in S611 or S612 when executing S613, the electronic device may perform the sound effect processing on the mixed sound source data through the preset sixth sound effect policy before executing S614.
For example, the first application and the second application are game 1, and the application identification of the first application belongs to a sound effect enhancement white list. If the sound effect enhancing function processes the off state, the first sound source data is background music (media stream type), and the third sound source data is skill sound (media stream type), the electronic device may mix the first sound source data and the third sound source data to obtain mixed sound source data, and mix the mixed sound source data through the media sound effect policy, as shown in fig. 11. If the sound effect enhancing function processes the off state, the first sound source data is background music (media stream type), and the third sound source data is voice call (call stream type) with teammates, the electronic device may mix the first sound source data and the third sound source data to obtain mixed sound source data, and mix the mixed sound source data through a communication sound effect policy, as shown in fig. 12. If the sound effect enhancing function processing is in an on state, the first sound source data is background music, the third sound source data is skill sound, the electronic device may perform sound effect processing on the first sound source data and the third sound source data based on the media sound effect policy, to obtain second sound source data and fourth sound source data, and then perform sound mixing processing on the second sound source data and the fourth sound source data to obtain mixed sound source data, as shown in fig. 13. If the sound effect enhancement function processing is in an on state, the first sound source data is background music, and the third sound source data is voice call, the electronic device may process the first sound source data based on the media sound effect policy to obtain second sound source data, process the third sound source data based on the communication sound effect policy to obtain fourth sound source data, and then mix the second sound source data and the fourth sound source data, as shown in fig. 14. As can be seen from comparing fig. 11 and 13 with fig. 12 and 14, when the sound effect enhancement function processing is in the off state, if the electronic device obtains sound source data of a plurality of sound source types, the electronic device can perform sound effect processing on mixed sound source data obtained from the plurality of sound source data based on the sound effect policy corresponding to the sound source data of one of the sound source types, thereby improving the audio playing effect of the sound source data of one of the sound source types. When the sound effect enhancement function processes the on state, if the electronic device acquires sound source data of a plurality of sound source types, sound effect processing can be performed on each sound source data based on a sound effect strategy corresponding to the sound source data of each sound source type, namely, the audio playing effect of each sound source data can be improved. Taking concurrence of the audio data of the media stream type and the call stream type as an example, if the audio enhancement function is turned off, the electronic device may preferentially ensure the playing effect of the audio data of the call stream type in the manner shown in fig. 12; if the sound enhancement function is turned on, the electronic device may fully ensure the playing effect of the sound source data of the media stream type and the call stream type in the manner shown in fig. 14.
Through the embodiment, the electronic device can obtain the corresponding sound effect strategies from the stored one or more sound effect strategies for different application programs and sound source types of the sound source data, so as to provide different sound effect processing modes for each sound source data. For example, taking music as an example, some users may prefer music with a prominent voice, while some users may prefer music with a prominent instrumental voice. Thus, to further provide a personalized audio playback experience to different users, the electronic device may provide customized sound effect policies to the users. Referring to fig. 15, a method for setting an audio policy provided in the embodiment of the present application is described by taking a first application as an example.
S1501, the electronic device detects that the sound effect policy customization function is triggered based on the first application.
The electronic device may determine that the sound effect policy customization function is triggered when a third preset operation is detected based on the first application.
In some embodiments, the electronic device may display a second sound control window as shown in fig. 16 when the first application is running and a click operation is detected based on the second volume key, the second sound control window including a "custom sound effect" button, and determine that the sound effect policy customization function is triggered when the electronic device receives a click operation based on the "custom sound effect" button. The user can trigger the sound effect strategy customizing function by clicking the second volume key, and the operation is convenient. And as can be seen from fig. 16, the second sound control window further includes a first volume bar, a first sound source type identifier, and a set button. The first volume bar may correspond to a sound source type of the first sound source data, and when the electronic device receives a touch operation or a drag operation of a user based on the first volume bar, the volume of the first sound source data may be adjusted based on the touch operation or the drag operation. The first sound source type identifier may be used to indicate a sound source type of the first sound source data, and the current sound source type is a media stream type. When the electronic apparatus receives a click operation based on the setting button, a sound setting interface as shown in fig. 7 described above may be popped up.
It should be noted that, in the embodiment of the present application, the manner in which the electronic device detects that the sound effect policy customization function is triggered is not specifically limited.
S1502, the electronic device judges whether the first sound effect strategy can be acquired based on the first application program, if yes, S1503 is executed, otherwise S1506 is executed.
The electronic device may acquire the first sound effect policy based on the application identifier of the first application program, or may acquire the first sound effect policy based on the application identifier of the first application program and the sound source type of the first sound source data.
S1503, the electronic device displays a first effect parameter setting interface.
The first effect parameter setting interface may be used to display at least one effect parameter included in the first sound effect policy.
In some embodiments, the first lower effect parameter setting interface may include a frequency response curve (or called an audio equalization curve) of the first audio data and a response value control button corresponding to at least one frequency band. The frequency response is a response of the loudspeaker converting the frequency of the input electric signal into acoustic energy when the electronic device plays the audio, the frequency response curve can be a curve formed by connecting response values of a plurality of frequencies, and the abscissa of the frequency response curve is the frequency and the ordinate is the response value. If the electronic device receives a drag operation based on any response value control button, the response value of the corresponding frequency band of the response value control button can be increased or decreased based on the drag operation.
For example, the first effect parameter setting interface may be as shown in fig. 17. The upper portion of the interface includes a frequency response curve corresponding to 31 hz to 16 khz and the lower portion includes response value control buttons corresponding to 10 frequency bands of 31 hz, 62 hz, 125 hz, 250 hz, 500 hz, 1 khz, 2 khz, 4 khz, 8 khz, 16 khz, etc.
S1504, the electronic device updates the first sound effect strategy based on the first effect parameter setting interface.
The electronic device may set the interface based on the first effect parameter, receive a second setting operation of the user, and update the parameter included in the first sound effect policy based on the second setting operation.
For example, referring to fig. 17, taking 1 khz as an example, the electronic device may modulate the response value corresponding to 1 khz to a value between-10 and 10 based on a drag operation of the response value control button corresponding to 1 khz by a user. And the electronic device may update the frequency response curve displayed in the upper portion based on the adjusted values. In addition, the first effect parameter setting interface may further include a "custom" button, and the first effect parameter setting interface may be closed when the electronic device receives a click operation based on the "custom" button.
S1505, the electronic device stores the updated first sound effect policy.
The electronic device can store the updated first sound effect strategy, so that the updated first sound effect strategy can be obtained based on the first application program, and sound effect processing is performed on the first sound source data based on the first sound effect strategy.
For example, the first sound effect policy is a sound effect policy included in "effected3.xml". With continued reference to fig. 17, when the electronic device receives a click operation based on the "custom" button, the electronic device may close the first effect parameter setting interface and update "effected3.xml".
S1506, the electronic device displays a second effect parameter setting interface.
The second effect parameter setting interface may be configured to display an effect parameter included in the third sound effect policy.
S1507, the electronic equipment updates the third sound effect strategy based on the second effect parameter setting interface to obtain a fourth sound effect strategy.
Because the electronic device does not acquire the first sound effect policy before executing S1507, that is, the electronic device may not store the first sound effect policy corresponding to the first application, the electronic device may determine the third sound effect policy customized by the user as the first sound effect policy, so that the sound source data of the first application can be optimized based on the first sound effect policy corresponding to the first application.
The electronic device may receive a first setting operation of the user based on the second effect parameter setting interface, and update the effect parameter included in the third sound effect policy based on the first setting operation.
S1508, the electronic device stores the fourth sound effect policy.
The electronic device may generate a new sound file based on the first sound policy. For example, the electronic device may generate "effected5.xml".
It should be noted that, the manner in which the electronic device performs S1506-S1508 may be similar to the manner in which S1503-S1505 are performed, which will not be described in detail herein.
S1509, the electronic device establishes a correspondence between the fourth sound effect policy and the first application program.
By establishing the corresponding relation between the fourth sound effect strategy and the first application program, the fourth sound effect strategy customized by the user aiming at the first application program can be realized, the sound effect processing process of sound source data of other application programs can not be influenced, and the playing requirement of a complex scene is met.
In some embodiments, the electronic device may store the application identifier of the first application program and the first sound effect policy to a correspondence between the application identifier and the sound effect policy. In some embodiments, the electronic device may store the application identifier of the first application program, the sound source type of the first sound source data, and the first sound effect policy to the application identifier and a correspondence between the sound source type and the sound effect policy.
For example, the electronic device may add the following information at "whistelist.
<whiteapp
name= "Game 3"
package=“com.game3.music”
effected=5>
And then when the electronic equipment acquires the sound source data of the game 3, the sound effect strategy corresponding to the game 3 can be acquired from the sound effect file 'effective 5. Xml' corresponding to the game 3.
It can be seen that, in the embodiment of the present application, when different application programs are running, the electronic device may perform audio processing on the audio data of each application program based on the audio policies corresponding to each application program, so that when different application programs are running, different audio playing and playing effects are provided. And for any application program, the electronic equipment can provide personalized sound effect customization for the user, so that different electronic equipment can also provide personalized customization for the user when running the same application program, different audio playing and playing effects are provided, and the audio playing effect is improved. For example, when the electronic device 1 runs the game 1, the sound effect policy 1 that performs sound effect processing on the sound source data of the game 1 may be as shown in fig. 17, so that the skill sound effect or the character dubbing in the game 1 can be highlighted when the audio is played. The sound effect policy 2 for performing sound effect processing on the sound source data of the game 2 when the electronic device 1 runs the game 2 may be as shown in fig. 18, so that the sound of the props such as footstep sound or firearms can be highlighted when the audio is played. While the audio policy 3 for performing audio processing on the audio data of the game 1 when the electronic device 2 runs the game 1 may be as shown in fig. 19, although compared with fig. 14, the audio policy is based on the audio data of the game 1, the audio playing effect of the electronic device 2 may be different from that of the electronic device 1, for example, the skill audio or the character dubbing played by the electronic device 2 may be more fragile.
Through the foregoing embodiment, the electronic device may accurately perform sound effect processing on the acquired sound source data, and in order to improve the audio playing effect, the electronic device may also control the volume of the sound source data. Referring to fig. 20, a flowchart of a method for playing audio is provided in an embodiment of the present application.
S2001, the electronic device acquires the first sound source data and the third sound source data.
The electronic device may acquire first sound source data based on the first application program and acquire third sound source data based on the second application program.
S2002, the electronic equipment judges the sound source type of the first sound source data and the third sound source data. If one of the first sound source data and the third sound source data is of the media stream type and the other is of the call stream type, S2003 is executed, otherwise S2006 is executed.
S2003, the electronic device judges whether the first application program and the second application program are the same application program. If yes, S2004 is performed, otherwise S2006 is performed.
S2004, the electronic device determines whether the sound enhancement function is on and whether the application identifier of the first application (or the second application) is on the sound enhancement white list. If the sound enhancement function is on and the application identifier of the first application program (or the second application program) belongs to the sound enhancement white list, S2005 is executed, otherwise S2006 is executed.
In some embodiments, S2004 may be replaced with: the electronic device determines whether the sound enhancement function is on, if so, then S2005 is executed, otherwise S2006 is executed. In some embodiments, S2004 may be replaced with: the electronic device determines whether the application identifier of the first application program (or the second application program) is on the sound effect enhancement white list, if so, S2005 is executed, otherwise S2006 is executed.
S2005, the electronic device performs volume processing on the first sound source data and the third sound source data based on the first volume policy.
The first volume policy may cause the electronic device to independently set volumes of the sound source data of different sound source types. Because the audio source types which are hoped to be emphasized by different users are different according to individual differences such as habits and preferences of the users under the condition that the audio source data of the media stream type and the call stream type are concurrent, for example, some users may wish to preferentially ensure the call, and some users may wish to preferentially ensure the game experience, the electronic equipment can independently set the volumes of the first audio source data and the third audio source data through the first volume policy.
And S2006, the electronic equipment performs volume processing on the first sound source data and the third sound source data based on the second volume policy.
The second volume policy may make the volume of the media stream type of sound source data smaller than the volume of the call stream type of sound source data, or the second volume policy may make the volume of the media stream type of sound source data larger than the volume of the call stream type of sound source data, so as to preferentially ensure the volume of one of the first sound source data and the third sound source data.
In some embodiments, when the electronic device receives a call flow volume submitted by a user, the first volume may be set as a volume threshold for the media flow volume, where the first volume may be less than or equal to the call flow volume.
In practical application, the electronic device may also preferentially ensure the volume of one of the first sound source data and the third sound source data in other manners, and the implementation manner of the second volume policy in the embodiment of the present application is not specifically limited.
For example, the electronic device may also perform a voice call with another device through the instant messaging 1 during the running of the game 1. Because the game 1 and the instant messaging 1 are not the same application program, the electronic device may make the volume of the background music of the game 1 smaller than the volume of the voice call of the instant messaging 1 based on the second policy, as shown in fig. 21, the height of the first volume bar corresponding to the media stream type is lower than the height of the second volume bar corresponding to the call stream type. In fig. 21, a prompt message "adjust media, call volume" is also displayed to prompt the user to adjust the volume of the background music of the game 1 and the volume of the voice call of the instant messaging 1 by touching or dragging the first volume bar and the second volume bar.
S2007, the electronic device plays audio based on the first sound source data and the second sound source data after the volume processing.
At least one of S2003 and S2004 may be omitted.
When S2003 is not omitted, the electronic device may perform the volume processing on the first and third sound source data based on the volume policy under the condition that the sound source data of the media stream type and the call stream type of the same application program are detected to be concurrent, so that the volumes of the sound source data of the media stream type and the call stream type are independent and do not interfere with each other, and the user may flexibly control the volumes of the sound source data according to own habits and preferences, for example, the user may control the volume of the sound source data of the media stream type to be greater than the volume of the sound data of the call stream type. When S2003 is omitted, the electronic device may also have the volumes of the media stream type and the call stream type of the audio source data of the different applications independent of each other and not interfering with each other in the case where the audio source data of the media stream type and the call stream type are concurrent.
When S2004 is not omitted, the electronic device may select a different volume policy specifically for a particular application. When S2004 is omitted, the electronic device may select a different volume policy for all applications.
It should be noted that the execution order of S2003 and S2004 described above may be interchanged. That is, the electronic device may first perform S2004 to determine whether the sound enhancement function is on and whether the application identifier of the first application (or the second application) is on the sound enhancement white list. If the sound enhancement function is not on or the application identification of the first application (or the second application) is not on the sound enhancement white list, S2006 is performed. If the sound enhancement function is on and the application identifier of the first application (or the second application) belongs to the sound enhancement white list, S2003 is executed, S2005 is executed when the first application and the second application are determined to be the same application, and S2006 is executed when the first application and the second application are determined not to be the same application.
In the embodiment of the application, the electronic equipment can adopt different volume strategies to carry out volume processing on the sound source data based on whether the sound source data of the media stream type and the call stream type are concurrent, so that the flexibility of volume control and the user experience are improved.
For example, when the media stream type and the call stream type of sound source data are not concurrent, the volume of the media stream type of sound source data may be 80% of the maximum volume, and the volume of the call stream type of sound source data may be 20% of the maximum volume. When the audio data of the media stream type and the call stream type are not concurrent, if the electronic device adopts the second volume policy to perform volume processing, the volume of the audio data of the media stream type cannot be greater than or equal to 20% of the maximum volume, and the volume of the audio data of the call stream type can be 20% of the maximum volume, that is, the volume of the audio data of the media stream type is smaller than the volume of the audio data of the call stream type. When the audio data of the media stream type and the call stream type are not concurrent, if the electronic device adopts the first volume policy to perform volume processing, the volume of the audio data of the media stream type may still be 80% of the maximum volume, and the volume of the audio data of the call stream type may be 20% of the maximum volume, that is, the volume of the audio data of the media stream type and the volume of the audio data of the call stream type are not interfered with each other.
Based on the same inventive concept, as an implementation of the above method, the embodiment of the present application provides a device for playing audio, where the embodiment of the device corresponds to the embodiment of the foregoing method, and for convenience of reading, the embodiment of the present device does not describe details in the embodiment of the foregoing method one by one, but it should be clear that the device in the embodiment can correspondingly implement all the details in the embodiment of the foregoing method.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Based on the same inventive concept, the embodiment of the application also provides electronic equipment. Fig. 22 is a schematic structural diagram of an electronic device 2200 provided in an embodiment of the present application, as shown in fig. 22, where the electronic device provided in the embodiment includes: a memory 2210 and a processor 2220, the memory 2210 for storing a computer program; processor 2220 is configured to perform the methods described in the method embodiments above when the computer program is invoked.
The electronic device provided in this embodiment may execute the above method embodiment, and its implementation principle is similar to that of the technical effect, and will not be described herein again.
Based on the same inventive concept, the embodiment of the application also provides a chip system. The system-on-chip includes a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the method described in the method embodiments above.
The chip system can be a single chip or a chip module formed by a plurality of chips.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the method described in the above method embodiment.
Embodiments of the present application also provide a computer program product which, when run on an electronic device, causes the electronic device to execute the method described in the above method embodiments.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable storage medium may include at least: any entity or device capable of carrying computer program code to a photographing device/electronic apparatus, recording medium, computer memory, read-only memory (ROM), random access memory (random access memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of playing audio, comprising:
the electronic equipment acquires first sound source data based on a first application program;
the electronic device obtaining a first sound effect strategy corresponding to the first application program comprises: the electronic equipment acquires the first sound effect strategy based on the application identifier of the first application program;
the electronic equipment performs sound effect processing on the first sound source data based on the first sound effect strategy to obtain second sound source data;
the electronic equipment plays audio based on the second sound source data;
the electronic device obtains the first sound effect strategy based on the application identifier of the first application program, and the method comprises any one of the following steps:
the electronic equipment acquires the first sound effect strategy from the corresponding relation between the application UID and the sound effect strategy based on the application user identification UID of the first application program;
the electronic equipment acquires the first sound effect strategy from the corresponding relation between the application PID and the sound effect strategy based on the application process identification PID of the first application program;
the electronic equipment acquires the first sound effect strategy based on the application identifier of the first application program and the sound source type of the first sound source data;
The electronic device obtains the first sound effect policy based on the application identifier of the first application program and the sound source type of the first sound source data, and the method includes:
if the electronic equipment determines that each first sound effect enhancement condition in at least one first sound effect enhancement condition is met, the electronic equipment acquires the first sound effect strategy based on the application identification of the first application program and the sound source type of the first sound source data;
the method further comprises the steps of:
the electronic equipment acquires third sound source data based on a second application program;
wherein the at least one first sound enhancement condition includes one or more of: the sound effect enhancement function of the electronic equipment is in an on state; the application identifier of the first application program belongs to a first white list; the first application program and the second application program are the same application program; one of the first sound source data and the third sound source data is of a media stream type and the other of the first sound source data and the third sound source data is of a call stream type.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the electronic device plays audio based on the second sound source data, including:
The electronic equipment performs sound mixing processing on the second sound source data and the third sound source data to obtain mixed sound source data;
the electronic device plays audio based on the mixed sound source data.
3. The method of claim 2, wherein prior to the electronic device playing audio based on the second audio source data, the method further comprises:
the electronic equipment acquires a second sound effect strategy corresponding to the second application program;
the electronic equipment performs sound effect processing on the third sound source data based on the second sound effect strategy to obtain fourth sound source data;
the electronic device performs audio mixing processing on the second audio data and the third audio data to obtain mixed audio data, including:
and the electronic equipment performs sound mixing processing on the second sound source data and the fourth sound source data to obtain mixed sound source data.
4. The method of claim 3, wherein before the electronic device mixes the second sound source data and the third sound source data to obtain mixed sound source data, the method comprises:
if the electronic equipment determines that each first sound effect enhancement condition in the at least one first sound effect enhancement condition is met, the electronic equipment independently sets the volume of the first sound source data and the volume of the third sound source data;
And if the electronic equipment determines that one or more first sound effect enhancement conditions in the at least one first sound effect enhancement condition are not met, the electronic equipment performs volume processing on the first sound source data and the third sound source data, so that the volume of the first sound source data after processing is smaller than the volume of the third sound source data after processing.
5. The method according to claim 4, wherein the method further comprises:
when the electronic device determines that the sound effect enhancement function of the electronic device is in an on state, the first application program and the second application program are the same application program, one of the first sound source data and the third sound source data is of a media stream type, and the other sound source type is of a call stream type, if the electronic device receives a sound effect enhancement on operation based on the first application program, the electronic device adds an application identifier of the first application program to the first whitelist.
6. The method of any of claims 1-5, wherein the electronic device obtaining a first sound effect policy corresponding to the first application comprises:
If the electronic device determines that the custom sound effect function of the electronic device is started and the second white list comprises the application identifier of the first application program, the electronic device acquires the first sound effect strategy corresponding to the first application program.
7. The method of claim 6, wherein the method further comprises:
if the electronic device determines that the self-defined sound effect function of the electronic device is closed, the application identifier of the first application program is not included in the second white list, or the electronic device does not acquire the first sound effect strategy, the electronic device acquires a preset third sound effect strategy;
the electronic equipment performs sound effect processing on the first sound source data based on the third sound effect strategy to obtain fifth sound source data;
the electronic device plays audio based on the fifth sound source data.
8. The method of claim 5, wherein the method further comprises:
the electronic equipment updates the third sound effect strategy to obtain a fourth sound effect strategy;
the electronic device establishes a correspondence between the first application program and the fourth sound effect strategy.
9. An electronic device, comprising: a memory and a processor, the memory for storing a computer program; the processor is configured to perform the method of any of claims 1-8 when the computer program is invoked.
10. A chip system comprising a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the method of any of claims 1-8.
CN202110194834.0A 2021-02-21 2021-02-21 Audio playing method, electronic equipment and chip system Active CN114979347B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110194834.0A CN114979347B (en) 2021-02-21 2021-02-21 Audio playing method, electronic equipment and chip system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110194834.0A CN114979347B (en) 2021-02-21 2021-02-21 Audio playing method, electronic equipment and chip system

Publications (2)

Publication Number Publication Date
CN114979347A CN114979347A (en) 2022-08-30
CN114979347B true CN114979347B (en) 2023-05-12

Family

ID=82954188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110194834.0A Active CN114979347B (en) 2021-02-21 2021-02-21 Audio playing method, electronic equipment and chip system

Country Status (1)

Country Link
CN (1) CN114979347B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778067A (en) * 2015-04-27 2015-07-15 努比亚技术有限公司 Sound effect starting method and terminal equipment
CN106648534A (en) * 2016-12-26 2017-05-10 三星电子(中国)研发中心 Method of simultaneously playing mutually-exclusive audios
CN109101216A (en) * 2018-09-04 2018-12-28 Oppo广东移动通信有限公司 Audio method of adjustment, device, electronic equipment and storage medium
CN109271128A (en) * 2018-09-04 2019-01-25 Oppo广东移动通信有限公司 Audio setting method, device, electronic equipment and storage medium
CN112217486A (en) * 2020-10-16 2021-01-12 展讯通信(上海)有限公司 Audio playing control method and system, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778067A (en) * 2015-04-27 2015-07-15 努比亚技术有限公司 Sound effect starting method and terminal equipment
CN106648534A (en) * 2016-12-26 2017-05-10 三星电子(中国)研发中心 Method of simultaneously playing mutually-exclusive audios
CN109101216A (en) * 2018-09-04 2018-12-28 Oppo广东移动通信有限公司 Audio method of adjustment, device, electronic equipment and storage medium
CN109271128A (en) * 2018-09-04 2019-01-25 Oppo广东移动通信有限公司 Audio setting method, device, electronic equipment and storage medium
CN112217486A (en) * 2020-10-16 2021-01-12 展讯通信(上海)有限公司 Audio playing control method and system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114979347A (en) 2022-08-30

Similar Documents

Publication Publication Date Title
CA2740581C (en) System and method for resuming media
US8893052B2 (en) System and method for controlling mobile terminal application using gesture
US20160337501A1 (en) Duplex audio for mobile communication device and accessory
US10051368B2 (en) Mobile apparatus and control method thereof
US20170270897A1 (en) Earphone system for mobile device and method for operating the same
US20140086434A1 (en) Method and apparatus for customizing audio signal processing for a user
CN113411793A (en) Bluetooth communication method and terminal
CN203840414U (en) Mobile terminal
CN106878915B (en) Control method, device and the playback equipment and mobile terminal of playback equipment
JP2013542479A (en) Composite attribute control method and portable terminal supporting the same
CN106657645A (en) Call request processing method and device, calling method and device, and related terminal
CN111277697B (en) Audio processing method and device, storage medium and electronic equipment
CN114647395A (en) Screen projection method and device, electronic equipment and storage medium
CN110381215B (en) Audio distribution method and device, storage medium and computer equipment
CN105516451A (en) Sound effect adjustment method and device
KR20080027798A (en) User terminal for performing a plurality of applications simultaneously
CN116471355B (en) Audio playing method and electronic equipment
US20230370774A1 (en) Bluetooth speaker control method and system, storage medium, and mobile terminal
CN114979347B (en) Audio playing method, electronic equipment and chip system
CN106251876A (en) Audio mixed method based on HOOK technology and system
CN109155803B (en) Audio data processing method, terminal device and storage medium
CN114416015A (en) Audio adjusting method and device, electronic equipment and readable storage medium
CN107124512A (en) The switching method and apparatus of audio-frequency play mode
CN115914456B (en) Audio processing method, electronic device and computer readable storage medium
US20230400963A1 (en) Menu list update method and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant