Invention content
The purpose of the present invention is intended to solve at least some of the technical problems in related technologies.
For this purpose, first purpose of the present invention is to propose a kind of generation method of audio file.This method is only increasing
Under the premise of a small amount of memory space, key frame is increased for audio file by cubic spline interpolation, avoids conventional key frame
The problem of accounting for resource and poor precision is compared in storage, while by introducing key frame to audio file, is realized audio file and broadcast
Progress monitoring when putting.
Second object of the present invention is to propose a kind of generating means of audio file.
Third object of the present invention is to propose a kind of playback method of audio file.
Fourth object of the present invention is to propose a kind of playing device of audio file.
To achieve these goals, the generation method of the audio file of first aspect present invention embodiment, including:Obtain sound
The total duration of frequency evidence and the audio data, and the audio data is encoded according to preset duration step value;It obtains
Take the preset value of the top of file of reserved audio file;According to the total duration of the audio data, the preset duration step
Key frame numerical value is generated to sequence into the coded audio data after value, coding and the preset value of the reserved top of file;With
And the key frame numerical value is subjected to cubic spline interpolation to sequence as interpolation condition, to generate cubic spline function, and will
The top of file of cubic spline function write-in audio file and will be described in the coded audio data write-in after the coding
In audio file.
The generation method of audio file according to embodiments of the present invention, can first obtain audio data and audio data it is total when
It is long, and audio data is encoded according to preset duration step value, the file header of reserved audio file can be obtained later
The preset value in portion, and according to the coded audio data after the total duration of audio data, preset duration step value, coding and reserve
Top of file preset value generation key frame numerical value to sequence, finally using key frame numerical value to sequence as interpolation condition progress
Cubic spline interpolation will be encoded to generate cubic spline function, and by the top of file of cubic spline function write-in audio file
In coded audio data write-in audio file afterwards, so as to generate a complete audio file, i.e., only increasing a small amount of storage
Under the premise of space, key frame is increased for audio file by cubic spline interpolation, conventional key frame storage is avoided and compares
The problem of accounting for resource and poor precision reduces the size of audio file, while by introducing key frame to audio file, real
Progress monitoring when audio file plays is showed.
To achieve these goals, the generating means of the audio file of second aspect of the present invention embodiment, including:First obtains
Modulus block, for obtaining the total duration of audio data and the audio data;Coding module, for according to preset duration stepping
Value encodes the audio data;Second acquisition module, for obtaining the default of the top of file of reserved audio file
Value;First generation module, for according to the audio data total duration, the preset duration step value, coding after sound
The preset value of frequency coded data and the reserved top of file generates key frame numerical value to sequence;And second generation module,
For the key frame numerical value to be carried out cubic spline interpolation as interpolation condition to sequence, to generate cubic spline function, and
Institute is written by the top of file of cubic spline function write-in audio file and by the coded audio data after the coding
It states in audio file.
The generating means of audio file according to embodiments of the present invention, can by the first acquisition module obtain audio data and
The total duration of audio data, coding module encode audio data according to preset duration step value, the second acquisition module
Obtain the preset value of the top of file of reserved audio file, the first generation module is according to the total duration of audio data, preset
The preset value generation key frame numerical value of coded audio data and reserved top of file after duration step value, coding to sequence,
Key frame numerical value is carried out cubic spline interpolation to generate cubic spline by the second last generation module to sequence as interpolation condition
Function, and by cubic spline function write-in audio file top of file, by after coding coded audio data write-in audio text
In part, so as to generate a complete audio file, i.e., under the premise of a small amount of memory space is only increased, inserted by cubic spline
Be worth increases key frame for audio file, avoids conventional key frame storage and compares the problem of accounting for resource and poor precision, reduces
The size of audio file, while by introducing key frame to audio file, realize progress monitoring when audio file plays.
To achieve these goals, the playback method of the audio file of third aspect present invention embodiment, the audio text
Part is that the generation method of the audio file of embodiment according to a first aspect of the present invention generates, and the playback method includes:It obtains
The audio file;When receiving the broadcasting audio file instruction, the file header of the audio file is read and initialized
Cubic spline function in portion;The progression time value of input is obtained, and according to the progression time value and the cubic spline letter
Number obtains the corresponding audio file location of the progression time value;According to the corresponding audio file location pair of the progression time value
Audio file plays out.
The playback method of audio file according to embodiments of the present invention can first obtain audio file, receive broadcasting sound
When frequency file instructs, obtain and initialize the cubic spline function in the top of file of audio file, input can be obtained later
Progression time value, and the corresponding audio file location of progression time value is obtained according to progression time value and cubic spline function, most
Audio file is played out according to progression time value corresponding audio file location afterwards, i.e., it is a small amount of by only being done to player
Transformation can support the dragging of progress, realize the progress monitoring function of audio, improve user experience.
To achieve these goals, the playing device of the audio file of fourth aspect present invention embodiment, the audio text
Part is that the generation method of the audio file of embodiment according to a first aspect of the present invention generates, and the playing device includes:First
Acquisition module, for obtaining the audio file;Read module, for when receiving the broadcasting audio file instruction, reading
It takes and initializes the cubic spline function in the top of file of the audio file;Second acquisition module, for obtaining input
Progression time value, and the corresponding audio of the progression time value is obtained according to the progression time value and the cubic spline function
Document location;Playing module, for being played out according to the corresponding audio file location of the progression time value to audio file.
The playing device of audio file according to embodiments of the present invention can obtain audio file by the first acquisition module,
Read module receive play audio file instruction when, obtain and initialize the cubic spline in the top of file of audio file
Function, the second acquisition module obtains the progression time value of input, and obtains progress according to progression time value and cubic spline function
The corresponding audio file location of time value, playing module according to the corresponding audio file location of progression time value to audio file into
Row plays, i.e., can support the dragging of progress by only doing a small amount of transformation to player, realize the progress monitoring work(of audio
Can, improve user experience.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partly become from the following description
It obtains significantly or is recognized by the practice of the present invention.
Specific embodiment
The embodiment of the present invention is described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end
Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached
The embodiment of figure description is exemplary, it is intended to for explaining the present invention, and is not considered as limiting the invention.
Below with reference to the accompanying drawings generation method, playback method and the device of the audio file of the embodiment of the present invention are described.
Fig. 1 is the flow chart of the generation method of audio file according to an embodiment of the invention.As shown in Figure 1, the sound
The generation method of frequency file can include:
S101 obtains the total duration of audio data and audio data, and according to preset duration step value to audio data
It is encoded.
Wherein, it should be noted that in an embodiment of the present invention, audio data is the original not through overcompression etc. reason
The voice data of beginning, i.e. PCM (Pulse Code Modulation, pulse code modulation) data.
Specifically, audio data total duration corresponding with the audio data can be first obtained, it later can be according to preset duration
Step value (such as 0.1 second or 0.5 second) encodes audio data.It wherein, in an embodiment of the present invention, can be by non-
Constant code rate (i.e. elongated code check) encodes audio data.For example, by taking preset duration step value is 0.1 second as an example, when
When being encoded to audio data, the audio block data (i.e. PCM data) of 0.1 second can be encoded every time, until all audio numbers
It is completed according to coding.
S102 obtains the preset value of the top of file of reserved audio file.
It should be appreciated that in an embodiment of the present invention, the preset value of the top of file of reserved audio file is appreciated that
For the size reserved in advance in the top of file of audio file, for example, 1kBytes (1K bytes), i.e. 1024Bytes (byte).
S103 according to the coded audio data after the total duration of audio data, preset duration step value, coding and is reserved
Top of file preset value generate key frame numerical value to sequence.
In order to avoid the problem of accounting for resource etc. is compared in conventional key frame storage, in the embodiment of invention, three are can be used
Secondary batten difference functions preserve key frame.Specifically, in one embodiment of the invention, as shown in Fig. 2, can by with
Lower step generates key frame numerical value to sequence:
S201, using preset duration step value as difference, when the total duration of audio data is split to obtain broadcasting
Between value sequence, reproduction time value sequence include multiple reproduction time values, multiple reproduction time values are with preset duration step value
It is arranged for difference.
For example, it is assumed that the total duration of the audio data got is 241.2 seconds, and preset duration step value is 0.1
Second, the total duration of audio data can be split for 241.2 seconds with 0.1 second for difference, obtains a reproduction time value sequence,
I.e. 0.1,0.2,0.3 ..., 240.1,241.2, wherein unit be the second.As can be seen that the broadcasting in reproduction time value sequence
Time value is with 0.1 increasing sequence for difference.
S202 obtains the size of the audio block coded data after the corresponding coding of each reproduction time value.
That is, each reproduction time value corresponds to an audio block data, encoded to these audio block data
During, the size after the corresponding audio block data encoding of each reproduction time value can be obtained.For example, with reproduction time value sequence
Be classified as 0.1,0.2,0.3 ..., 240.1,241.2, unit it is right for 0.1 second for reproduction time value for the second, can be obtained respectively
After size after the audio block data encoding answered is 358byte, reproduction time value is 0.2 second corresponding audio block data encoding
Size be 386byte ..., reproduction time value be size after 241.2 seconds corresponding audio block data encodings be 377byte,
It can be by such as the following table 2 come the correspondence and size of recording played time value and the audio block coded data after coding.
Time (second) |
0.1 |
0.2 |
0.3 |
0.4 |
0.5 |
… |
240.0 |
240.1 |
241.2 |
Size (byte) |
358 |
386 |
410 |
327 |
334 |
… |
405 |
319 |
377 |
Table 2
S203 is compiled according to the audio block after the preset value of reserved top of file and the corresponding coding of each reproduction time value
The size of code data, obtains the corresponding audio file location of each reproduction time value.
For example, with the data instance in table 2 above, it can be first by the sound after the corresponding coding of each reproduction time value in table 2
The size of frequency block coded data is converted, later plus the preset value 1K of reserved top of file on the basis of transformation result
Byte, you can obtain the corresponding audio file location of each reproduction time value, can by such as the following table 3 come represent reproduction time value with
The correspondence and size of its corresponding audio file location.
Time (second) |
0.1 |
0.2 |
0.3 |
0.4 |
0.5 |
… |
240.0 |
240.1 |
241.2 |
Position (byte) |
1382 |
1768 |
2178 |
2505 |
2839 |
… |
843244 |
843563 |
843940 |
Table 3
With reference to table 2 and table 3 as can be seen that calculating process of the reproduction time value for 0.1 second corresponding audio file location:It broadcasts
Time value is put as the pre- of the top of file of the size (358byte)+reserved of the audio block coded data after 0.1 second corresponding coding
If being worth (1K bytes (i.e. 1024 bytes)), calculating process of the reproduction time value for 0.2 second corresponding audio file location:During broadcasting
Between value be size (386byte)+reproduction time value of audio block coded data after 0.2 second corresponding coding be 0.1 second correspondence
Audio file location (1382byte), calculating process of the reproduction time value for 0.3 second corresponding audio file location:During broadcasting
Between value be size (410byte)+reproduction time value of audio block coded data after 0.3 second corresponding coding be 0.2 second correspondence
Audio file location (1768byte) ... ..., calculating of the reproduction time value for 241.2 seconds corresponding audio file locations
Journey:Size (377byte)+reproduction time value of the reproduction time value for the audio block coded data after 241.2 seconds corresponding codings
For 240.1 seconds corresponding audio file locations (843563byte).That is, first broadcasting in reproduction time value sequence
The corresponding audio file location of time value can be according to the big of the audio block coded data after the corresponding coding of the first reproduction time value
The small preset value plus reserved top of file, the corresponding audio file position of remaining reproduction time value in reproduction time value sequence
Putting can correspond to according to the size of the audio block coded data after the corresponding coding of reproduction time value and previous reproduction time value
Audio file location obtain.
S204, according to each reproduction time value and the corresponding crucial frame number of audio file location composition of each reproduction time value
Value is to sequence.
It specifically, can be by each reproduction time value audio corresponding with each reproduction time value in reproduction time value sequence
The corresponding record of document location is recorded in together to form a numerical value to sequence, i.e., by the data in table 3 above are pairs of
To form key frame numerical value to sequence in one sequence.As can be seen that in an embodiment of the present invention, key frame numerical value is to sequence
It may include multiple key frame numerical values pair, each key frame numerical value is to may include reproduction time value and sound corresponding with reproduction time value
Frequency file position.
Key frame numerical value is carried out cubic spline interpolation, to generate cubic spline letter by S104 to sequence as interpolation condition
Number, and audio is written by the top of file of cubic spline function write-in audio file and by the coded audio data after coding
In file.
Specifically, can key frame numerical value be subjected to cubic spline interpolation as interpolation condition to sequence, finally can obtain one
This cubic spline function can be written the top of file of audio file, will compiled by a interpolating function, i.e. cubic spline function later
In coded audio data write-in audio file after code, so as to generate a complete audio file.
In order to optimize the precision of cubic spline function, in an embodiment of the present invention, in order to simplify cubic spline function, most
It is not needed to eventually using all key frame numerical values to as interpolation condition.For example, first interpolation condition with 0.5 second for stepping,
And retain the data at boundary both ends, it is denoted as S (xi)=yi, i=0,1,2 ..., n, xi=0,0.5,1,1.5 ....After interpolation
To a cubic spline function f (xi).Second batch interpolation condition with 0.2 second for stepping, if being included in first interpolation
In condition, then this is abandoned to data, is denoted as S (xj)=yj, j=0,1,2 ..., m, xj=0.2,0.4,0.6 ....It is inserted first
It is worth result test, if for example, fabs (f (xj)-yj)<500, wherein 500 unit is byte, then S (xj)=yjThis is to data
It can ignore, otherwise as interpolation condition.Final interpolation condition set is first interpolation condition and part second batch interpolation
The set of condition.Cubic spline function is simplified as a result,.
The generation method of audio file according to embodiments of the present invention, can first obtain audio data and audio data it is total when
It is long, and audio data is encoded according to preset duration step value, the file header of reserved audio file can be obtained later
The preset value in portion, and according to the coded audio data after the total duration of audio data, preset duration step value, coding and reserve
Top of file preset value generation key frame numerical value to sequence, finally using key frame numerical value to sequence as interpolation condition progress
Cubic spline interpolation will be encoded to generate cubic spline function, and by the top of file of cubic spline function write-in audio file
In coded audio data write-in audio file afterwards, so as to generate a complete audio file, i.e., only increasing a small amount of storage
Under the premise of space, key frame is increased for audio file by cubic spline interpolation, conventional key frame storage is avoided and compares
The problem of accounting for resource and poor precision reduces the size of audio file, while by introducing key frame to audio file, real
Progress monitoring when audio file plays is showed.
In order to realize above-described embodiment, the invention also provides a kind of generating means of audio file.
Fig. 3 is the structure diagram of the generating means of audio file according to an embodiment of the invention.As shown in figure 3,
The generating means of the audio file can include:First acquisition module 110, coding module 120, the second acquisition module 130, first
140 and second generation module 150 of generation module.
Specifically, the first acquisition module 110 can be used for obtaining the total duration of audio data and audio data.Coding module
120 can be used for encoding audio data according to preset duration step value.Wherein, it should be noted that the present invention's
In embodiment, audio data is the original voice data not through overcompression etc. reason, i.e. PCM data.
More specifically, the first acquisition module 110 can obtain audio data total duration corresponding with the audio data, mould is encoded
Block 120 can encode audio data according to preset duration step value (such as 0.1 second or 0.5 second).Wherein, in this hair
In bright embodiment, audio data can be encoded by non-constant code check (i.e. elongated code check).For example, with preset duration
Step value is for 0.1 second, when being encoded to audio data, can encode audio block data (the i.e. PCM numbers of 0.1 second every time
According to), until all audio data codings are completed.
Second acquisition module 130 can be used for obtaining the preset value of the top of file of reserved audio file.It should be appreciated that
In the embodiment of the present invention, the preset value of the top of file of reserved audio file can be understood as in advance in the text of audio file
The size that part head is reserved, for example, 1kBytes (1K bytes), i.e. 1024Bytes (byte).
First generation module 140 can be used for according to the sound after the total duration of audio data, preset duration step value, coding
The preset value of frequency coded data and reserved top of file generates key frame numerical value to sequence.In order to avoid conventional key frame is deposited
The problem of accounting for resource etc. is compared in storage, and in the embodiment of invention, cubic spline difference functions can be used to preserve key frame.Specifically
For, in one embodiment of the invention, as shown in figure 4, the first generation module 140 may include first acquisition unit 141,
Two acquiring units 142, third acquiring unit 143 and generation unit 144.
Specifically, first acquisition unit 141 can be used for using preset duration step value as difference, by audio data it is total when
Long to be split to obtain reproduction time value sequence, reproduction time value sequence includes multiple reproduction time values, multiple reproduction times
Value is arranged using preset duration step value as difference.For example, it is assumed that the total duration of the audio data got
It it is 241.2 seconds, preset duration step value is 0.1 second, and first acquisition unit 141 can be with 0.1 second for difference, by audio data
Total duration is split for 241.2 seconds, obtain a reproduction time value sequence, i.e., 0.1,0.2,0.3 ..., 240.1,
241.2 }, wherein unit is the second.As can be seen that the reproduction time value in reproduction time value sequence is with 0.1 being incremented by for difference
Sequence.
Second acquisition unit 142 is available for the audio block coded data after obtaining the corresponding coding of each reproduction time value
Size.That is, each reproduction time value corresponds to an audio block data, in the mistake encoded to these audio block data
Cheng Zhong, second acquisition unit 142 can obtain the size after the corresponding audio block data encoding of each reproduction time value.For example, with
Reproduction time value sequence for 0.1,0.2,0.3 ..., 240.1,241.2, for unit is the second, when can obtain broadcasting respectively
Between value for the size after 0.1 second corresponding audio block data encoding be 358byte, reproduction time value is 0.2 second corresponding audio
Size after block data encoding be 386byte ..., reproduction time value is after 241.2 seconds corresponding audio block data encoding
Size is 377byte, you can by such as the following table 2 come recording played time value and the corresponding pass of the audio block coded data after coding
System and size.
Time (second) |
0.1 |
0.2 |
0.3 |
0.4 |
0.5 |
… |
240.0 |
240.1 |
241.2 |
Size (byte) |
358 |
386 |
410 |
327 |
334 |
… |
405 |
319 |
377 |
Table 2
Third acquiring unit 143 can be used for corresponding according to the preset value of reserved top of file and each reproduction time value
The size of audio block coded data after coding obtains the corresponding audio file location of each reproduction time value.For example, with above
Data instance in table 2, third acquiring unit 143 can be first by the audio blocks after the corresponding coding of each reproduction time value in table 2
The size of coded data is converted, later plus the preset value 1K words of reserved top of file on the basis of transformation result
Section, you can obtain the corresponding audio file location of each reproduction time value, can reproduction time value and its be represented by such as the following table 3
The correspondence and size of corresponding audio file location.
Time (second) |
0.1 |
0.2 |
0.3 |
0.4 |
0.5 |
… |
240.0 |
240.1 |
241.2 |
Position (byte) |
1382 |
1768 |
2178 |
2505 |
2839 |
… |
843244 |
843563 |
843940 |
Table 3
With reference to table 2 and table 3 as can be seen that calculating process of the reproduction time value for 0.1 second corresponding audio file location:It broadcasts
Time value is put as the pre- of the top of file of the size (358byte)+reserved of the audio block coded data after 0.1 second corresponding coding
If being worth (1K bytes (i.e. 1024 bytes)), calculating process of the reproduction time value for 0.2 second corresponding audio file location:During broadcasting
Between value be size (386byte)+reproduction time value of audio block coded data after 0.2 second corresponding coding be 0.1 second correspondence
Audio file location (1382byte), calculating process of the reproduction time value for 0.3 second corresponding audio file location:During broadcasting
Between value be size (410byte)+reproduction time value of audio block coded data after 0.3 second corresponding coding be 0.2 second correspondence
Audio file location (1768byte) ... ..., calculating of the reproduction time value for 241.2 seconds corresponding audio file locations
Journey:Size (377byte)+reproduction time value of the reproduction time value for the audio block coded data after 241.2 seconds corresponding codings
For 240.1 seconds corresponding audio file locations (843563byte).That is, first broadcasting in reproduction time value sequence
The corresponding audio file location of time value can be according to the big of the audio block coded data after the corresponding coding of the first reproduction time value
The small preset value plus reserved top of file, the corresponding audio file position of remaining reproduction time value in reproduction time value sequence
Putting can correspond to according to the size of the audio block coded data after the corresponding coding of reproduction time value and previous reproduction time value
Audio file location obtain.
Generation unit 144 can be used for according to each reproduction time value and the corresponding audio file location of each reproduction time value
Key frame numerical value is formed to sequence.More specifically, generation unit 144 can be by each reproduction time value in reproduction time value sequence
Audio file location corresponding with each reproduction time value is corresponding to be recorded together to form a numerical value to sequence, Ji Jiangshang
The pairs of record of data in face table 3 is in one sequence to form key frame numerical value to sequence.As can be seen that the present invention's
In embodiment, key frame numerical value may include sequence multiple key frame numerical values pair, when each key frame numerical value is to may include playing
Between value and audio file location corresponding with reproduction time value.
Second generation module 150 can be used for key frame numerical value carrying out cubic spline interpolation as interpolation condition to sequence,
To generate cubic spline function, and by the top of file of cubic spline function write-in audio file and by the audio after coding
In coded data write-in audio file.More specifically, the second generation module 150 can using key frame numerical value to sequence as interpolation item
Part carries out cubic spline interpolation, finally can obtain an interpolating function, i.e. cubic spline function, later can be by this cubic spline
The top of file of audio file is written in function, the coded audio data after coding is written in audio file, so as to generate one
Complete audio file.
In order to optimize the precision of cubic spline function, in an embodiment of the present invention, in order to simplify cubic spline function, most
It is not needed to eventually using all key frame numerical values to as interpolation condition.For example, first interpolation condition with 0.5 second for stepping,
And retain the data at boundary both ends, it is denoted as S (xi)=yi, i=0,1,2 ..., n, xi=0,0.5,1,1.5 ....After interpolation
To a cubic spline function f (xi).Second batch interpolation condition with 0.2 second for stepping, if being included in first interpolation
In condition, then this is abandoned to data, is denoted as S (xj)=yj, j=0,1,2 ..., m, xj=0.2,0.4,0.6 ....It is inserted first
It is worth result test, if for example, fabs (f (xj)-yj)<500, wherein 500 unit is byte, then S (xj)=yjThis logarithm
According to that can ignore, otherwise as interpolation condition.Final interpolation condition set is that first interpolation condition and part second batch are inserted
The set of value condition.Cubic spline function is simplified as a result,.
The generating means of audio file according to embodiments of the present invention, can by the first acquisition module obtain audio data and
The total duration of audio data, coding module encode audio data according to preset duration step value, the second acquisition module
Obtain the preset value of the top of file of reserved audio file, the first generation module is according to the total duration of audio data, preset
The preset value generation key frame numerical value of coded audio data and reserved top of file after duration step value, coding to sequence,
Key frame numerical value is carried out cubic spline interpolation to generate cubic spline by the second last generation module to sequence as interpolation condition
Function, and by cubic spline function write-in audio file top of file, by after coding coded audio data write-in audio text
In part, so as to generate a complete audio file, i.e., under the premise of a small amount of memory space is only increased, inserted by cubic spline
Be worth increases key frame for audio file, avoids conventional key frame storage and compares the problem of accounting for resource and poor precision, reduces
The size of audio file, while by introducing key frame to audio file, realize progress monitoring when audio file plays.
After audio file introduces the key frame preserved in the form of cubic spline function, player is playing the audio
Also a small amount of transformation should be done during file to realize the effect of key frame, that is, supports the dragging of progress.For this purpose, the invention also provides
A kind of playback method of audio file.
Fig. 5 is the flow chart of the playback method of audio file according to an embodiment of the invention.
It should be noted that in an embodiment of the present invention, audio file is the audio file according to above-described embodiment
What generation method was generated, which has key frame, which is that sound is stored in the form of cubic spline function
The top of file of frequency file.As shown in figure 5, the playback method of the audio file can include:
S501 obtains audio file.
S502, when receive play audio file instruction when, read and initialize in the top of file of audio file three
Secondary spline function.
For example, when receiving play instruction of the user for audio file input, it can be first from the file header of audio file
Portion is read and the cubic spline function in initialization files head.
S503 obtains the progression time value of input, and obtains progression time according to progression time value and cubic spline function
It is worth corresponding audio file location.
For example, when detecting that user wants that the dragging that progress is carried out to audio file controls, can first obtain input by user
Progression time value, and it is general in audio file according to the progression time value and cubic spline function to find the progression time value
Position.
S504 plays out audio file according to the corresponding audio file location of progression time value.
Specifically, it after Position Approximate of the progression time value in audio file is found, can be found since the position
Next complete audio frame frame head can start to play.
The playback method of audio file according to embodiments of the present invention can first obtain audio file, receive broadcasting sound
When frequency file instructs, obtain and initialize the cubic spline function in the top of file of audio file, input can be obtained later
Progression time value, and the corresponding audio file location of progression time value is obtained according to progression time value and cubic spline function, most
Audio file is played out according to progression time value corresponding audio file location afterwards, i.e., is based on by reading in audio file
The key frame that cubic spline function preserves can find the audio file location corresponding to time point input by user so as to broadcasting
The dragging of progress can be supported by putting device and only doing a small amount of transformation, realized the progress monitoring function of audio, improved user experience.
In order to realize above-described embodiment, the invention also provides a kind of playing devices of audio file.
Fig. 6 is the structure diagram of the playing device of audio file according to an embodiment of the invention.As shown in fig. 6,
The playing device of the audio file can include:It first acquisition module 210, read module 220, the second acquisition module 230 and broadcasts
Amplification module 240.
Specifically, the first acquisition module 210 can be used for obtaining audio file.
Read module 220 can be used for, when receiving broadcasting audio file instruction, reading and initializing the text of audio file
Cubic spline function in part head.For example, read module 220 is receiving play instruction of the user for audio file input
When, the cubic spline function in simultaneously initialization files head can be first read from the top of file of audio file.
Second acquisition module 230 can be used for obtaining the progression time value of input, and according to progression time value and cubic spline
Function obtains the corresponding audio file location of progression time value.Detect that user wants to carry out progress to audio file for example, working as
During dragging control, the second acquisition module 230 can first obtain progression time value input by user, and according to the progression time value and three
Secondary spline function finds Position Approximate of the progression time value in audio file.
Playing module 240 can be used for playing out audio file according to the corresponding audio file location of progression time value.
More specifically, after the second acquisition module 230 finds Position Approximate of the progression time value in audio file, playing module
240 can be found since the position next complete audio frame frame head can play.
The playing device of audio file according to embodiments of the present invention can obtain audio file by the first acquisition module,
Read module receive play audio file instruction when, obtain and initialize the cubic spline in the top of file of audio file
Function, the second acquisition module obtains the progression time value of input, and obtains progress according to progression time value and cubic spline function
The corresponding audio file location of time value, playing module according to the corresponding audio file location of progression time value to audio file into
Row plays, i.e., can find the time input by user based on the key frame that cubic spline function preserves by reading in audio file
The corresponding audio file location of point so that a small amount of transformation is only done to player can support the dragging of progress, realize sound
The progress monitoring function of frequency, improves user experience.
In the description of the present invention, it is to be understood that term " first ", " second " are only used for description purpose, and cannot
It is interpreted as indicating or implies relative importance or imply the quantity of the technical characteristic indicated by indicating.Define as a result, " the
One ", at least one this feature can be expressed or be implicitly included to the feature of " second ".In the description of the present invention, " multiple "
It is meant that at least two, such as two, three etc., unless otherwise specifically defined.
Any process described otherwise above or method description are construed as in flow chart or herein, represent to include
Module, segment or the portion of the code of the executable instruction of one or more the step of being used to implement specific logical function or process
Point, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discuss suitable
Sequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, to perform function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
Expression or logic and/or step described otherwise above herein in flow charts, for example, being considered use
In the order list for the executable instruction for realizing logic function, may be embodied in any computer-readable medium, for
Instruction execution system, device or equipment (such as computer based system, including the system of processor or other can be held from instruction
The system of row system, device or equipment instruction fetch and execute instruction) it uses or combines these instruction execution systems, device or set
It is standby and use.For the purpose of this specification, " computer-readable medium " can any can be included, store, communicate, propagate or pass
Defeated program is for instruction execution system, device or equipment or the dress used with reference to these instruction execution systems, device or equipment
It puts.The more specific example (non-exhaustive list) of computer-readable medium is including following:Electricity with one or more wiring
Connecting portion (electronic device), portable computer diskette box (magnetic device), random access memory (RAM), read-only memory
(ROM), erasable edit read-only storage (EPROM or flash memory), fiber device and portable optic disk is read-only deposits
Reservoir (CDROM).In addition, computer-readable medium can even is that the paper that can print described program on it or other are suitable
Medium, because can be for example by carrying out optical scanner to paper or other media, then into edlin, interpretation or when necessary with it
His suitable method is handled electronically to obtain described program, is then stored in computer storage.
It should be appreciated that each section of the present invention can be realized with hardware, software, firmware or combination thereof.Above-mentioned
In embodiment, software that multiple steps or method can in memory and by suitable instruction execution system be performed with storage
Or firmware is realized.If for example, with hardware come realize in another embodiment, can be under well known in the art
Any one of row technology or their combination are realized:With for the logic gates to data-signal realization logic function
Discrete logic, have suitable combinational logic gate circuit application-specific integrated circuit, programmable gate array (PGA), scene
Programmable gate array (FPGA) etc..
Those skilled in the art are appreciated that realize all or part of step that above-described embodiment method carries
Suddenly it is that relevant hardware can be instructed to complete by program, the program can be stored in a kind of computer-readable storage medium
In matter, the program when being executed, one or a combination set of the step of including embodiment of the method.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing module, it can also
That each unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated mould
The form that hardware had both may be used in block is realized, can also be realized in the form of software function module.The integrated module is such as
Fruit is realized in the form of software function module and is independent product sale or in use, can also be stored in a computer
In read/write memory medium.
Storage medium mentioned above can be read-only memory, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " example ", " is specifically shown " some embodiments "
The description of example " or " some examples " etc. means specific features, structure, material or the spy for combining the embodiment or example description
Point is contained at least one embodiment of the present invention or example.In the present specification, schematic expression of the above terms are not
It must be directed to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be in office
It is combined in an appropriate manner in one or more embodiments or example.In addition, without conflicting with each other, the skill of this field
Art personnel can tie the different embodiments or examples described in this specification and the feature of different embodiments or examples
It closes and combines.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is example
Property, it is impossible to limitation of the present invention is interpreted as, those of ordinary skill in the art within the scope of the invention can be to above-mentioned
Embodiment is changed, changes, replacing and modification.