CN112201283B - Audio playing method and device - Google Patents
Audio playing method and device Download PDFInfo
- Publication number
- CN112201283B CN112201283B CN202010940951.2A CN202010940951A CN112201283B CN 112201283 B CN112201283 B CN 112201283B CN 202010940951 A CN202010940951 A CN 202010940951A CN 112201283 B CN112201283 B CN 112201283B
- Authority
- CN
- China
- Prior art keywords
- audio
- playing
- played
- total number
- determining
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B20/00—Signal processing not specific to the method of recording or reproducing; Circuits therefor
- G11B20/10—Digital recording or reproducing
- G11B20/10527—Audio or video recording; Data buffering arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/16—Sound input; Sound output
- G06F3/165—Management of the audio stream, e.g. setting of volume, audio stream path
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B27/00—Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
- G11B27/10—Indexing; Addressing; Timing or synchronising; Measuring tape travel
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11B—INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
- G11B20/00—Signal processing not specific to the method of recording or reproducing; Circuits therefor
- G11B20/10—Digital recording or reproducing
- G11B20/10527—Audio or video recording; Data buffering arrangements
- G11B2020/10537—Audio or video recording
- G11B2020/10546—Audio or video recording specifically adapted for audio data
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
The disclosure relates to a multi-audio file playing method and device. The multi-audio file playing method comprises the following steps: receiving a play start instruction for a first audio; under the condition that N second audios are played currently, the total number of the audios to be played currently is updated to be N + 1; determining the playing switching time length; dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit; and sequentially and alternately playing an audio clip of each current audio to be played according to the time line, wherein the time interval between the playing ending moment of the previous audio clip and the playing starting moment of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value. Under the condition that a plurality of audios need to be played, the plurality of audios are played in turn according to the playing switching duration, so that the tone quality reduction caused by sound mixing is avoided, meanwhile, the listening effect of a user is also ensured, and the playing quality is improved.
Description
Technical Field
The present disclosure relates to the field of audio processing technologies, and in particular, to an audio playing method, an audio playing apparatus, an electronic device, and a computer-readable storage medium.
Background
Existing terminal devices, including mobile terminals such as mobile phones, can receive and output multi-track audio. If the sampling rates of the received audio files are the same, output is performed based on the same sampling rate. However, the sampling rate is different according to the audio source, and often different, for example, common sampling rates include 8000Hz commonly used in telephone communication, 11025Hz used in am broadcasting, 22050Hz used in fm broadcasting, 44100Hz used in CD audio, 48000Hz used in digital tv, and the like. When the sampling rates of the audio files are different, the sampling rates of the audio files need to be adjusted to a specified frequency by means of resampling and the like, and the audio files are output by mixing. This approach can cause degradation of sound quality.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides an audio playing method, an audio playing apparatus, an electronic device, and a computer-readable storage medium.
According to a first aspect of the embodiments of the present disclosure, there is provided an audio playing method, including: receiving a play start instruction for a first audio; responding to a play start instruction, and judging whether N second audios are currently played, wherein N is a positive integer greater than or equal to 1; under the condition that N second audios are played currently, the total number of the audios to be played currently is updated to be N +1, and the audio to be played currently comprises a first audio and N second audios; determining the playing switching time length; dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit; and sequentially playing an audio clip of each current audio to be played in turn according to the time line by taking the playing switching time length as a unit, wherein the time interval between the playing ending time of the previous audio clip and the playing starting time of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value.
In an embodiment, taking the play switching duration as a unit, sequentially playing an audio clip of each currently-played audio in turn according to a timeline, including: determining a playing sequence of the current audio to be played, wherein the first audio is positioned at the head of the playing sequence; and when the playing of the audio clip of any one audio of the current audio to be played is finished, based on the playing sequence, playing the next audio clip of the audio to be played according to the time line of the next audio to be played.
In an embodiment, the method further comprises: responding to a playing ending instruction of any one of the N +1 current audio to be played, updating the current audio to be played and updating the total number of the current audio to be played to be N; re-determining the play switching duration; and re-determining the playing sequence of the audio to be played currently.
In one embodiment, determining the play switching duration includes: and determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold value, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold value.
In one embodiment, determining the play switching duration includes: judging whether the total number N +1 of the current audio to be played is greater than a number threshold value; if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length; if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold.
In an embodiment, determining the play switching duration further includes: the playing switching time length is longer than a second preset time length.
In an embodiment, the sampling rate of the first audio is different from the sampling rate of at least one of the N second audios.
According to a second aspect of the embodiments of the present disclosure, there is provided an audio playing apparatus, the apparatus including: a receiving unit configured to receive a play start instruction for a first audio; the judging unit is used for responding to the playing start instruction and judging whether N second audios are currently played, wherein N is a positive integer greater than or equal to 1; the execution unit is used for updating the total number of the current audio to be played to be N +1 under the condition that the N second audios are played currently, wherein the current audio to be played comprises a first audio and the N second audios; determining the playing switching time length; dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit; and the playing unit is used for sequentially playing one audio clip of each current audio to be played in turn according to the time line by taking the playing switching time length as a unit, wherein the time interval between the playing ending time of the previous audio clip and the playing starting time of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value.
In an embodiment, the playback unit is further configured to: determining a playing sequence of the current audio to be played, wherein the first audio is positioned at the head of the playing sequence; and when the playing of the audio clip of any one audio of the current audio to be played is finished, based on the playing sequence, playing the next audio clip of the audio to be played according to the time line of the next audio to be played.
In one embodiment, the execution unit is further to: responding to a playing ending instruction of any one of the N +1 current audio to be played, updating the current audio to be played and updating the total number of the current audio to be played to be N; re-determining the play switching duration; and re-determining the playing sequence of the audio to be played currently.
In one embodiment, the execution unit is to: and determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold value, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold value.
In one embodiment, the execution unit is to: judging whether the total number N +1 of the current audio to be played is greater than a number threshold value; if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length; if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold.
In one embodiment, the execution unit is further to: the playing switching time length is longer than a second preset time length.
In an embodiment, the sampling rate of the first audio is different from the sampling rate of at least one of the N second audios.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a memory to store instructions; and a processor for calling the instructions stored in the memory to execute the audio playing method of the first aspect.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium storing instructions that, when executed by a processor, perform the audio playing method of the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
under the condition that a plurality of audios need to be played, through a plurality of audios played by the stream in the switching time length, the tone quality reduction caused by the mixed sound is avoided, and meanwhile, the user listening effect is also ensured, so that the playing quality and the user experience are improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method of playing a multi-audio file according to an exemplary embodiment;
FIG. 2 is a flow diagram illustrating another method of playing a multi-audio file in accordance with an exemplary embodiment;
FIG. 3 is a diagram illustrating the playing times of a multi-audio file according to an exemplary embodiment;
FIG. 4 is a schematic block diagram illustrating a multiple audio file playback device in accordance with an exemplary embodiment;
FIG. 5 is a schematic block diagram illustrating an apparatus in accordance with an exemplary embodiment.
FIG. 6 is a schematic block diagram illustrating an electronic device in accordance with an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
In some prior art, when a plurality of audio files are input and need to be output, if the sampling rates of the plurality of audio files are different, the sampling rates of the plurality of audio files need to be adjusted to be consistent through sound mixing processing, resampling and the like, so that the sound quality is reduced.
In order to solve the above problems, the present disclosure provides an audio playing method 10, which avoids the sound quality degradation caused by audio mixing, and the method can be used in various terminal devices, such as mobile phones, tablet computers, and the like, referring to fig. 1, the audio playing method 10 includes steps S11-S16, which are described in detail below:
in step S11, a play start instruction for the first audio is received.
The mobile terminal may obtain a system play instruction in some states, or may play a first audio based on a current application program of a user or a play instruction input by the user, where the first audio may be a system prompt tone, an audio in the application program, or other audio to be played according to the instruction.
Step S12, in response to the play start instruction, determines whether N second audios are currently being played, where N is a positive integer greater than or equal to 1.
After receiving an instruction of playing the first audio, judging whether other audio which is being played exists or not, and if the other audio is not played at present, directly playing the first audio. If there is an audio being played, step S13 and step S16 of the embodiment of the present disclosure need to be executed to ensure the sound effect quality of the simultaneous playing of multiple audios.
The plurality of second audios can be a plurality of different audios, and the sampling frequencies of the plurality of second audios can be the same or different; the first audio, and the second audio, may be audio having different sampling rates, in some embodiments the sampling rate of the first audio is different than the sampling rate of at least one of the N second audios due to different audio sources. Through the mode of the embodiment of the disclosure, the audio frequencies with different sampling rates are played simultaneously, the playing quality can be ensured, and the sound effect loss caused by resampling is avoided.
In step S13, under the condition that N second audios are currently being played, the total number of the currently to-be-played audios is updated to N +1, where the currently to-be-played audio includes the first audio and the N second audios.
When the second audio which is being played exists, the total number of the current audio to be played is updated, so that the playing switching time length can be determined and the alternate playing can be carried out based on the updated total number in the following process.
In step S14, the play switching time length is determined.
The user can determine the playing switching time length according to actual needs or equipment capability. The long switching time of the playing results in that when the playing is performed in turn later, the interval between two times of playing of a single audio is too long, and the interval may be perceived by human ears, so that the switching time is within a certain range to ensure that the human ears cannot recognize. A shorter switching time period can bring higher sound quality, but also causes a greater operational burden on the device, so that the setting of the switching time period can also be determined according to the device capability.
Step S15, with the play switching duration as a unit, respectively dividing the unplayed part of each audio in the currently to-be-played audio into a plurality of audio segments.
In the embodiment of the present disclosure, since the audio needs to be played in turn, according to the play switching duration, all the unplayed portions of the audio to be played are divided, that is, each audio is divided into a plurality of audio segments each having a time length equal to the play switching duration. The division referred to herein is a virtual division, and instead of dividing a complete audio into a plurality of file segments, the audio is divided only temporally on the time line of the audio to form a plurality of time intervals.
And step S16, taking the playing switching duration as a unit, sequentially playing an audio clip of each current audio to be played in turn according to the time line, wherein the time interval between the playing ending time of the previous audio clip and the playing starting time of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value.
Each audio has a respective time line, after the audio starts to be played, the time line starts to continuously advance, in the advancing process, the played audio is switched, even if one audio is not the currently switched played audio, the time line continuously advances, and when the audio is switched to be played, a corresponding audio clip needs to be played according to a node where the current time line of the audio advances. Meanwhile, in order to ensure the playing quality when each audio is played in turn, it is necessary to ensure that the playing interval of any one audio in two times cannot exceed a predetermined maximum threshold, and when the playing interval of one audio in two times exceeds a certain degree, the audio can be perceived by human ears. Generally, the predetermined maximum threshold may be set to 0.1 second, i.e. the playing end time of an audio segment of any playing audio, and the time between the next time when the audio is played by turns is 0.1 second. In some cases, the predetermined maximum threshold may also be set to a duration less than 0.1 second to ensure playback quality.
Through the embodiment, the audio quality reduction caused by resampling for simultaneously playing a plurality of audios can be avoided, so that the audio playing effect is ensured.
In an embodiment, as shown in fig. 2, step S16 may further include: step S161, determining a playing sequence of the current audio to be played, where the first audio is located at the head of the playing sequence; and step S162, when the playing of the audio clip of any one of the current audio to be played is finished, playing the next audio clip of the audio to be played according to the time line of the next audio to be played based on the playing sequence. In this embodiment, a plurality of audio frequencies to be played currently may be sequenced to form a playing sequence, and the audio frequencies are sequentially played in turn according to the sequence. In addition, in this embodiment, since the first audio is just added, in order to reduce the response time between the receiving of the first audio play start instruction and the actual playing of the first audio, the first audio may be set at the head of the play sequence. And if the second audio which is being played currently exists, determining a playing sequence according to all the audio which is required to be played simultaneously currently. According to the embodiment of the present disclosure, if there are a plurality of second audios that are played simultaneously, and these second audios are played according to the method of the embodiment of the present disclosure, there is a corresponding play sequence, at this time, only the first audio needs to be added to the head position of the existing play sequence, and then, the first audio is played in turn according to the updated play sequence. If there is no audio currently being played, a play sequence may be created according to the first audio, or a play sequence may be created later in the playing process if there is audio to be played simultaneously. For example, two audios are required to be played simultaneously currently, the playback switching time is set to 0.05 second, according to the timeline, an audio segment of 0-0.05 second from the current time start of the first audio a is played first, the audio segment is switched to the second audio B, the audio segment of 0.05 second after 0.05 second has been shifted on the playback timeline, and the audio segment of 0.1-0.15 second relative to the time start on the playback timeline of the first audio a is switched back again, so that the two audios are played alternately.
Since the time for starting playing of each audio is not necessarily the same, when playing in turns, playing in turns can be performed based on the transition of the respective timeline. Taking the two audios as an example, the audio a starts to be played for 1 second, at this time, the audio B needs to be played based on the instruction, the playing switching time length is determined to be 0.05 second, after the sequence of the two audios is determined, the audio a starts to be played in turn, and the audio clip of the audio B is played in 0-0.05 second of the time line of the audio B; then switching is carried out, the audio A is played, and at the moment, based on the time line of the audio A, the audio segment of 1.05-1.1 seconds on the time line is played; then switching is carried out, and audio clips of 0.15-0.2 seconds on the audio B time line are played, and the like.
According to the embodiment of the disclosure, the plurality of audios can be audio files with different sampling rates, and the method of the embodiment can output the plurality of audios in high quality, so that the tone quality reduction caused by sound mixing is avoided.
In an embodiment, the audio playing method 10 may further include: responding to a playing ending instruction of any one of the N +1 current audio to be played, updating the current audio to be played and updating the total number of the current audio to be played to be N; re-determining the play switching duration; and re-determining the playing sequence of the audio to be played currently. In this embodiment, the total number of the currently-played audio may be updated based on a user instruction, or an end instruction issued when the audio playing is finished, or the like. And simultaneously, the playing time length and the playing sequence are also determined again. After the playing time length is determined again, the audio to be played currently can be divided again. Since the original playing sequence has an audio technology, the playing sequence needs to be updated again, and the audio that is finished playing is removed from the original playing sequence, so as to avoid that the audio that is finished playing interferes the process when the audio is played in turn, and the audio that is not finished playing can be played in turn smoothly. In this embodiment, the durations of the multiple audios may be different, and the playing start times may also be different, and in the process of playing in turns, if one or more of the audios finishes playing, the audio is not played again, and the rest audios continue to be played in turns. If only one audio is left, only the audio needs to be played until all the audio is played.
In one embodiment, step S14 may include: and determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold value, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold value. In this embodiment, the mode of determining the playing switching duration is mainly determined according to the predetermined maximum threshold and the total number of the currently to-be-played audio, and as mentioned above, it needs to be ensured that an interval between two times of playing audio segments of an audio in the process of sequentially playing the audio in turn cannot exceed the predetermined maximum threshold, and the interval is the duration of playing other N audio to be played in turn, therefore, according to this relationship, a quotient obtained by dividing the predetermined maximum threshold by N (the total number of the currently to-be-played audio is N +1) is used as the playing switching duration, so that the playing effect is ensured, and the power consumption of the device operation is also maximally reduced.
In another embodiment, step S14 may include: determining the play switching time length comprises the following steps: judging whether the total number N +1 of the current audio to be played is greater than a number threshold value; if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length; if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold. In this embodiment, a suitable first preset duration may be preset and used as the play switching duration to ensure the effect of alternate playing. Meanwhile, if too many audios need to be played simultaneously, the first preset time length is adopted, which may cause that the interval between two playing of the same audio is too long and is longer than the preset maximum threshold value in the process of sequentially playing the same audio in turn. Therefore, a quantity threshold value can be determined according to the mode of dividing the preset maximum threshold value by the first preset time length and the like, and when the total number of the current audio to be played does not exceed the quantity threshold value, the first preset time length is directly adopted as the playing switching time length, so that the method is simple and efficient; when the total number of the current audio to be played exceeds the number threshold, the play switching duration may be determined in the manner of the foregoing embodiment, so as to ensure the play quality.
In an embodiment, step S14 may further include: the playing switching time length is longer than a second preset time length. If the audio segment into which an audio is divided is segmented, i.e. the playback switching time is too short, the playback quality is also affected. Therefore, a second preset time length which is less than the first preset time length is set, and when the playing switching time length is determined, the playing switching time length is ensured to be greater than the second preset time length, so that the playing quality is ensured. If the playing switching time length determined based on the total number of the current audio to be played cannot meet the requirement of being longer than the second preset time length, the playing can be paused or prompt information can be sent out to inform the user.
Fig. 3 illustrates a time diagram of playing multiple audios by turns according to the audio playing method 10 of the present disclosure, as shown in fig. 3, including four audio files: audio a, audio B, audio C and audio D, the audio duration being 0.25 second, 0.15 second, 0.25 second and 0.4 second, respectively. In practice, the audio duration is typically long, and this example is only for the purpose of showing the features of the embodiments of the present disclosure, and therefore is illustrated by way of example of a short duration. In this example, the audio a starts playing first, only one audio a exists at this time, no rotation is needed, when playing reaches 0.1 second, based on the instruction, the audio B, the audio C, and the audio D need to be played simultaneously, the play switching time length is determined to be 0.025 second, according to the method of the embodiment of the present disclosure, each audio is divided into audio segments with a time length of 0.025 second, and then the audio segments are played in turn based on the respective timeline and the play switching time length, in this example, the determined sequence of the playing sequence is the audio a, the audio B, the audio C, and the audio D, after being switched to the audio B to play for 0.025 second, the audio C is switched, and so on. When the time line of the audio A reaches 0.25 second, the audio A and the audio B are played completely, at this time, the audio A and the audio B are removed from the playing sequence, the total updating amount is 2, the updating switching time length is 0.05 second, the updated playing sequence is audio C and audio D, and alternate playing is continued on the basis. When the time line of the audio C reaches 0.25 second, the audio C finishes playing, and then the audio D is continuously played until the audio D finishes playing due to the existence of only the audio D.
Based on the same inventive concept, fig. 4 shows an audio playing apparatus 100, and as shown in fig. 5, the audio playing apparatus 100 includes: a receiving unit 110 configured to receive a play start instruction for a first audio; the determining unit 120, in response to the play start instruction, determines whether N second audios are currently being played, where N is a positive integer greater than or equal to 1; the execution unit 130 is configured to update the total number of currently to-be-played audios to N +1 when N second audios are currently being played, where the currently to-be-played audio includes a first audio and N second audios; determining the playing switching time length; dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit; the playing unit 140 is configured to sequentially play one audio clip of each currently to-be-played audio in turn according to a time line by taking the play switching duration as a unit, where a time interval on the time line between a play ending time of a previous audio clip and a play starting time of a next audio clip of each currently to-be-played audio does not exceed a predetermined maximum threshold.
In an embodiment, the playing unit 140 is further configured to: determining a playing sequence of the current audio to be played, wherein the first audio is positioned at the head of the playing sequence; and when the playing of the audio clip of any one audio of the current audio to be played is finished, based on the playing sequence, playing the next audio clip of the audio to be played according to the time line of the next audio to be played.
In an embodiment, the execution unit 130 is further configured to: responding to a playing ending instruction of any one of the N +1 current audio to be played, updating the current audio to be played and updating the total number of the current audio to be played to be N; re-determining the play switching duration; and re-determining the playing sequence of the audio to be played currently.
In one embodiment, the execution unit 130 is configured to: and determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold value, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold value.
In one embodiment, the execution unit 130 is configured to: judging whether the total number N +1 of the current audio to be played is greater than a number threshold value; if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length; if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching time length according to the total number N +1 of the current audio to be played and a preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold.
In an embodiment, the execution unit 130 is further configured to: the playing switching time length is longer than a second preset time length.
In an embodiment, the sampling rate of the first audio is different from the sampling rate of at least one of the N second audios.
With regard to the audio playback apparatus 100 in the above-described embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
Fig. 5 is a schematic block diagram illustrating an apparatus of any of the previous embodiments in accordance with an exemplary embodiment. For example, the apparatus 200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, the apparatus 200 may include one or more of the following components: a processing component 202, a memory 204, a power component 206, a multimedia component 208, an audio component 210, an input/output (I/O) interface 212, a sensor component 214, and a communication component 216.
The processing component 202 generally controls overall operation of the device 200, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 202 may include one or more processors 220 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 202 can include one or more modules that facilitate interaction between the processing component 202 and other components. For example, the processing component 202 can include a multimedia module to facilitate interaction between the multimedia component 208 and the processing component 202.
The memory 204 is configured to store various types of data to support operations at the apparatus 200. Examples of such data include instructions for any application or method operating on the device 200, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 204 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 208 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 200 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 210 is configured to output and/or input audio signals. For example, audio component 210 includes a Microphone (MIC) configured to receive external audio signals when apparatus 200 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 204 or transmitted via the communication component 216. In some embodiments, audio component 210 also includes a speaker for outputting audio signals.
The I/O interface 212 provides an interface between the processing component 202 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 214 includes one or more sensors for providing various aspects of status assessment for the device 200. For example, the sensor assembly 214 may detect an open/closed state of the device 200, the relative positioning of components, such as a display and keypad of the device 200, the sensor assembly 214 may also detect a change in the position of the device 200 or a component of the device 200, the presence or absence of user contact with the device 200, the orientation or acceleration/deceleration of the device 200, and a change in the temperature of the device 200. The sensor assembly 214 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 216 is configured to facilitate wired or wireless communication between the apparatus 300 and other devices. The device 200 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 216 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 216 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 200 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as memory 204 comprising instructions, executable by processor 220 of apparatus 200 to perform the above-described method is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 6 is a block diagram illustrating an electronic device 300 according to an example embodiment. For example, the apparatus 300 may be provided as a server. Referring to FIG. 6, apparatus 300 includes a processing component 322 that further includes one or more processors and memory resources, represented by memory 342, for storing instructions, such as application programs, that are executable by processing component 322. The application programs stored in memory 342 may include one or more modules that each correspond to a set of instructions. Further, the processing component 322 is configured to execute instructions to perform the above-described methods.
The apparatus 300 may also include a power component 326 configured to perform power management of the apparatus 300, a wired or wireless network interface 350 configured to connect the apparatus 300 to a network, and an input/output (I/O) interface 358. The apparatus 300 may operate based on an operating system stored in the memory 342, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (14)
1. An audio playing method, the method comprising:
receiving a play start instruction for a first audio;
responding to the play starting instruction, and judging whether N second audios are currently played, wherein N is a positive integer greater than or equal to 1;
under the condition that N second audios are currently played, updating the total number of the currently to-be-played audios to be N +1, wherein the currently to-be-played audios comprise the first audio and the N second audios;
determining the playing switching time length;
dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit; and the number of the first and second groups,
sequentially and alternately playing an audio clip of each current audio to be played according to a time line by taking the playing switching duration as a unit, wherein the time interval between the playing ending time of the previous audio clip and the playing starting time of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value;
the sampling rate of the first audio is different from the sampling rate of at least one of the N second audios.
2. The audio playing method according to claim 1, wherein said sequentially playing in turn one audio clip of each currently-played audio according to a time line with the playing switching duration as a unit comprises:
determining a playing sequence of the current audio to be played, wherein the first audio is located at the head of the playing sequence;
and when the playing of the audio clip of any one of the current audio to be played is finished, playing the next audio clip of the audio to be played according to the time line of the next audio to be played based on the playing sequence.
3. The audio playing method according to claim 2, further comprising:
responding to a playing ending instruction of any one of the N +1 audio to be played currently, updating the audio to be played currently and updating the total number of the audio to be played currently to N;
re-determining the play switching duration;
and re-determining the playing sequence of the current audio to be played.
4. The audio playing method of claim 1, wherein the determining the playing switching duration comprises:
and determining the playing switching time length according to the total number N +1 of the current audio to be played and the preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold.
5. The audio playing method of claim 1, wherein the determining the playing switching duration comprises:
judging whether the total number N +1 of the current audio to be played is greater than a number threshold value;
if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length;
if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching duration according to the total number N +1 of the current audio to be played and the preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching duration and is equal to the preset maximum threshold.
6. The audio playing method according to claim 4 or 5, wherein the determining the playing switching duration further comprises:
the playing switching time length is greater than a second preset time length.
7. An audio playback apparatus, comprising:
a receiving unit configured to receive a play start instruction for a first audio;
the judging unit is used for responding to the playing start instruction and judging whether N second audios are currently played, wherein N is a positive integer greater than or equal to 1;
the execution unit is used for updating the total number of the current audio to be played to be N +1 under the condition that N second audios are currently played, wherein the current audio to be played comprises the first audio and the N second audios; determining the playing switching time length; dividing the unplayed part of each audio frequency in the current audio frequency to be played into a plurality of audio frequency segments by taking the playing switching duration as a unit;
the playing unit is used for sequentially playing one audio clip of each current audio to be played in turn according to a time line by taking the playing switching duration as a unit, wherein the time interval between the playing ending time of the previous audio clip and the playing starting time of the next audio clip of each current audio to be played on the time line does not exceed a preset maximum threshold value;
the sampling rate of the first audio is different from the sampling rate of at least one of the N second audios.
8. The audio playback device of claim 7, wherein the playback unit is further configured to:
determining a playing sequence of the current audio to be played, wherein the first audio is located at the head of the playing sequence;
and when the playing of the audio clip of any one of the current audio to be played is finished, playing the next audio clip of the audio to be played according to the time line of the next audio to be played based on the playing sequence.
9. The audio playback device of claim 8, wherein the execution unit is further configured to:
responding to a playing ending instruction of any one of the N +1 audio to be played currently, updating the audio to be played currently and updating the total number of the audio to be played currently to N;
re-determining the play switching duration;
and re-determining the playing sequence of the current audio to be played.
10. The audio playback device of claim 7, wherein the execution unit is configured to:
and determining the playing switching time length according to the total number N +1 of the current audio to be played and the preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching time length and is equal to the preset maximum threshold.
11. The audio playback device of claim 7, wherein the execution unit is configured to:
judging whether the total number N +1 of the current audio to be played is greater than a number threshold value;
if the total number N +1 of the current audio to be played is less than or equal to the number threshold, determining the playing switching time length based on a first preset time length;
if the total number N +1 of the current audio to be played is greater than the number threshold, determining the playing switching duration according to the total number N +1 of the current audio to be played and the preset maximum threshold, wherein the value N obtained by subtracting 1 from the total number N +1 of the current audio to be played is multiplied by the playing switching duration and is equal to the preset maximum threshold.
12. The audio playback device of claim 10 or 11, wherein the execution unit is further configured to:
the playing switching time length is greater than a second preset time length.
13. An electronic device, comprising:
a memory to store instructions; and
a processor for invoking the memory-stored instructions to perform the audio playback method of any of claims 1-6.
14. A computer-readable storage medium storing instructions which, when executed by a processor, perform the audio playback method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010940951.2A CN112201283B (en) | 2020-09-09 | 2020-09-09 | Audio playing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010940951.2A CN112201283B (en) | 2020-09-09 | 2020-09-09 | Audio playing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112201283A CN112201283A (en) | 2021-01-08 |
CN112201283B true CN112201283B (en) | 2022-02-08 |
Family
ID=74005792
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010940951.2A Active CN112201283B (en) | 2020-09-09 | 2020-09-09 | Audio playing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112201283B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8639369B1 (en) * | 2009-09-01 | 2014-01-28 | Adobe Systems Incorporated | Audio testing of media player |
CN103677714A (en) * | 2013-12-09 | 2014-03-26 | 联想(北京)有限公司 | Information processing method and electronic equipment |
CN106373600A (en) * | 2016-10-08 | 2017-02-01 | 广东欧珀移动通信有限公司 | Audio synchronous play method, audio synchronous play device, audio synchronous play system and terminal |
CN107122158A (en) * | 2017-04-14 | 2017-09-01 | 北京小米移动软件有限公司 | The method and device of broadcast information prompting audio, electronic equipment |
CN110519680A (en) * | 2019-10-28 | 2019-11-29 | 展讯通信(上海)有限公司 | Audio parts test method and device |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7169996B2 (en) * | 2002-11-12 | 2007-01-30 | Medialab Solutions Llc | Systems and methods for generating music using data/music data file transmitted/received via a network |
US9002839B1 (en) * | 2007-09-28 | 2015-04-07 | Amazon Technologies, Inc. | Personalizing content for users |
WO2011067625A1 (en) * | 2009-12-01 | 2011-06-09 | Nxp B.V. | A system for processing audio data |
CN103297896B (en) * | 2012-02-27 | 2016-07-06 | 联想(北京)有限公司 | A kind of audio-frequency inputting method and electronic equipment |
CA3029037C (en) * | 2013-04-05 | 2021-12-28 | Dolby International Ab | Audio encoder and decoder |
CN103294442B (en) * | 2013-06-03 | 2016-04-13 | 小米科技有限责任公司 | A kind of method of playing alert tones, device and terminal device |
US10028012B2 (en) * | 2014-12-30 | 2018-07-17 | Echostar Technologies L.L.C. | Apparatus, systems and methods for audio content shuffling |
US9947364B2 (en) * | 2015-09-16 | 2018-04-17 | Google Llc | Enhancing audio using multiple recording devices |
CN106384603A (en) * | 2016-09-30 | 2017-02-08 | 四川九洲电器集团有限责任公司 | Music play method and music play device |
US10229716B2 (en) * | 2016-09-30 | 2019-03-12 | Spotify Ab | Methods and systems for grouping playlist audio items |
CN108153898A (en) * | 2018-01-10 | 2018-06-12 | 上海展扬通信技术有限公司 | Audio frequency playing method, terminal and computer readable storage medium |
CN109840052B (en) * | 2019-01-31 | 2022-03-18 | 成都超有爱科技有限公司 | Audio processing method and device, electronic equipment and storage medium |
CN111028867B (en) * | 2019-11-26 | 2022-03-11 | 维沃移动通信有限公司 | Audio playing method and electronic equipment |
CN111177453B (en) * | 2020-01-07 | 2023-11-14 | 百度在线网络技术(北京)有限公司 | Method, apparatus, device and computer readable storage medium for controlling audio playing |
-
2020
- 2020-09-09 CN CN202010940951.2A patent/CN112201283B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8639369B1 (en) * | 2009-09-01 | 2014-01-28 | Adobe Systems Incorporated | Audio testing of media player |
CN103677714A (en) * | 2013-12-09 | 2014-03-26 | 联想(北京)有限公司 | Information processing method and electronic equipment |
CN106373600A (en) * | 2016-10-08 | 2017-02-01 | 广东欧珀移动通信有限公司 | Audio synchronous play method, audio synchronous play device, audio synchronous play system and terminal |
CN107122158A (en) * | 2017-04-14 | 2017-09-01 | 北京小米移动软件有限公司 | The method and device of broadcast information prompting audio, electronic equipment |
CN110519680A (en) * | 2019-10-28 | 2019-11-29 | 展讯通信(上海)有限公司 | Audio parts test method and device |
Also Published As
Publication number | Publication date |
---|---|
CN112201283A (en) | 2021-01-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3188066B1 (en) | A method and an apparatus for managing an application | |
CN106911961B (en) | Multimedia data playing method and device | |
RU2666966C2 (en) | Audio playback control method and device | |
CN107743244B (en) | Video live broadcasting method and device | |
CN106792173B (en) | Video playing method and device and non-transitory computer readable storage medium | |
US20220248083A1 (en) | Method and apparatus for video playing | |
CN110995929A (en) | Terminal control method, device, terminal and storage medium | |
CN111583952B (en) | Audio processing method, device, electronic equipment and storage medium | |
US20220291897A1 (en) | Method and device for playing voice, electronic device, and storage medium | |
CN110519655B (en) | Video editing method, device and storage medium | |
US11146854B2 (en) | Method for playing videos and electronic device | |
CN108769769B (en) | Video playing method and device and computer readable storage medium | |
CN110719530A (en) | Video playing method and device, electronic equipment and storage medium | |
CN111182328B (en) | Video editing method, device, server, terminal and storage medium | |
CN112837709B (en) | Method and device for splicing audio files | |
CN114416015A (en) | Audio adjusting method and device, electronic equipment and readable storage medium | |
CN110992920A (en) | Live broadcasting chorus method and device, electronic equipment and storage medium | |
CN104837020B (en) | The method and apparatus for playing video | |
CN106528442B (en) | Cache cleaning method and device | |
CN113259776A (en) | Binding method and device of caption and sound source | |
CN112201283B (en) | Audio playing method and device | |
CN111290843A (en) | Process management method and device | |
CN108491180B (en) | Audio playing method and device | |
CN107340990B (en) | Playing method and device | |
CN108769780B (en) | Advertisement playing method and 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 | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20221229 Address after: 430000 No. 006, floor 1, No. 66, Jiufeng 1st Road, Donghu New Technology Development Zone, Wuhan, Hubei Province (Wuhan area of free trade zone) Patentee after: Xiaomi Technology (Wuhan) Co.,Ltd. Address before: 100085 No.004, 3rd floor, building 6, courtyard 33, Xierqi Middle Road, Haidian District, Beijing Patentee before: Beijing Xiaomi pinecone Electronic Co.,Ltd. |