CN104301783B - Generation method, playback method and the device of audio file - Google Patents

Generation method, playback method and the device of audio file Download PDF

Info

Publication number
CN104301783B
CN104301783B CN201410587140.3A CN201410587140A CN104301783B CN 104301783 B CN104301783 B CN 104301783B CN 201410587140 A CN201410587140 A CN 201410587140A CN 104301783 B CN104301783 B CN 104301783B
Authority
CN
China
Prior art keywords
audio file
audio
value
file
time value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410587140.3A
Other languages
Chinese (zh)
Other versions
CN104301783A (en
Inventor
施国强
唐义平
聂小林
刘庆峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
iFlytek Co Ltd
Original Assignee
iFlytek Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN201410587140.3A priority Critical patent/CN104301783B/en
Publication of CN104301783A publication Critical patent/CN104301783A/en
Application granted granted Critical
Publication of CN104301783B publication Critical patent/CN104301783B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Abstract

The invention discloses a kind of generation method of audio file, playback method and device, the wherein generation method includes:Audio data and its total duration are obtained, and audio data is encoded according to preset duration step value;Obtain the preset value of the top of file of reserved audio file;Key frame numerical value is generated to sequence according to the coded audio data after the total duration of audio data, preset duration step value, coding and the preset value of reserved top of file;And key frame numerical value is subjected to cubic spline interpolation to generate cubic spline function to sequence, and be written into the top of file of audio file and the coded audio data after coding is written in audio file.The method of the embodiment of the present invention is under the premise of a small amount of memory space is only increased, key frame is increased for audio file by cubic spline interpolation, it avoids conventional key frame storage and compares the problem of accounting for resource and poor precision, while realize progress monitoring when audio file plays.

Description

Generation method, playback method and the device of audio file
Technical field
The present invention relates to a kind of information technology field more particularly to generation method of audio file, a kind of device and sounds Playback method, the device of frequency file.
Background technology
In the relevant technologies, following two methods is usually mainly used to be encoded to generate audio to original audio data File:First method encodes original audio data using constant code rate;Second method, using non-constant code Rate (such as elongated code check) encodes original audio data, and first, audio file is saved into non-constant code check, then leads to It crosses that format converter tools convert thereof into constant code rate and plays back.
However, it is meant that often using more traditional coded format using constant code rate in first method, such as MP3 then needs the code check of bigger, the pressure that flow bandwidth during live streaming can be given to bring bigger in this way in the case where ensureing sound quality Power, and CPU occupancy of traditional coded format when being encoded also can be higher.Due to the mistake of transcoding in second method Often than relatively time-consuming in journey, the audio after live streaming can not at the first time played back, therefore lead to audio file The real-time of preservation is not high, and the audio of non-constant code check can not control progress when playing.
Therefore, key frame can be introduced for audio file at present, so as to solve can not to drag when playing audio The problem of to specified progress.In the relevant technologies, key frame is generally by one group of continuous numerical value to expression, a numerical value pair Comprising a time and document location corresponding with the time, as shown in Table 1 below.
Time (s) 0.1 0.2 0.3 0.4 0.5 2.0 2.1 2.2
Position (byte) 2453 3542 4513 6125 7146 30126 32568 34786
Table 1
But as it can be seen from table 1 when the total duration of audio file is longer, the numerical value stored is needed to will be more, The space occupied will be bigger, increases so as to cause audio file.
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.
Description of the drawings
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments Significantly and it is readily appreciated that, wherein,
Fig. 1 is the flow chart of the generation method of audio file according to an embodiment of the invention;
Fig. 2 is flow chart of the generation key frame numerical value according to an embodiment of the invention to sequence;
Fig. 3 is the structure diagram of the generating means of audio file according to an embodiment of the invention;
Fig. 4 is the structure diagram of the first generation module according to an embodiment of the invention;
Fig. 5 is the flow chart of the playback method of audio file according to an embodiment of the invention;And
Fig. 6 is the structure diagram of the playing device of audio file according to an embodiment of the 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.

Claims (6)

1. a kind of generation method of audio file, which is characterized in that include the following steps:
Obtain the total duration of audio data and the audio data, and according to preset duration step value to the audio data into Row coding;
Obtain the preset value of the top of file of reserved audio file;
According to the coded audio data and described after the total duration of the audio data, the preset duration step value, coding The preset value of reserved top of file generates key frame numerical value to sequence;
The key frame numerical value is subjected to cubic spline interpolation to sequence as interpolation condition, 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;
Wherein, the audio coding number according to after the total duration of the audio data, the preset duration step value, coding Sequence is specifically included according to the preset value generation key frame numerical value with the reserved top of file:
Using the preset duration step value as difference, the total duration of the audio data is split to obtain reproduction time Value sequence, the reproduction time value sequence include multiple reproduction time values, and the multiple reproduction time value is with described preset What duration step value was arranged for difference;
Obtain the size of the audio block coded data after the corresponding coding of each reproduction time value;
It is compiled according to the audio block after the preset value of the 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;
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.
2. the generation method of audio file as described in claim 1, which is characterized in that the key frame numerical value includes sequence Multiple key frame numerical values pair, each key frame numerical value to comprising reproduction time value and audio corresponding with the reproduction time value text Part position.
3. a kind of generating means of audio file, which is characterized in that including:
First acquisition module, for obtaining the total duration of audio data and the audio data;
Coding module, for being encoded according to preset duration step value to the audio data;
Second acquisition module, for obtaining the preset value of the top of file of reserved audio file;
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;
Second generation module, for the key frame numerical value to be carried out cubic spline interpolation as interpolation condition to sequence, with life Into cubic spline function, and by the cubic spline function write-in audio file top of file and will be after the coding Coded audio data is written in the audio file;
Wherein, first generation module includes:
First acquisition unit, for using the preset duration step value as difference, the total duration of the audio data to be carried out It splits to obtain reproduction time value sequence, the reproduction time value sequence includes multiple reproduction time values, during the multiple broadcasting Between value arranged using the preset duration step value as difference;
Second acquisition unit, for obtaining the size of the audio block coded data after the corresponding coding of each reproduction time value;
Third acquiring unit, it is corresponding for the preset value according to the 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;
Generation unit, 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.
4. the generating means of audio file as claimed in claim 3, which is characterized in that the key frame numerical value includes sequence Multiple key frame numerical values pair, each key frame numerical value to comprising reproduction time value and audio corresponding with the reproduction time value text Part position.
5. a kind of playback method of audio file, which is characterized in that the audio file is according to any in such as claim 1-2 The generation method generation of audio file described in, the playback method includes:
Obtain the audio file;
When receive play the audio file instruction when, read and initialize in the top of file of the audio file three times Spline function;
When obtaining the progression time value of input, and the progress obtained according to the progression time value and the cubic spline function Between be worth corresponding audio file location;
Audio file is played out according to the progression time value corresponding audio file location.
6. a kind of playing device of audio file, which is characterized in that the audio file is according to any in such as claim 1-2 The generation method generation of audio file described in, the playing device includes:
First acquisition module, for obtaining the audio file;
Read module, for when receiving the broadcasting audio file instruction, reading and initializing the text of the audio file Cubic spline function in part head;
Second acquisition module, for obtaining the progression time value of input, and according to the progression time value and the cubic spline Function obtains the corresponding audio file location of the progression time value;
Playing module, for being played out according to the corresponding audio file location of the progression time value to audio file.
CN201410587140.3A 2014-10-27 2014-10-27 Generation method, playback method and the device of audio file Active CN104301783B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410587140.3A CN104301783B (en) 2014-10-27 2014-10-27 Generation method, playback method and the device of audio file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410587140.3A CN104301783B (en) 2014-10-27 2014-10-27 Generation method, playback method and the device of audio file

Publications (2)

Publication Number Publication Date
CN104301783A CN104301783A (en) 2015-01-21
CN104301783B true CN104301783B (en) 2018-06-15

Family

ID=52321313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410587140.3A Active CN104301783B (en) 2014-10-27 2014-10-27 Generation method, playback method and the device of audio file

Country Status (1)

Country Link
CN (1) CN104301783B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110634512A (en) * 2019-09-29 2019-12-31 李翼东 Method, device and equipment for converting sampling rate of audio file and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105788616B (en) * 2016-02-25 2018-09-21 广东欧珀移动通信有限公司 A kind of audio file play method and terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102074239A (en) * 2010-12-23 2011-05-25 福建星网视易信息系统有限公司 Sound speed change method
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services
CN102724488A (en) * 2011-03-31 2012-10-10 新奥特(北京)视频技术有限公司 Indexing method for supporting direct frame precise positioning of FLV file

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7106944B2 (en) * 2001-05-30 2006-09-12 Nokia Corporation System and method for jumping to a timepoint in a MPEG file
EP1423854B1 (en) * 2001-09-06 2011-10-05 Thomson Licensing Method and apparatus for elapsed playback timekeeping of variable bit-rate digitally encoded audio data files

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102074239A (en) * 2010-12-23 2011-05-25 福建星网视易信息系统有限公司 Sound speed change method
CN102724488A (en) * 2011-03-31 2012-10-10 新奥特(北京)视频技术有限公司 Indexing method for supporting direct frame precise positioning of FLV file
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110634512A (en) * 2019-09-29 2019-12-31 李翼东 Method, device and equipment for converting sampling rate of audio file and storage medium

Also Published As

Publication number Publication date
CN104301783A (en) 2015-01-21

Similar Documents

Publication Publication Date Title
CA2578190C (en) Device and method for generating a coded multi-channel signal and device and method for decoding a coded multi-channel signal
EP1566808A1 (en) Method and apparatus for summarizing a plurality of frames
CN107637097B (en) Encoding device and method, decoding device and method, and program
CN112584061B (en) Multimedia universal template generation method, electronic equipment and storage medium
CN106796799A (en) efficient DRC configuration files transmission
TW460865B (en) Signal processing on information files so as to obtain characteristic point information sequences
EP1202570A3 (en) Apparatus and method for outputting control information
CN104301783B (en) Generation method, playback method and the device of audio file
JP5635265B2 (en) Editing apparatus and editing method
JP2009534696A (en) Apparatus and method for encoding and decoding a plurality of digital data sets
CN107370726A (en) A kind of virtual sliced sheet method and system for disributed media file trans-coding system
KR20230071107A (en) Audio metadata encoding and audio data playing apparatus for supporting dynamic format conversion, and method for performing by the appartus, and computer-readable medium recording the dynamic format conversions
WO2014035864A1 (en) Processing audio objects in principal and supplementary encoded audio signals
JP2006195471A (en) Method and apparatus for encoding and decoding multi-channel signal
JPWO2019069710A1 (en) Encoding device and method, decoding device and method, and program
TW201407969A (en) Method for determining data format of linear pulse-code modulation data
CN104681033A (en) Information encoding and decoding methods and electronic equipment
CN104538048B (en) A kind of processing method and processing device of audio file
AU762222B2 (en) Transmitting device for transmitting a digital information signal alternately in encoded form and non-encoded form
CN108564973A (en) A kind of audio file play method and device
Knapen et al. Lossless compression of 1-bit audio
US8660999B2 (en) Method and apparatus for encoding media content and metadata thereof
US20230197114A1 (en) Storage apparatus, playback apparatus, storage method, playback method, and medium
MXPA04002830A (en) Method and apparatus for recording video data, and information storage medium thereby.
KR101060490B1 (en) Method and device for calculating average bitrate of a file of variable bitrate, and audio device comprising said device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20190417

Address after: 401336 Second Floor of Building A, 99 Century Avenue, Chayuan New District, Nanan District, Chongqing

Patentee after: Chongqing Xunfei Huiyu Artificial Intelligence Technology Research Institute Co., Ltd.

Address before: 230088 666 Wangjiang West Road, Hefei hi tech Development Zone, Anhui

Patentee before: Iflytek Co., Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210617

Address after: 230088 666 Wangjiang West Road, Hefei hi tech Development Zone, Anhui

Patentee after: IFLYTEK Co.,Ltd.

Address before: 401336 Second Floor of Building A, 99 Century Avenue, Chayuan New District, Nanan District, Chongqing

Patentee before: Chongqing Xunfei Huiyu Artificial Intelligence Technology Research Institute Co.,Ltd.