[go: up one dir, main page]

CN120034787A - Audio playback processing method, device, equipment, medium and product - Google Patents

Audio playback processing method, device, equipment, medium and product Download PDF

Info

Publication number
CN120034787A
CN120034787A CN202510049528.6A CN202510049528A CN120034787A CN 120034787 A CN120034787 A CN 120034787A CN 202510049528 A CN202510049528 A CN 202510049528A CN 120034787 A CN120034787 A CN 120034787A
Authority
CN
China
Prior art keywords
audio
fade
processed
audio data
processing
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.)
Pending
Application number
CN202510049528.6A
Other languages
Chinese (zh)
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.)
iFlytek Co Ltd
Original Assignee
iFlytek 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 iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN202510049528.6A priority Critical patent/CN120034787A/en
Publication of CN120034787A publication Critical patent/CN120034787A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2430/00Signal processing covered by H04R, not provided for in its groups
    • H04R2430/01Aspects of volume control, not necessarily automatic, in sound systems

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Signal Processing (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本申请提供一种音频播放处理方法、装置、设备、介质及产品,该方法应用于音频系统引擎,该音频系统引擎包括安卓系统的混音组件AudioFlinger,该方法包括:获取待处理音频数据的播放状态,待处理音频数据由应用程序写入音频系统引擎的音频缓存区中;根据待处理音频数据的播放状态,对待处理音频数据进行淡入处理或淡出处理,得到音频处理结果;根据音频处理结果进行混音,并输出至音频播放设备进行播放。本申请能够在简化开发流程的基础上实现高质量的音频过渡效果,简化开发流程,且可以跨平台移植,通用性较高。

The present application provides an audio playback processing method, device, equipment, medium and product, the method is applied to an audio system engine, the audio system engine includes an audio mixing component AudioFlinger of an Android system, the method includes: obtaining the playback status of the audio data to be processed, the audio data to be processed is written into the audio buffer of the audio system engine by the application; according to the playback status of the audio data to be processed, fading in or fading out the audio data to be processed to obtain an audio processing result; mixing according to the audio processing result, and outputting it to an audio playback device for playback. The present application can achieve high-quality audio transition effects on the basis of simplifying the development process, simplifying the development process, and can be transplanted across platforms, with high versatility.

Description

Audio playing processing method, device, equipment, medium and product
Technical Field
The present application relates to the field of audio data processing, and in particular, to an audio playing processing method, apparatus, device, medium and product.
Background
With the continuous evolution of smart devices, audio interaction scenarios have become increasingly diverse and complex, including various forms of voice assistants, navigation prompts, system notification sounds, and phone calls. In these interactions, fade-in (fade-out) processing or fade-in (fade-out) processing can significantly enhance the smoothness and user experience of audio playback.
Currently, the main approaches to achieve this include improvements at the application level or integration of the fade functionality through underlying hardware optimization. However, these approaches are complex and less versatile.
Disclosure of Invention
Based on the state of the art, the application provides an audio playing processing method, an audio playing processing device, audio playing processing equipment, audio playing processing media and audio playing products, which can realize high-quality audio transition effects on the basis of simplifying development flow, simplify development flow, and realize cross-platform transplanting with high universality.
In order to achieve the technical purpose, the application specifically provides the following technical scheme:
According to a first aspect of an embodiment of the present application, an audio playing processing method is provided and applied to an audio system engine, where the method includes obtaining a playing state of audio data to be processed, where the audio data to be processed is written into an audio buffer area of the audio system engine by an application program, performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed, obtaining an audio processing result, performing mixing according to the audio processing result, and outputting the audio processing result to an audio playing device for playing.
In some implementations, the audio system engine includes a mixing component AudioFlinger and an audio hardware abstraction layer of the android system, where the audio data to be processed includes a plurality of audio data to be processed, and the audio data to be processed is subjected to fade-in processing or fade-out processing according to a playing state of the audio data to be processed to obtain an audio processing result, where the audio processing result includes, for each audio data to be processed, performing fade-in processing on the audio data to be processed when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a first preset state, to obtain fade-in audio corresponding to the audio data to be processed, where the first preset state is any one of a starting playing state and a pause continuing playing state, and the audio processing result is mixed and output to an audio playing device through the audio hardware abstraction layer to play, where the audio processing result is mixed according to each audio data to be processed and the corresponding fade-in audio data, and output to the audio playing device through the audio hardware layer to be played.
In some implementations, the audio system engine includes a mixing component AudioFlinger and an audio hardware abstraction layer of the android system, where the audio data to be processed includes a plurality of audio data to be processed, and the audio data to be processed is subjected to fade-in processing or fade-out processing according to a playing state of the audio data to be processed to obtain an audio processing result, where the audio processing result includes, for each audio data to be processed, performing fade-out processing on the audio data to be processed when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a second preset state, to obtain a second audio processing result, where the second audio processing result includes fade-out audio, and the second preset state is any one of a stopped playing state and a stopped playing state, and the audio processing result is output to an audio playing device through the audio hardware abstraction layer to play.
In some implementations, the step of performing fade-out processing on the audio data to be processed to obtain a second audio processing result when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a second preset state includes performing fade-out processing on played audio data according to unreported audio data in the audio data to be processed when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a pause playing state, so as to obtain fade-out audio.
In some implementations, the audio processing result includes fade-in audio or fade-out audio, and the method further includes controlling the volume of the fade-in audio or the fade-out audio to gradually change from the play volume before interruption to the target play volume when the play is started after the fade-in audio or the fade-out audio is interrupted.
In some implementations, the method further includes obtaining first configuration information of a fade-in function and a fade-out function, wherein the first configuration information includes a fade-in function and a fade-out function which are turned on, a fade-in function which is turned on or a fade-out function which is turned on, the fade-in processing or the fade-out processing is performed on the audio data to be processed according to a playing state of the audio data to be processed to obtain an audio processing result, the fade-in processing is performed on the audio data to be processed according to the playing state of the audio data to be processed when the first configuration information is the fade-in function which is turned on to obtain an audio processing result, the fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed when the first configuration information is the fade-in function which is turned on to obtain an audio processing result, and the fade-in processing or the fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed when the first configuration information is the fade-in function which is turned on.
In some implementations, the method further comprises the steps of obtaining second configuration information of a fade-in function and a fade-out function, wherein the second configuration information comprises fade-in duration of the fade-in function and/or fade-out duration of the fade-out function, fade-in processing or fade-out processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, the fade-in processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed and the fade-in duration to obtain an audio processing result, and/or the fade-out processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed and the fade-out duration to obtain the audio processing result.
According to a second aspect of the embodiment of the application, an audio playing processing device is provided, which comprises an acquisition unit, a fade-in fade-out processing unit and a mixing unit, wherein the acquisition unit is used for acquiring the playing state of audio data to be processed, the audio data to be processed is written into an audio buffer area of an audio system engine by an application program, the fade-in fade-out processing unit is used for carrying out fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, and the mixing unit is used for mixing according to the audio processing result and outputting the audio processing result to audio playing equipment for playing.
According to a third aspect of an embodiment of the present application, there is provided an electronic device, including a memory and a processor, where the memory is connected to the processor and is used to store a program, and the processor is used to implement the audio playing processing method according to the first aspect by running the program in the memory.
According to a fourth aspect of embodiments of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the audio playback processing method as described in the first aspect.
According to a fifth aspect of embodiments of the present application there is provided a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the audio playback processing method as described in the first aspect.
The method is applied to an audio system engine, the playing state of audio data to be processed is obtained, the audio data to be processed is written into an audio buffer area of the audio system engine by an application program, then fade-in processing or fade-out processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed, an audio processing result is obtained, mixing is carried out according to the audio processing result, and finally the audio data is output to audio playing equipment for playing through an audio hardware abstraction layer. The application uses AOSP audio system engine as the realization base, can realize fade-in and fade-out processing without depending on specific hardware platform interface, ensures cross-platform portability and higher universality, and in addition, can realize high-quality audio transition effect without application program modifying code because the whole processing process is positioned on the operating system level, thereby simplifying the development flow.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a related art audio system engine;
fig. 2 is a flowchart of an audio playing processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a user interface for setting a fade function according to an embodiment of the present application;
fig. 4 is a schematic diagram of a user interface for setting a fade-in fade-out duration according to an embodiment of the present application;
Fig. 5 is a schematic diagram of comparison between before and after optimizing a mixing process according to an embodiment of the present application;
Fig. 6 is a schematic diagram showing the comparison of effects before and after the added fade-in and fade-out treatment according to the embodiment of the present application;
fig. 7 is a schematic structural diagram of an audio playing processing device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical scheme provided by the embodiment of the application can be exemplarily applied to hardware equipment such as a processor, electronic equipment, a server (comprising a cloud server) and the like, or packaged into a software program to be operated, and when the hardware equipment executes the processing procedure of the technical scheme of the embodiment of the application, or the software program is operated, the purpose of automatically splitting a target task and automatically calling an application program interface required by the task can be realized, so that the target task is completed. The embodiment of the application only exemplary introduces the specific processing procedure of the technical scheme of the application, but does not limit the specific implementation form of the technical scheme of the application, and any technical implementation form capable of executing the processing procedure of the technical scheme of the application can be adopted by the embodiment of the application.
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Before describing the scheme of the application, the related technology is first described:
In an audio interaction scenario, many applications may produce abrupt sounds, even plosive sounds, when audio begins to play or suddenly breaks due to the lack of a smooth fade effect. This phenomenon severely affects the hearing experience of the user, especially in closed environments such as in-car, video-audio rooms or listening through headphones.
In view of the above problems, there are currently mainly two solutions, which are described below in connection with an audio framework:
Fig. 1 is a schematic diagram of a related art audio system engine. As shown in fig. 1, the framework includes an application layer, a java frame work layer, a native frame work layer, and an audio hardware abstraction layer (Hardware Abstraction Layer, HAL).
Among other things, the application layer includes various applications used by the user, such as music players, video applications, game applications, and the like. Open Bores Operating Excursion (OBOE) and an API interface provided by an open source audio-video player (ExoPlayer) for an application program (APP) by the android system, the APP can use the OBOE or ExoPlayer to implement an audio playing function. OBOE is mainly used for applications requiring play delay, such as voice communication, game sound effects or navigation prompts. ExoPlayer are used for the media player to play audio and video content.
The Java framework layer is an audio application framework layer and comprises a first AudioTrack component and a first MediaPlayer component. The first AudioTrack component is an API class of the android application framework and is responsible for outputting playback data.
The Native frame work layer includes a mixing assembly AudioFlinger. AudioFlinger is responsible for the mixing process of the audio data and includes a second AudioTrack component, a Track component, and a PLAY THREAD component.
Wherein, each APP corresponds to a first AudioTrack component. Each first AudioTrack component corresponds to one mixing component AudioFlinger, i.e., each first AudioTrack component corresponds to one second AudioTrack component and one Track component. And a plurality of Track components corresponds to one PLAY THREAD component.
When the APP needs to play audio, then call AudioTrack component AOSP. Specifically, the APP may write the audio data to be processed in the audio buffer of the AudioFlinger application by directly invoking the second AudioTrack component, or indirectly invoking the second AudioTrack component through the first AudioTrack component.
The Track component regularly takes audio data to be processed from the audio buffer area to carry out audio mixing processing, and the audio data after audio mixing processing is transmitted to the audio hardware abstraction layer through the PLAY THREAD component. The audio hardware abstraction layer provides an interface for interaction with the underlying hardware, ensuring that audio data can be properly transmitted to the audio device for playback.
In addition, for the media play class APP, since the corresponding first MediaPlayer component can play audio data in multiple formats, such as Mp3, flac, wma, ogg, wav, etc., while the AudioTrack component can only play the decoded PCM data stream. Therefore, the first MediaPlayer component needs to create a corresponding second MediaPlayer component, nuPlayer component, mediaextender component, mediaCodec component and OMX component in the Native frame work layer to decode the audio data from the audio and video data, and then deliver the audio data to AudioFlinger for mixing.
The above procedure is the current processing procedure for audio playback. One of the solutions to the fade-in and fade-out process is to improve on the application layer, based on the processing of the audio playback described above. Specifically, each application program adjusts the volume of the player by utilizing VolumeShaper API of the android system or a self-developed algorithm so as to realize a natural audio transition effect. This approach can directly improve the user experience of a particular application, but can increase the complexity of software development and for most applications it is challenging to push it to make corresponding changes. In addition, the method requires each application program to independently realize the fade-in and fade-out function, and it is difficult to ensure that all applications can reach consistent user experience standards.
Another solution is to process the audio stream through underlying hardware optimization. For example, specially designed algorithms are integrated in a Digital Signal Processor (DSP) or power amplifier in the audio hardware abstraction layer to uniformly process all audio streams, ensuring a fade-in and fade-out effect for each sound event. This approach, while providing broader compatibility and better performance, helps to maintain audio consistency. Implementation requires support that depends on the device hardware and not all devices currently have this capability. Furthermore, its control accuracy for a single track is limited, which may not meet the requirements of some advanced application scenarios.
In view of this, embodiments of the present application are directed to providing a method, an apparatus, a device, a medium, and a product for processing audio play, by modifying a AudioTrack component of an Android open source code item (Android Open Source Project, AOSP), and adjusting AudioFlinger a mixing related logic, fade-in and fade-out processing can be performed when each piece of audio data to be processed is played, without an application program cooperating with a modification code, so that a fade-in and fade-out function implementation process is simplified, and the method and the device can be transplanted to systems of various Android versions, and have higher versatility. In addition, the processing process is in AudioFlinger sound mixing stage and is close to the hardware layer, so that the low-delay effect can be realized, the fade-in fade-out effect is further improved, and the overall fluency of audio playing is enhanced. The following examples are described in detail one by one.
Exemplary method
Fig. 2 is a flowchart of an audio playing processing method according to an embodiment of the present application. As shown in fig. 2, the audio playing processing method provided in the present embodiment includes steps S101 to S103:
s101, acquiring a playing state of audio data to be processed, wherein the audio data to be processed is written into an audio buffer area of an audio system engine by an application program.
The main execution body of the method in this embodiment is an audio system engine, specifically a mixing component AudioFlinger in the android system.
The application programs in step S101 include audio application programs (such as music player, podcast platform, voice memo, etc.), audio/video application programs (such as online video streaming service, local media player, live broadcast platform, etc.), communication application programs (such as voice and video call functions in VoIP call software or instant messaging tool), or game application programs (such as background music, character dialogue, environmental sound effects, etc. in game) which need to play sound.
With continued reference to fig. 1, when the application is ready to play audio, a corresponding API interface (e.g., the first AudioTrack component of fig. 1) is called to request a play channel from the mixing component AudioFlinger. After that, the audio mixing component AudioFlinger receives the audio data to be processed from the application program, and stores it in the internal audio buffer area for further processing.
In this process, the Track component AudioFlinger is responsible for managing the playback status of the audio data to be processed, which includes, but is not limited to, various situations such as beginning playback, playing back, pausing playback, or ending playback.
When the user triggers a play control command (such as start, pause or stop), the play states corresponding to the operations are transferred to the mixing component AudioFlinger. The mixing component AudioFlinger can accurately grasp the playing condition of the current audio data to be processed according to the received playing state, and can respond appropriately according to the playing condition. Therefore, when a plurality of application programs play audio at the same time, all audio output is managed orderly and efficiently, and user experience is improved.
S102, performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed, and obtaining an audio processing result.
The fade-in or fade-out process can smoothly change the loudness of the sound over time to achieve a more natural audio effect.
Fade-in refers to gradually increasing the volume of the audio signal, starting from a mute or very low volume, and smoothly rising to the desired normal play volume for a certain period of time. The fade-in process can make the audio introduction softer and reduce the abrupt sense.
Fade-out refers to gradually decreasing the volume of the audio signal from a normal play volume to a mute or very low volume for a period of time, and finally stopping. In contrast to fade-in, fade-out can convey a feeling of gradually going away from the audio, avoiding the neck. In the case of a continuous play of multiple audio clips, the fade-out may smoothly transition the current audio to the next audio, ensuring overall consistency.
When the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is the preset state, the audio data to be processed is subjected to fade-in processing or fade-out processing, so that the audio playing effect can be improved. Specifically, in implementing step S102, through the mixing component AudioFlinger, there may be at least one implementation manner as follows:
in some implementations, step S102 includes:
And a1, carrying out fade-in processing on the audio data to be processed under the condition that the play state of the audio data to be processed is identified as a first preset state, and obtaining fade-in audio corresponding to the audio data to be processed, wherein the first preset state is any one of a play starting state and a play stopping state.
When an audio file starts playing for the first time, its playing state is "start playing state". In order to avoid abrupt feeling caused by the sudden occurrence of audio, a fade-in effect can be added to the audio data to be processed. For example, the first n seconds (e.g., 3 seconds) of data may be intercepted at the beginning of the audio data to be processed, and the audio processing algorithm may be used to gradually increase the volume of the n seconds of data, so as to generate fade-in audio, so as to realize from complete silence to target playing volume. The target playing volume is the playing volume of the audio stream after the first n seconds, so that the audio after fade-in processing is matched with the volume of the subsequent audio stream, and smooth hearing experience is provided.
For example, the user turns on the music player and selects a song, and after pressing the play button, the music does not immediately sound at full volume, but gradually rises from a mute or very low volume to a normal play volume. Thus making the introduction of audio more natural and providing an audible transition for the user.
When the audio play is paused and resumed again, the play state is "resume play state after pause". In order to make the music continuous and unobtrusive before and after the pause, the present embodiment may also add a fade-in effect when the audio is replayed. Specifically, the data of the first n seconds can be intercepted at the starting position of the restarted audio data, the volume of the data of the first n seconds is gradually increased by using an audio processing algorithm, fade-in audio is generated, and the aim of completely muting the paused audio to the target playing volume is achieved, so that the volume of the fade-in processed audio is matched with the volume of the subsequent audio stream, and smooth hearing experience is provided.
For example, a movie is currently being played, with the movie being paused in the middle due to the telephone ring. After hanging up the phone, the user returns to the video player and clicks the play button. At this time, the mixing component AudioFlinger recognizes that the current state is "play after pause state", and starts the fade-in process, so that the dialogue or background music in the movie gradually returns to the normal level from the lower volume.
By fading the audio data to be processed, whether first played or paused later, a smoother, more comfortable listening experience may be provided to the user.
In some implementations, step S102 includes:
And b1, carrying out fade-out processing on the audio data to be processed under the condition that the play state of the audio data to be processed is identified as a second preset state, so as to obtain a second audio processing result, wherein the second audio processing result comprises fade-out audio, and the second preset state is any one of a play stopping state and a play suspending state.
When an application or a user decides to completely terminate audio playback, the playback state becomes a "stop playback state". At this time, in order to avoid abrupt feeling caused by abrupt interruption of audio, the present embodiment may apply a fade-out effect. For example, in a music player, if the user chooses to switch songs or turn off the player, the currently playing audio does not disappear immediately, but gradually decreases from normal volume until completely muted. The end of the audio appears smoother by progressive volume reduction, thereby improving the comfort of the listener. In the stop playing state, audio data of n seconds after interception at the end of the audio data to be processed can be adopted for fade-out processing.
When the user temporarily interrupts the audio play, the play state becomes a "pause play state". For example, a user may choose to pause playback when watching a movie or video, need to leave temporarily to make a call or handle other things. At this time, the audio mixing component fades out the audio, so that the background music or dialogue sound is gradually weakened, and not immediately cut off, thereby keeping the continuity of the scene.
When the step b1 is implemented, if the audio mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a pause playing state, the played audio data is subjected to fade-out processing according to the unreflected audio data in the audio data to be processed, so as to obtain fade-out audio.
In order to avoid stopping audio output immediately when pausing, fade-out processing can be performed on the played part (i.e. the played audio data) according to the audio content which is not yet played (i.e. the audio data which is not yet played), the volume of the audio which is currently played is gradually reduced, and the audio is smoothly transited from the normal playing volume to complete silence, so that the end of the audio stream is neither abrupt nor affects the whole hearing experience. Even in the paused state, the audio maintains its consistency and integrity. Thereby providing a more natural and pleasant auditory end effect to the user.
In some embodiments, to further enhance the user experience. The fade-out policy may also be determined by evaluating the content characteristics of the portion of the audio data that has not yet been played in the audio data when the user triggers a pause operation.
In particular, the audio content features may include music structures, dialog rhythms, or other key audio elements. The audio content characteristics may be used to determine how the currently playing audio ends to maintain the consistency and integrity of the overall audio content. For example, if the audio content features a first content feature (e.g., the unplayed data contains an important session or a climax of music), a first fade-out period may be selected to ensure that the portion of the content is not suddenly interrupted, whereas if the audio content features a second content feature (e.g., the unplayed audio is relatively flat), a second fade-out period may be selected to quickly respond to a pause request from the user. The first fade-out time length is longer than the second fade-out time length, and the customized processing mode ensures that the fade-out effect can be well adapted to the audio characteristics no matter how the audio content changes, and the hearing experience of a user is improved.
In some embodiments, in order to ensure seamless connection after the audio fade-in process or the audio fade-out process is interrupted, the audio play processing method of the embodiment may further include controlling the volume of the fade-in audio or the fade-out audio to be gradually changed from the play volume before the interruption to the target play volume when the play is started after the fade-in audio or the fade-out audio is interrupted.
When the playback of the fade-in audio or the fade-out audio is interrupted and then the playback is started again, the volume can be controlled to gradually and smoothly transition to the target playback volume from the playback volume before the interruption.
Specifically, when interruption (such as network delay or other external factors) occurs in the fade-in or fade-out process, the current volume value and time point are recorded, and when the audio playing is restarted, the volume is gradually adjusted from the recorded interruption volume value until the target playing volume is reached. Thereby avoiding discomfort to the listener due to abrupt sound changes.
When an interrupt occurs, the fade-in or fade-out is restarted based on the current volume value. Thus, even if a short interruption occurs in the playing process, the user does not feel obvious volume mutation or jump, so that the smoothness and consistency of the audio experience are maintained.
For example, assuming that the user is listening to a song, when the song just starts playing and fade-in processing is performed, the playing is interrupted suddenly due to an incoming call. The volume value and fade-in progress at the time of the interruption need to be recorded. When the user returns to the application to continue playing after answering the call, the volume is gradually increased from the recorded volume value until the normal playing volume is completely restored.
Through the mechanism, the audio play processing method of the embodiment can provide a seamless and natural audio recovery effect when an interruption is encountered in the fade-in or fade-out process.
In some embodiments, to provide a personalized user experience, configuration options for the fade-in process and the fade-out process may also be set for each application, respectively, allowing the user to customize the audio effects according to their own needs. The configuration function is described below with reference to the accompanying drawings:
Fig. 3 is a schematic diagram of a fade-in and fade-out function setting according to an embodiment of the present application. As shown in fig. 3, the user may choose to turn on or off the fade-in function, the fade-out function, or both simultaneously. The black dot in the figure is on the left side of the selection frame, and the black dot is on the right side of the selection frame, and is off. For example, APP1 is a fade-on function and a fade-off function, APP2 is a fade-off function and a fade-on function, APP3 is a fade-on function and a fade-off function simultaneously.
Based on the above configuration information, before executing step S102 of the audio playing processing method of the present embodiment, it is required to acquire the first configuration information (i.e. regarding whether to turn on the fade-in and/or fade-out function), and perform corresponding processing according to the different types of first configuration information, which may specifically include the following implementation manners:
In some implementations, if the first configuration information is identified as turning on the fade-in function, fade-in processing is performed on the audio data to be processed according to the playing state of the audio data to be processed, so as to obtain an audio processing result. Specifically, in the case that the playing state of the audio data to be processed is the first preset state, fade-in processing is performed on the audio data to be processed, so as to obtain an audio processing result. For example, if the user selects to turn on only the fade-in function, the fade-in effect is automatically applied when the audio starts to be played, so that a smooth volume increasing effect is achieved when the audio starts to be played.
In some implementations, if the first configuration information is identified as turning on the fade-out function, the fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed, so as to obtain an audio processing result. Specifically, when the playing state of the audio data to be processed is the second preset state, the audio data to be processed is subjected to fade-out processing, and an audio processing result is obtained. For example, if the user selects to turn on only the fade-out function, the fade-out effect is automatically applied when the audio ends or pauses, thereby achieving a smooth volume fade-out effect when the audio ends or pauses.
In some implementations, if the first configuration information is identified as simultaneously starting the fade-in function and the fade-out function, the fade-in processing or the fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed, so as to obtain an audio processing result. The method comprises the steps of carrying out fade-in processing on audio data to be processed under the condition that the playing state of the audio data to be processed is a first preset state to obtain an audio processing result, and carrying out fade-out processing on the audio data to be processed under the condition that the playing state of the audio data to be processed is a second preset state to obtain the audio processing result. For example, if the user selects to turn on both functions simultaneously, a fade-in effect is applied when the audio starts to play and a fade-out effect is applied when the audio ends or pauses.
To further enhance the personalized experience, in some embodiments, the user may also be provided with a set option for the fade-in duration and fade-out duration of each application. As shown in fig. 4, the user may set only the fade-in duration, only the fade-out duration, or both the fade-in duration and the fade-out duration for each application by selecting the "minus sign (-) and the" plus sign (+) "in the box, or directly inputting the number, according to personal preference. The fade-in duration refers to the duration of the fade-in process. The fade-out duration refers to the duration of the fade-out process.
Based on the configuration information of the fade-in duration and the fade-out duration, before executing step S102 of the audio playing processing method of the present embodiment, second configuration information needs to be acquired, and corresponding processing is performed according to different types of second configuration information, which may specifically include the following implementation manners:
In some implementations, if the second configuration information includes a fade-in duration, fade-in processing is performed on the audio data to be processed according to the playing state of the audio data to be processed and the set fade-in duration, so as to obtain an audio processing result. Specifically, in the case that the playing state of the audio data to be processed is a first preset state, fade-in processing is performed on the audio data to be processed according to the set fade-in duration, so as to obtain an audio processing result. For example, when the user selects to set only the fade-in period, the set fade-in period is automatically applied when the audio starts to be played.
In some implementations, if the second configuration information is identified to include the fade-out duration, the fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed and the set fade-out duration, so as to obtain an audio processing result. Specifically, when the playing state of the audio data to be processed is the second preset state, the audio data to be processed is subjected to fade-out processing according to the set fade-out time length, and an audio processing result is obtained. For example, when the user selects to set only the fade-out period, the set fade-out period is automatically applied when the audio starts to be played.
In some implementations, if the second configuration information includes a fade-in duration and a fade-out duration, fade-in processing is performed on the audio data to be processed according to the playing state of the audio data to be processed and the set fade-in duration to obtain an audio processing result, or fade-out processing is performed on the audio data to be processed according to the playing state of the audio data to be processed and the set fade-out duration to obtain the audio processing result. Specifically, when the playing state of the audio data to be processed is a first preset state, the audio data to be processed is subjected to fade-in processing according to the set fade-in time length to obtain an audio processing result, and when the playing state of the audio data to be processed is a second preset state, the audio data to be processed is subjected to fade-out processing according to the set fade-out time length to obtain the audio processing result. For example, if the user selects to turn on both functions simultaneously, the fade-in duration is applied when the audio begins to play and the fade-out duration is applied when the audio ends or pauses.
When the user selects to set the fade-in duration, the fade-in processing is performed on the audio data to be processed according to the default fade-in duration under the condition that the playing state of the audio data to be processed is the second preset state, so as to obtain an audio processing result. When the user selects to set the fade-out duration only, fade-in processing is performed on the audio data to be processed according to the default fade-in duration under the condition that the playing state of the audio data to be processed is the first preset state, so as to obtain an audio processing result.
The above embodiments describe fade-in processing or fade-out processing of individual audio data. However, in a practical application scenario, a plurality of audio data often exist at the same time and require synchronous processing. In order to ensure that fade-in processing or fade-out processing among the audio data to be processed does not affect each other, the audio mixing component applies for an independent audio buffer area for each audio data respectively, so that each audio stream has an independent buffer area.
After the audio mixing component obtains the audio data to be processed and the corresponding playing states from each audio buffer area, corresponding fade-in processing or fade-out processing can be executed on the audio data meeting the preset state according to the obtained playing states. For example, fade-in processing is performed on audio data satisfying a first preset state to generate a smooth audio introduction effect, and fade-out processing is performed on audio data satisfying a second preset state to ensure that the audio stream can end naturally.
To ensure that the processing of the individual audio streams is independent of each other, each audio stream also corresponds to an independent processing path. For example, the music playing application and the notification alert tone each have separate audio buffers. When the user is playing music, the mobile phone receives a notification prompt tone of a new message. At this time, the mixing component recognizes that the current playing state is the "starting playing state", and fade-in processing is performed on the alert sound, and at the same time, background music in the music playing application may be in the "pause playing state", so that fade-out processing is performed thereon. Since the processing of the two audio streams is completely independent, the user hears a clear notification prompt, while the music gradually fades to silence, and then playback can be resumed according to the user's operation.
By the above mechanism, the audio mixing component in this embodiment can not only efficiently process a plurality of audio data, but also ensure that the fade-in or fade-out process of each audio stream is independent and is not affected by other audio streams.
With continued reference to fig. 2, after step S102, the audio playing processing method of the present embodiment further includes step S103.
S103, mixing according to the audio processing result, and outputting to audio playing equipment for playing.
After the fade-in processing or fade-out processing of the audio data to be processed is completed, the mixing operation may be performed based on the audio data after the fade-in processing or the fade-out processing (i.e., the audio processing result). Mixing refers to the process of combining multiple audio streams into a single audio stream, which includes adjusting the relative volume and balance of the individual audio sources, and the application of audio effects, such as equalization, echo cancellation, etc., to ensure that all audio elements coexist in harmony, providing a clear and immersive auditory experience.
Specifically, step S103 includes mixing, by the mixing component AudioFlinger, audio according to each piece of audio data to be processed and the corresponding fade-in audio, and outputting the mixed audio to the audio playing device for playing by the audio hardware abstraction layer, or mixing, by the mixing component AudioFlinger, audio according to each piece of audio data to be processed and the corresponding fade-out audio, and outputting the mixed audio to the audio playing device for playing by the audio hardware abstraction layer.
The audio mixing component combines the faded-in or faded-out audio data with other audio streams being played to generate a final audio stream containing all necessary audio information, and transmits the final audio stream to actual audio playing equipment (such as built-in speakers of a mobile phone, a Bluetooth headset and the like) through the HAL layer.
The use scenarios that can be covered by the fade-in and fade-out function of this embodiment include audio source switching, music up and down, seekto (moving the audio or video playing position to a specified time point), pause playing, start playing, application abnormal crashing, etc.
The beneficial effects of the present embodiment are described in detail below with reference to the accompanying drawings:
fig. 5 is a schematic diagram of comparison between before and after the optimization of the audio mixing process according to the embodiment of the present application. As shown in fig. 5, the left side is a schematic diagram of the audio processing state before optimization, and the right side is a schematic diagram of the audio processing state after optimization.
Wherein IDLE represents an IDLE state, RESUMING represents a resume state, stop represents a stop state, pause represents a pause state, ACTIVE represents an ACTIVE state, i.e. a playing state, PAUSING represents an in-pause state.
The method comprises the steps of enabling a start (start) operation to achieve a state from IDLE state (IDLE) to resume state (RESUMING), enabling a start (start) operation to achieve a state from resume state (RESUMING) to ACTIVE state (ACTIVE), enabling a pause (pause) operation to achieve a state from ACTIVE state (ACTIVE) to Pause (PAUSING), enabling a pause (pause) operation to achieve a state from Pause (PAUSING) to Pause (PAUSED), enabling a start (start) operation to achieve a state from pause state (PAUSED) to ACTIVE state (ACTIVE), enabling a stop/release operation to achieve a state from ACTIVE state (ACTIVE) to stop State (STOPED) by stopping a current audio play session and releasing a resource (stop/release) associated therewith, enabling a state from pause state (PAUSING) to stop state (PPED) by a stop/release operation, enabling a state from pause state (PAUSED) to stop state (PAUSED) by a stop/release operation, and enabling a state from pause State (STORE) to stop (PPLE) by releasing a resource (stop) associated with the stop/release operation.
When the application program plays the audio, the audio playing state is switched from the active state to the stop state when the user performs the operations of cutting the source or winding up and down. When the user performs a pause operation or a seek to operation, the audio playing state is switched from the active state to the pause state, and then is switched to the pause state, and in the two scenes, plosives are easy to generate.
As can be seen from a comparison of the left side and the right side, the present embodiment eliminates pop noise by performing fade-out processing during the audio switching from the pause-in-process state to the pause state when the source is cut, the user is making a pause operation or a seek to operation.
Fig. 6 is a schematic diagram showing the comparison of effects before and after the added fade-in and fade-out treatment according to the embodiment of the present application. As shown in fig. 6, it can be seen that before the fade-in process is added, the audio is directly truncated to end when the next song or seek to scene is encountered. And after the addition of the fade-in and fade-out process, when the next song or seek to scene is encountered, the audio is not directly truncated, but gradually faded so as to smoothly transition to the end.
The audio playing processing method provided by the embodiment of the application is applied to an audio system engine, particularly utilizes a sound mixing component AudioFlinger in the audio system engine as an implementation basis, can bypass the requirement of relying on a specific hardware platform interface, ensures cross-platform portability and has higher universality, and in addition, because the whole process is implemented on an operating system level, each application program does not need to independently modify codes to support a fade-in and fade-out function, a user can enjoy a consistent and high-quality audio transition effect no matter which application program is used, thereby realizing simplified development flow and reducing maintenance cost. In addition, the scheme can cover various audio playing scenes, such as music switching, pause/resume and the like, and further enhances the hearing experience of the user. And since AudioFlinger is close to the hardware (hzl) layer, a low-delay fade-in and fade-out effect can be achieved.
Exemplary apparatus
Corresponding to the audio playing processing method, the embodiment of the application also provides an audio playing processing device. Fig. 7 is a schematic structural diagram of an audio playing process according to an embodiment of the present application. As shown in fig. 7, the audio playing processing device provided by the embodiment of the application includes an obtaining unit 701, a fade-in fade-out processing unit 702 and a mixing unit 703, wherein the obtaining unit 701 is used for obtaining a playing state of audio data to be processed, the audio data to be processed is written into an audio buffer area of the audio system engine by an application program, the fade-in fade-out processing unit 702 is used for carrying out fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed, an audio processing result is obtained, and the mixing unit 703 is used for carrying out mixing according to the audio processing result and outputting the audio processing result to an audio playing device for playing.
In some embodiments, the audio data to be processed includes a plurality of audio data to be processed, where the fade-in fade-out processing unit 702 performs fade-in processing or fade-out processing on the audio data to be processed according to a playing state of the audio data to be processed, so as to obtain an audio processing result, where, for each audio data to be processed, when it is identified that the playing state of the audio data to be processed is a first preset state, fade-in processing is performed on the audio data to be processed, so as to obtain a fade-in audio corresponding to the audio data to be processed, where the first preset state is any one of a playing starting state and a playing state after being paused, and the audio mixing unit 703 mixes audio according to the audio processing result and outputs the audio data to an audio playing device through an audio hardware abstraction layer, where audio mixing is performed according to each audio data to be processed and the corresponding fade-in audio data, and outputs the audio data to the audio playing device through the audio hardware abstraction layer.
In some embodiments, the audio data to be processed includes a plurality of audio data to be processed, where the fade-in fade-out processing unit 702 performs fade-in processing or fade-out processing on the audio data to be processed according to a playing state of the audio data to be processed to obtain an audio processing result, and includes, for each audio data to be processed, performing fade-out processing on the audio data to be processed to obtain a second audio processing result when it is identified that the playing state of the audio data to be processed is a second preset state, where the second audio processing result includes fade-out audio, and the second preset state is any one of a stopped playing state and a paused playing state, and the mixing unit 703 performs mixing according to the audio processing result and outputs the audio processing result to an audio playing device through an audio hardware abstraction layer to play, where the audio processing result is performed according to each audio data to be processed and the corresponding fade-out audio respectively, and outputs the audio processing result to the audio playing device through the audio hardware abstraction layer to play.
In some embodiments, the fade-in and fade-out processing unit 702 performs fade-out processing on the audio data to be processed to obtain a second audio processing result when recognizing that the playing state of the audio data to be processed is a second preset state, where the fade-in and fade-out processing is performed on the played audio data according to the unreported audio data in the audio data to be processed when recognizing that the playing state of the audio data to be processed is a pause playing state, so as to obtain fade-out audio.
In some embodiments, the audio processing result includes fade-in audio or fade-out audio, and the fade-in fade-out processing unit 702 is further configured to control the volume of the fade-in audio or the fade-out audio to be changed from the play volume before interruption to the target play volume when the play is started after the interruption of the play of the fade-in audio or the fade-out audio.
In some embodiments, the obtaining unit 701 is further configured to obtain first configuration information of a fade-in function and a fade-out function, where the first configuration information includes a fade-in function and a fade-out function that are turned on, a fade-in function that is turned on, or a fade-out function that is turned on, where the fade-in fade-out processing unit 702 performs fade-in processing or fade-out processing on the audio data to be processed according to a playing state of the audio data to be processed, to obtain an audio processing result, where the first configuration information is a fade-in function that is turned on, performs fade-in processing on the audio data to be processed to obtain an audio processing result, where the first configuration information is a fade-out function that is turned on, performs fade-out processing on the audio data to be processed according to a playing state of the audio data to be processed to obtain an audio processing result, and where the first configuration information is a fade-in function that is turned on, performs fade-in processing or fade-out processing on the audio data to obtain an audio processing result.
In some embodiments, the obtaining unit 701 is further configured to obtain second configuration information of a fade-in function and a fade-out function, where the second configuration information includes a fade-in duration of the fade-in function and/or a fade-out duration of the fade-out function, and the fade-in fade-out processing unit 702 performs fade-in processing or fade-out processing on the to-be-processed audio data according to a playing state of the to-be-processed audio data to obtain an audio processing result, and includes performing fade-in processing on the to-be-processed audio data according to the playing state of the to-be-processed audio data and the fade-in duration to obtain an audio processing result, and/or performing fade-out processing on the to-be-processed audio data according to the playing state of the to-be-processed audio data and the fade-out duration to obtain the audio processing result.
Wherein the acquisition unit 701, the fade-in and fade-out processing unit 702 and the mixing unit 703 correspond to the mixing component AudioFlinger in the audio system engine. Specifically, the acquisition unit 701 and the fade-in and fade-out processing unit 702 correspond to Track components in the mixing component AudioFlinger, and the mixing unit 703 corresponds to PLAY THREAD components in the mixing component AudioFlinger.
The audio playing processing device provided in this embodiment belongs to the same application conception as the audio playing processing method provided in the above embodiment of the present application, and may execute the audio playing processing method provided in any of the above embodiments of the present application, and has a functional module and beneficial effects corresponding to executing the audio playing processing method. Technical details not described in detail in this embodiment may be referred to the specific processing content of the audio playing processing method provided in the foregoing embodiment of the present application, and will not be described herein.
The functions implemented by the above acquisition unit 701, the fade-in and fade-out processing unit 702, and the mixing unit 703 may be implemented by the same or different processors, respectively, and the embodiment of the present application is not limited.
It will be appreciated that the elements of the above apparatus may be implemented in the form of processor-invoked software. For example, the device includes a processor, where the processor is connected to a memory, and the memory stores instructions, and the processor invokes the instructions stored in the memory to implement any of the methods above or to implement functions of each unit of the device, where the processor may be a general-purpose processor, such as a CPU or a microprocessor, and the memory may be a memory within the device or a memory outside the device. Or the units in the device may be implemented in the form of hardware circuits, where the functions of some or all of the units may be implemented by designing a hardware circuit, where the hardware circuit may be understood as one or more processors, for example, in one implementation, the hardware circuit is an ASIC, where the functions of some or all of the units are implemented by designing a logic relationship between elements in the circuit, and in another implementation, the hardware circuit may be implemented by a PLD, for example, an FPGA, and may include a large number of logic gates, where the connection relationship between the logic gates is configured by a configuration file, so as to implement the functions of some or all of the units. All units of the above device may be realized in the form of processor calling software, or in the form of hardware circuits, or in part in the form of processor calling software, and in the rest in the form of hardware circuits.
In an embodiment of the present application, the processor is a circuit with signal processing capability, in one implementation, the processor may be a circuit with instruction reading and running capability, such as a CPU, a microprocessor, a GPU, or a DSP, etc., and in another implementation, the processor may implement a certain function through a logic relationship of a hardware circuit, where the logic relationship of the hardware circuit is fixed or reconfigurable, for example, the processor is a hardware circuit implemented by an ASIC or a PLD, such as an FPGA, etc. In the reconfigurable hardware circuit, the processor loads the configuration document, and the process of implementing the configuration of the hardware circuit may be understood as a process of loading instructions by the processor to implement the functions of some or all of the above units. Furthermore, a hardware circuit designed for artificial intelligence may be provided, which may be understood as an ASIC, such as NPU, TPU, DPU, etc.
It will be seen that each of the units in the above apparatus may be one or more processors (or processing circuits) configured to implement the above methods, e.g., CPU, GPU, NPU, TPU, DPU, a microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
Furthermore, the units in the above apparatus may be integrated together in whole or in part, or may be implemented independently. In one implementation, these units are integrated together and implemented in the form of an SOC. The SOC may include at least one processor for implementing any of the methods above or for implementing the functions of the units of the apparatus, where the at least one processor may be of different types, including, for example, a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, and the like.
Exemplary electronic device
An embodiment of the present application provides an electronic device, as shown in fig. 8, including:
a memory 200 and a processor 210;
Wherein the memory 200 is connected to the processor 210, and is used for storing a program;
The processor 210 is configured to implement the audio play processing method disclosed in any one of the above embodiments by running the program stored in the memory 200.
In particular, the electronic device may further include a bus, a communication interface 220, an input device 230, and an output device 240.
The processor 210, the memory 200, the communication interface 220, the input device 230, and the output device 240 are interconnected by a bus. Wherein:
A bus may comprise a path that communicates information between components of a computer system.
Processor 210 may be a general-purpose processor, such as a general-purpose Central Processing Unit (CPU), microprocessor, etc., or may be an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of programs in accordance with aspects of the present invention. But may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
Processor 210 may include a main processor, and may also include a baseband chip, modem, and the like.
The memory 200 stores programs for implementing the technical scheme of the present invention, and may also store an operating system and other key services. In particular, the program may include program code including computer-operating instructions. More specifically, memory 200 may include read-only memory (ROM), other types of static storage devices that may store static information and instructions, random access memory (random access memory, RAM), other types of dynamic storage devices that may store information and instructions, disk storage, flash, and the like.
The input device 230 may include means for receiving data and information entered by a user, such as a keyboard, mouse, camera, scanner, light pen, voice input device, touch screen, pedometer, or gravity sensor, among others.
Output device 240 may include means, such as a display screen, printer, speakers, etc., that allow information to be output to a user.
The communication interface 220 may include devices using any transceiver or the like for communicating with other devices or communication networks, such as ethernet, radio Access Network (RAN), wireless Local Area Network (WLAN), etc.
The processor 210 executes programs stored in the memory 200 and invokes other devices, which may be used to implement the steps of any of the audio playback processing methods provided in the above embodiments of the present application.
The embodiment of the application also provides a chip which comprises a processor and a data interface, wherein the processor reads and runs a program stored in a memory through the data interface so as to execute the audio playing processing method introduced by any embodiment, and the specific processing process and the beneficial effects thereof can be introduced by referring to the embodiment of the audio playing processing method.
Exemplary computer program product and storage Medium
In addition to the methods and apparatus described above, embodiments of the application may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the steps in the audio playback processing method according to various embodiments of the application described in any of the embodiments of the specification.
The computer program product may write program code for performing operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, an embodiment of the present application may also be a storage medium having stored thereon a computer program that is executed by a processor to perform the steps in the audio playback processing method according to the various embodiments of the present application described in any of the above embodiments of the present specification, and specifically, the steps of the above audio playback processing method may be implemented.
For the foregoing method embodiments, for simplicity of explanation, the methodologies are shown as a series of acts, but one of ordinary skill in the art will appreciate that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders or concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the apparatus class embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference is made to the description of the method embodiments for relevant points.
The steps in the method of each embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs, and the technical features described in each embodiment can be replaced or combined.
The modules and the submodules in the device and the terminal of the embodiments of the application can be combined, divided and deleted according to actual needs.
In the embodiments provided in the present application, it should be understood that the disclosed terminal, apparatus and method may be implemented in other manners. For example, the above-described terminal embodiments are merely illustrative, and for example, the division of modules or sub-modules is merely a logical function division, and there may be other manners of division in actual implementation, for example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules or sub-modules illustrated as separate components may or may not be physically separate, and components that are modules or sub-modules may or may not be physical modules or sub-modules, i.e., may be located in one place, or may be distributed over multiple network modules or sub-modules. Some or all of the modules or sub-modules may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional module or sub-module in the embodiments of the present application may be integrated in one processing module, or each module or sub-module may exist alone physically, or two or more modules or sub-modules may be integrated in one module. The integrated modules or sub-modules may be implemented in hardware or in software functional modules or sub-modules.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. 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.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software unit executed by a processor, or in a combination of the two. The software elements may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (11)

1. An audio play processing method, applied to an audio system engine, comprising:
Acquiring a playing state of audio data to be processed, wherein the audio data to be processed is written into an audio buffer area of the audio system engine by an application program;
According to the playing state of the audio data to be processed, fade-in processing or fade-out processing is carried out on the audio data to be processed, and an audio processing result is obtained;
And mixing the sound according to the audio processing result, and outputting the mixed sound to audio playing equipment for playing.
2. The method of claim 1, wherein the audio system engine comprises a mixing component AudioFlinger and an audio hardware abstraction layer of an android system, the audio data to be processed comprising a plurality of audio data to be processed;
And performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, wherein the method comprises the following steps of:
For each piece of audio data to be processed, when the audio mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a first preset state, fade-in processing is performed on the audio data to be processed, so as to obtain fade-in audio corresponding to the audio data to be processed, wherein the first preset state is any one of a playing starting state and a continuously playing state after pause;
The audio mixing is performed according to the audio processing result, and the audio is output to an audio playing device for playing through an audio hardware abstraction layer, comprising:
and mixing sound according to each piece of audio data to be processed and the corresponding fade-in audio through the sound mixing component AudioFlinger, and outputting the mixed sound to audio playing equipment through an audio hardware abstraction layer for playing.
3. The method of claim 1, wherein the audio system engine comprises a mixing component AudioFlinger and an audio hardware abstraction layer of an android system, the audio data to be processed comprising a plurality of audio data to be processed;
And performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, wherein the method comprises the following steps of:
for each piece of audio data to be processed, when the audio mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a second preset state, fade-out processing is performed on the audio data to be processed, so as to obtain a second audio processing result, wherein the second audio processing result comprises fade-out audio, and the second preset state is any one of a stopped playing state and a stopped playing state;
The audio mixing is performed according to the audio processing result, and the audio is output to an audio playing device for playing through an audio hardware abstraction layer, comprising:
And mixing sound according to each piece of audio data to be processed and the corresponding fade-out audio through the sound mixing component AudioFlinger, and outputting the mixed sound to audio playing equipment through an audio hardware abstraction layer for playing.
4. The method of claim 3, wherein, when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is the second preset state, performing fade-out processing on the audio data to be processed to obtain a second audio processing result, including:
And when the mixing component AudioFlinger recognizes that the playing state of the audio data to be processed is a pause playing state, performing fade-out processing on the played audio data according to the unreplaying audio data in the audio data to be processed, so as to obtain fade-out audio.
5. The method of claim 1, wherein the audio processing result includes fade-in audio or fade-out audio, the method further comprising:
and under the condition that the fade-in audio or the fade-out audio is started to be played after being interrupted, controlling the volume of the fade-in audio or the fade-out audio to be gradually changed from the playing volume before interruption to the target playing volume.
6. The method of any one of claims 1-5, further comprising obtaining first configuration information for a fade-in function and a fade-out function, the first configuration information comprising turning on the fade-in function and the fade-out function, turning on the fade-in function, or turning on the fade-out function;
And performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, wherein the method comprises the following steps of:
Under the condition that the first configuration information is a fade-in starting function, fade-in processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed, so that an audio processing result is obtained;
When the first configuration information is the on fade-out function, fade-out processing is carried out on the audio data to be processed according to the playing state of the audio data to be processed, and an audio processing result is obtained;
And under the condition that the first configuration information is a fade-in function and a fade-out function, carrying out fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed, so as to obtain an audio processing result.
7. The method according to any one of claims 1-5, further comprising obtaining second configuration information of a fade-in function and a fade-out function, the second configuration information comprising a fade-in duration of the fade-in function and/or a fade-out duration of the fade-out function;
And performing fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result, wherein the method comprises the following steps of:
According to the playing state of the audio data to be processed and the fade-in duration, fade-in processing is carried out on the audio data to be processed, and an audio processing result is obtained;
And/or the number of the groups of groups,
And according to the playing state and the fade-out time length of the audio data to be processed, carrying out fade-out processing on the audio data to be processed to obtain an audio processing result.
8. An audio play processing device, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the playing state of audio data to be processed, and the audio data to be processed is written into an audio buffer area of an audio system engine by an application program;
the fade-in and fade-out processing unit is used for carrying out fade-in processing or fade-out processing on the audio data to be processed according to the playing state of the audio data to be processed to obtain an audio processing result;
and the audio mixing unit is used for mixing audio according to the audio processing result and outputting the audio to audio playing equipment for playing.
9. An electronic device comprising a memory and a processor;
The memory is connected with the processor and used for storing programs;
The processor is configured to implement the method according to any one of claims 1 to 7 by running a program in the memory.
10. A storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1 to 7.
11. A computer program product comprising computer program instructions which, when executed by a processor, cause the processor to implement the method of any one of claims 1 to 7.
CN202510049528.6A 2025-01-13 2025-01-13 Audio playback processing method, device, equipment, medium and product Pending CN120034787A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202510049528.6A CN120034787A (en) 2025-01-13 2025-01-13 Audio playback processing method, device, equipment, medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202510049528.6A CN120034787A (en) 2025-01-13 2025-01-13 Audio playback processing method, device, equipment, medium and product

Publications (1)

Publication Number Publication Date
CN120034787A true CN120034787A (en) 2025-05-23

Family

ID=95733301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202510049528.6A Pending CN120034787A (en) 2025-01-13 2025-01-13 Audio playback processing method, device, equipment, medium and product

Country Status (1)

Country Link
CN (1) CN120034787A (en)

Similar Documents

Publication Publication Date Title
JP5054123B2 (en) User selectable audio mixing
US9602929B2 (en) Techniques for presenting sound effects on a portable media player
US8930590B2 (en) Audio device and method of operating the same
US8165321B2 (en) Intelligent clip mixing
CN103426449B (en) The impact of audio disruption is alleviated by the automatic quick audio playback of adaptability
WO2019062541A1 (en) Real-time digital audio signal mixing method and device
JP2009536500A (en) Method and system for notifying audio and video content to a user of a mobile radio terminal
CN113689062B (en) Agent coordination device, agent coordination method, and recording medium having agent coordination program recorded thereon
WO2018152679A1 (en) Audio file transmitting method and apparatus, audio file receiving method and apparatus, devices and system
US8498667B2 (en) System and method for mixing audio with ringtone data
JP3850616B2 (en) Information processing apparatus, information processing method, and computer-readable recording medium on which information processing program is recorded
CN101013595A (en) Media player and media playing method
WO2017101327A1 (en) Method and device for collective playback of high-fidelity sound by several players
JP5737357B2 (en) Music playback apparatus and music playback program
CN109508166B (en) Audio playing method, device, equipment and storage medium
CN115379355B (en) Managing target sound playback
CN120034787A (en) Audio playback processing method, device, equipment, medium and product
CN116074688A (en) Audio playing method, device and computer readable storage medium
US20050262256A1 (en) Method and device for multimedia processing
JP2012029224A (en) Acoustic data communication device
CA2563481C (en) Audio management in a dual processor environment
KR20130046752A (en) Immunicon Provision System and Method of Chat Program
KR20050113065A (en) Method for carrying out mp3 mode only function in mobile communication device
JP6273456B2 (en) Audio playback device
JP2009053581A (en) Speech output 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