Summary of the invention
Embodiment of the present invention technical matters to be solved is, easily produce the defect of sound volume mutation when switching play for multimedia file in prior art, provide a kind of can multimedia file switch play time the multi-medium play method of Automatic adjusument volume and device.
In order to solve the problems of the technologies described above, embodiments provide a kind of multi-medium play method, comprising:
When the multimedia file of current broadcasting switches to the second multimedia file from the first multimedia file, obtain the volume characteristics of the first audio file in described first multimedia file and the second audio file in described second multimedia file respectively;
The volume zoom factor of audio playing device is regulated, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file according to the volume characteristics of described first audio file and described second audio file;
Play described second multimedia file, control described audio playing device and carry out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
Wherein, the step of the volume characteristics of the first audio file in described first multimedia file of described acquisition comprises:
First audio file of decoding in the first multimedia file, obtains the first pulse code modulation (PCM) array;
By the pulse code modulation data in described first pulse code modulation (PCM) array according to order sequence from small to large;
The first lower quartile C1 and the first upper quartile C2 is searched from the first pulse code modulation (PCM) array after sequence, wherein C1 is positioned at the pulse code modulation data of whole array 1/4 position in the first pulse code modulation (PCM) array after sequence, and C2 is the pulse code modulation data being positioned at whole array 3/4 position in the second pulse code modulation (PCM) array after sequence.
Wherein, the step of the volume characteristics of the second audio file in described second multimedia file of described acquisition comprises:
Foundation is connected with the broadcasting link of the second multimedia file and enters time-out play mode;
Second audio file of decoding in the second multimedia file, obtains the second pulse code modulation (PCM) array;
By the pulse code modulation data in described second pulse code modulation (PCM) array according to order sequence from small to large;
The second lower quartile C3 and the second upper quartile C4 is searched from the second pulse code modulation (PCM) array after sequence, wherein C3 is positioned at the pulse code modulation data of whole array 1/4 position in the second pulse code modulation (PCM) array after sequence, and C4 is the pulse code modulation data being positioned at whole array 3/4 position in the second pulse code modulation (PCM) array after sequence.
Wherein, the described volume characteristics according to described first audio file and described second audio file regulates the step of the volume zoom factor of audio playing device to comprise:
The volume zoom factor A of audio playing device during the first multimedia file described in recording played;
Regulate the volume zoom factor of audio playing device according to formula B=A+A (C2-C4)/(C4-C3), wherein B is the volume zoom factor of audio playing device when playing described second multimedia file.
Wherein, described method also comprises:
If the value of the B calculated is greater than 100%, then the value of B is set to 100%.
On the other hand, present invention also offers a kind of multimedia playing apparatus, comprising:
First volume characteristics acquisition module, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, obtains the volume characteristics of the first audio file in described first multimedia file;
Second volume characteristics acquisition module, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, obtains the volume characteristics of the second audio file in described second multimedia file;
Volume zoom factor adjustment module, for regulating the volume zoom factor of audio playing device according to the volume characteristics of described first audio file and described second audio file, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file;
Playing module, for playing described second multimedia file, controlling described audio playing device and carrying out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
Wherein, described first volume characteristics acquisition module comprises:
First decoder module, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, first audio file of decoding in the first multimedia file, obtains the first pulse code modulation (PCM) array;
First order module, for sorting the pulse code modulation data in described first pulse code modulation (PCM) array according to order from small to large;
First quartile acquisition module, for searching the first lower quartile C1 and the first upper quartile C2 from the first pulse code modulation (PCM) array after sequence, wherein C1 is positioned at the pulse code modulation data of whole array 1/4 position in the first pulse code modulation (PCM) array after sequence, and C2 is the pulse code modulation data being positioned at whole array 3/4 position in the second pulse code modulation (PCM) array after sequence.
Wherein, described second volume characteristics acquisition module comprises:
To mourn in silence playing module, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, set up and to be connected with the broadcasting link of the second multimedia file and to enter time-out play mode;
Second decoder module, for second audio file of decoding in the second multimedia file, obtains the second pulse code modulation (PCM) array;
Second order module, for sorting the pulse code modulation data in described second pulse code modulation (PCM) array according to order from small to large;
Second quartile acquisition module, for searching the second lower quartile C3 and the second upper quartile C4 from the second pulse code modulation (PCM) array after sequence, wherein C3 is positioned at the pulse code modulation data of whole array 1/4 position in the second pulse code modulation (PCM) array after sequence, and C4 is the pulse code modulation data being positioned at whole array 3/4 position in the second pulse code modulation (PCM) array after sequence.
Wherein, described volume zoom factor adjustment module comprises:
Original sound volume zoom factor logging modle, for the volume zoom factor A of audio playing device during the first multimedia file described in recording played;
Revise volume zoom factor computing module, for regulating the volume zoom factor of audio playing device according to formula B=A+A (C2-C4)/(C4-C3), wherein B is the volume zoom factor of audio playing device when playing described second multimedia file.
Wherein, described multimedia playing apparatus also comprises:
Volume zoom factor correction module, when the value for the B calculated at described correction volume zoom factor computing module is greater than 100%, is set to 100% by the value of B.
Implement the embodiment of the present invention, there is following beneficial effect: by analyzing the volume characteristics of a upper multimedia file and present multimedia file, regulate the volume zoom factor of audio playing device, make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file, thus ensure user from a multimedia file switch to present multimedia file to carry out Continuous Play time, the sudden change of imperceptible volume, for user provides high-quality audio experience.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
When play multimedia file, the size of broadcast sound volume is not only relevant to the volume characteristics of multimedia file itself, also relevant with the volume zoom factor of audio playing device.In the prior art, in order to avoid sound volume mutation as much as possible when multimedia file is play and switched, often the volume characteristics of multimedia file itself is adjusted, the modes such as multiplication, mean value are adopted to be adjusted to substantially identical by present multimedia file with the volume characteristics of a upper multimedia file, be easy to like this cause multimedia file distortion, and data processing amount is comparatively large, can extend data processing time, the adding users stand-by period, affect Consumer's Experience.In fact, when running into this situation, user often manually regulates the volume zoom factor of audio playing device, but customer responsiveness speed is slower, only just may regulate accordingly after there is sound volume mutation, obviously still can affect Consumer's Experience.Therefore, the embodiment of the present application provides a kind of multi-medium play method and device, can regulate the volume zoom factor of audio playing device adaptively when multimedia file (such as audio file or audio-video document) switches and plays, ensure that multimedia file switches volume gentle transition when playing.
Refer to Fig. 1, be the process flow diagram of the multi-medium play method that first embodiment of the invention provides, the method comprises:
When the multimedia file of S101, current broadcasting switches to the second multimedia file from the first multimedia file, obtain the volume characteristics of the first audio file in described first multimedia file and the second audio file in described second multimedia file respectively.Particularly, if the first multimedia file is audio file, then direct using the first multimedia file as the first audio file, obtain the volume characteristics of the first audio file; If the first multimedia file is audio-video document, then comprise the first audio file and the first video file in the first multimedia file, only extract the first audio file wherein, obtain the volume characteristics of the first audio file.Second multimedia file is like this too.It should be understood by one skilled in the art that a lot of parameters of the first audio file or the second audio file can be used for representing its volume characteristics, modal is utilize the audio power of the first audio file or the second audio file to represent its volume characteristics.In addition, when analyzing the first audio file and the second audio file, volume characteristics can be obtained to whole audio file analysis, also can only analyze to obtain volume characteristics to a part (rear N number of frame of such as the first audio file, front M frame of the second audio file) for audio file.
S102, regulate the volume zoom factor of audio playing device according to the volume characteristics of described first audio file and described second audio file, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.Wherein, audio playing device can be the software player such as audio playing software (such as qq music, Koowo music box etc.) or video jukebox software (such as broadcast soon, MPC etc.), can also be the hardware audio equipment that loudspeaker etc. is arranged on multimedia equipment (such as desktop computer, notebook, smart mobile phone etc.).When the volume of the first audio file self is than the giving great volume of the second audio file self, when switching to the second multimedia file from the first multimedia file, the audio frequency scaling coefficient of sound wave playback equipment can be tuned up (being such as transferred to 75% from 40%), the volume making the second audio file played back is roughly the same with the volume of the first audio file played back.
S103, play described second multimedia file, control described audio playing device and carry out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
The multi-medium play method that the embodiment of the present invention provides, by analyzing the volume characteristics of a upper multimedia file and present multimedia file, regulate the volume zoom factor of audio playing device, make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file, thus ensure user from a multimedia file switch to present multimedia file to carry out Continuous Play time, the sudden change of imperceptible volume, for user provides high-quality audio experience.
In one embodiment, directly its volume characteristics can be obtained by analysis first audio file and the decoded pulse code modulation (PCM) of the second audio file (Pulse Coding Modulation is called for short PCM) data.Usually, decoding can be carried out to the audio frame in audio file and obtain PCM data, then by PCM data stored in PCM array.Then, the volume characteristics of audio file can be obtained by the mean value, mode, median etc. asking for PCM array, but, if there is exceptional value in PCM data, adopt these methods may there is comparatively big error.In order to improve precision, for user provides more reliable more comfortable audio experience, in preferred embodiments more of the present invention, characterized the volume characteristics of audio file by the quartile obtaining PCM array.Below with reference to Fig. 2-4, describe the present invention to analyze volume characteristics according to the quartile of PCM array.
Refer to Fig. 2, be the process flow diagram of the multi-medium play method that second embodiment of the invention provides, the method comprises:
When the multimedia file of S201, current broadcasting switches to the second multimedia file from the first multimedia file, first audio file of decoding in the first multimedia file, obtains a PCM array.
S202, by the PCM data in a described PCM array according to from small to large order sequence.
S203, from sequence after a PCM array search the first lower quartile C1 and the first upper quartile C2, wherein C1 is positioned at the PCM data of whole array 1/4 position in a PCM array after sequence, and C2 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
S204, foundation are connected with the broadcasting link of the second multimedia file and enter time-out play mode.By setting up the broadcasting link with the second multimedia file, the second multimedia file can be obtained and then obtain the second audio file, but, in order to avoid playing the second multimedia file immediately before volume adjusting, in an embodiment of the present invention, need to enter time-out play mode after link is play in foundation, postpone broadcasting second multimedia file.
S205, second audio file of decoding in the second multimedia file, obtain the 2nd PCM array.
S206, by the PCM data in described 2nd PCM array according to from small to large order sequence.
S207, from sequence after the 2nd PCM array search the second lower quartile C3 and the second upper quartile C4, wherein C3 is positioned at the PCM data of whole array 1/4 position in the 2nd PCM array after sequence, and C4 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
S208, regulate the volume zoom factor of audio playing device, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file according to C1, C2, C3, C4.The volume of upper quartile representative near the max volume of audio file (if such as PCM Data distribution8 is 0-255, then upper quartile may about 200), in the present embodiment, directly can represent the volume characteristics of the first audio file with C2, represent the volume characteristics of the second audio file with C4.Preferably, in order to improve precision, the volume characteristics of the first audio file can also be represented with C2-C1, represent the volume characteristics of the second audio file with C4-C3.When implementing, the relation between the volume characteristics change of audio file and the volume zoom factor change of audio playing device can be pre-determined, such as, when the volume characteristics of audio file changes a preset difference value, volume zoom factor change 5%.
S209, play described second multimedia file, control described audio playing device and carry out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
In the embodiment shown in Figure 2, to analyze the volume characteristics of the first audio file, can decode to all audio frames of the first audio file, obtain the PCM data of the first audio file, again all PCM data are put into the analysis that a PCM array carries out quartile, obtain the first upper quartile C2 and the first lower quartile C1; In addition, also can decode to each audio frame of the first audio file respectively, the PCM data of single audio frame are put into a PCM array, lower quartile in upper quartile and frame in the frame obtaining this audio frame, then lower quartile in upper quartile in the frame of audio frames all in the first audio file and frame is put into a quartile array, ask for upper quartile and the lower quartile of this quartile array again, as the first upper quartile C2 and the first lower quartile C1.Similar in this when analyzing the volume characteristics of the second audio file.
Embodiment shown in Fig. 2 is that adopt in this way, degree of accuracy is higher to all PCM data analysis of audio file to obtain volume characteristics, but due to process numerous and diverse, therefore time delay is larger.
Refer to Fig. 3, be the process flow diagram of the multi-medium play method that third embodiment of the invention provides, the method comprises:
When the multimedia file of S301, current broadcasting switches to the second multimedia file from the first multimedia file, the first audio frame group is extracted from the first audio file the first multimedia file, comprise the audio frame of specific quantity in described first audio file in described first audio frame group, or comprise the audio frame in described first audio file in special time period in described first audio frame group.Audio frame in first audio frame group can be randomly drawed, and also can be to extract according to the rule that pre-sets, such as, can extract the rear N number of audio frame in the first audio file, wherein N be not less than 2 natural number.
S302, described first audio frame group of decoding, obtain a PCM array.
S303, by the PCM data in a described PCM array according to from small to large order sequence.
S304, from sequence after a PCM array search the first lower quartile C1 and the first upper quartile C2, wherein C1 is positioned at the PCM data of whole array 1/4 position in a PCM array after sequence, and C2 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
S305, foundation are connected with the broadcasting link of the second multimedia file and enter time-out play mode.By setting up the broadcasting link with the second multimedia file, the second multimedia file can be obtained and then obtain the second audio file, but, in order to avoid playing the second multimedia file immediately before volume adjusting, in an embodiment of the present invention, need to enter time-out play mode after link is play in foundation, postpone broadcasting second multimedia file.
S306, from the second audio file the second multimedia file, extract the second audio frame group, comprise the audio frame of specific quantity in described second audio file in described second audio frame group, or comprise the audio frame in described second audio file in special time period in described second audio frame group.Audio frame in second audio frame group can be randomly drawed, and also can be to extract according to the rule that pre-sets, such as, can extract front M audio frame in the second audio file, wherein M be not less than 2 natural number.
S307, described second audio frame group of decoding, obtain the 2nd PCM array.
S308, by the PCM data in described 2nd PCM array according to from small to large order sequence.
S309, from sequence after the 2nd PCM array search the second lower quartile C3 and the second upper quartile C4, wherein C3 is positioned at the PCM data of whole array 1/4 position in the 2nd PCM array after sequence, and C4 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
S310, regulate the volume zoom factor of audio playing device, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file according to C1, C2, C3, C4.The volume of upper quartile representative near the max volume of audio file (if such as PCM Data distribution8 is 0-255, then upper quartile may about 200), directly can represent the volume characteristics of the first audio file in the present embodiment with C2, represent the volume characteristics of the second audio file with C4.Preferably, in order to improve precision, the volume characteristics of the first audio file can also be represented with C2-C1, represent the volume characteristics of the second audio file with C4-C3.When implementing, the relation between the volume characteristics change of audio file and the volume zoom factor change of audio playing device can be pre-determined, such as, when the volume characteristics of audio file changes a preset difference value, volume zoom factor change 5%.
S311, play described second multimedia file, control described audio playing device and carry out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
In the embodiment shown in fig. 3, to analyze the volume characteristics of the first audio file, can decode to all audio frames of the first audio frame group, obtain the PCM data of the first audio frame group, again all PCM data are put into the analysis that a PCM array carries out quartile, obtain the first upper quartile C2 and the first lower quartile C1; In addition, also can decode to each audio frame in the first audio frame group respectively, the PCM data of single audio frame are put into a PCM array, lower quartile in upper quartile and frame in the frame obtaining this audio frame, then lower quartile in upper quartile in the frame of all audio frames in the first audio frame group and frame is put into a quartile array, ask for upper quartile and the lower quartile of this quartile array again, as the first upper quartile C2 and the first lower quartile C1.Similar in this when analyzing the volume characteristics of the second audio file.
Preferably, the method shown in Fig. 3 also comprises: if the C2 obtained in step S304 is zero, then return and perform step S301; If the C4 obtained in step S309 is zero, then returns and perform step S306.As long as because in C2 and C4 one be zero, illustrate in the first audio file and the second audio file may have one in extracted PCM data everywhere in quiet or close to mute state, the volume characteristics now obtained lacks reference value, be not suitable for carrying out volume adjusting according to this group audio frame, and need again to extract audio frame analysis.In addition, analysis times threshold value can also be set, if the number of times again extracted when switching between the first multimedia file and the second multimedia file exceeds described analysis times threshold value, then terminate volume regulating step, play-over the second multimedia file.
Embodiment shown in Fig. 3 only to the part PCM data analysis of audio file, obtains the volume characteristics of whole audio file, obviously, adopts this precision of method lower, but calculates simple, and thus time delay is less.When reality is implemented, suitably can select the quantity of extracted audio frame, to obtain best equilibrium in precision and time delay.
Refer to Fig. 4, be the process flow diagram of the multi-medium play method that fourth embodiment of the invention provides, the method comprises:
When the multimedia file of S401, current broadcasting switches to the second multimedia file from the first multimedia file, the volume zoom factor A of audio playing device during the first multimedia file described in recording played.
S402, first audio file of decoding in the first multimedia file obtain a PCM array, according to order from small to large, the PCM data in a described PCM array are sorted, obtain the first lower quartile C1 and the first upper quartile C2 of the PCM array after sequence.
S403, foundation are connected with the broadcasting link of the second multimedia file and enter time-out play mode.
S404, second audio file of decoding in the second multimedia file obtain the 2nd PCM array, according to order from small to large, the PCM data in described 2nd PCM array are sorted, obtain the second lower quartile C3 and the second upper quartile C4 of the 2nd PCM array after sequence.
S405, regulate the volume zoom factor of audio playing device according to formula B=A+A (C2-C4)/(C4-C3), wherein B is the volume zoom factor of audio playing device when playing described second multimedia file, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.
S406, play described second multimedia file, control described audio playing device and carry out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
Preferably, the method also comprises: if the value of the B calculated in step S405 is greater than 100%, then the value of B is set to 100%.
In the embodiment above, if carry out play multimedia file by the audio playing software on multimedia equipment or video jukebox software, multimedia equipment and audio playing software or video jukebox software all have the audio playing device that can carry out volume convergent-divergent to sound, the volume adjusting module of such as audio playing software or video jukebox software and the loudspeaker of multimedia equipment, can the volume zoom factor of these two kinds of audio playing devices of comprehensive adjustment when regulating volume zoom factor in step S102, S208, S310, S405.
In addition, if it should be understood by one skilled in the art that the local volume characteristics storing the multimedia file play to some extent, then directly can read this volume characteristics and contrast, and not need to carry out Decoding Analysis again.Such as, play multimedia file A, multimedia file B and multimedia file C successively, when adopting method provided by the invention to switch to B from A, obtain the volume characteristics of B, when switching to C from B, just can no longer analyze the volume characteristics of B, but the volume characteristics of Direct Analysis C, then carry out contrasting to obtain new volume zoom factor.
Refer to Fig. 5, be the structural representation of the multimedia playing apparatus 500 that first embodiment of the invention provides, this device 500 comprises:
First volume characteristics acquisition module 510, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, obtains the volume characteristics of the first audio file in described first multimedia file.Particularly, if the first multimedia file is audio file, then direct using the first multimedia file as the first audio file, obtain the volume characteristics of the first audio file; If the first multimedia file is audio-video document, then comprise the first audio file and the first video file in the first multimedia file, only extract the first audio file wherein, obtain the volume characteristics of the first audio file.
Second volume characteristics acquisition module 520, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, obtains the volume characteristics of the second audio file in described second multimedia file.Particularly, if the second multimedia file is audio file, then direct using the second multimedia file as the second audio file, obtain the volume characteristics of the second audio file; If the second multimedia file is audio-video document, then comprise the second audio file and the second video file in the second multimedia file, only extract the second audio file wherein, obtain the volume characteristics of the second audio file.
It should be understood by one skilled in the art that a lot of parameters of the first audio file or the second audio file can be used for representing its volume characteristics, modal is utilize the audio power of the first audio file or the second audio file to represent its volume characteristics.In addition, when analyzing the first audio file and the second audio file, volume characteristics can be obtained to whole audio file analysis, also can only analyze to obtain volume characteristics to a part (rear N number of frame of such as the first audio file, front M frame of the second audio file) for audio file.
Volume zoom factor adjustment module 530, for regulating the volume zoom factor of audio playing device according to the volume characteristics of described first audio file and described second audio file, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.Wherein, audio playing device can be the software player such as audio playing software (such as qq music, Koowo music box etc.) or video jukebox software (such as broadcast soon, MPC etc.), can also be the hardware audio equipment that loudspeaker etc. is arranged on multimedia equipment (such as desktop computer, notebook, smart mobile phone etc.).When the volume of the first audio file self is than the giving great volume of the second audio file self, when switching to the second multimedia file from the first multimedia file, the audio frequency scaling coefficient of sound wave playback equipment can be tuned up (being such as transferred to 75% from 40%), the volume making the second audio file played back is roughly the same with the volume of the first audio file played back.
Playing module 540, for playing described second multimedia file, controlling described audio playing device and carrying out convergent-divergent with the sound of the volume zoom factor after described adjustment to described second audio file.
The multimedia playing apparatus that the embodiment of the present invention provides, by analyzing the volume characteristics of a upper multimedia file and present multimedia file, regulate the volume zoom factor of audio playing device, make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file, thus ensure user from a multimedia file switch to present multimedia file to carry out Continuous Play time, the sudden change of imperceptible volume, for user provides high-quality audio experience.
In one embodiment, first volume characteristics acquisition module 510 and the second volume characteristics acquisition module 520 can obtain its volume characteristics respectively by analysis first audio file and the decoded pulse code modulation (PCM) of the second audio file (PulseCoding Modulation is called for short PCM) data.Usually, the first volume characteristics acquisition module 510 and the second volume characteristics acquisition module 520 can carry out decoding to the audio frame in audio file and obtain PCM data, then by PCM data stored in PCM array.Then, the volume characteristics of audio file can be obtained by the mean value, mode, median etc. asking for PCM array, but, if there is exceptional value in PCM data, adopt these methods may there is comparatively big error.In order to improve precision, for user provides more reliable more comfortable audio experience, in preferred embodiments more of the present invention, characterized the volume characteristics of audio file by the quartile obtaining PCM array.
As shown in Figure 6, the structural representation of the multimedia playing apparatus 600 provided for second embodiment of the invention.Wherein, the first volume characteristics acquisition module 510 can comprise:
First decoder module 511, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, first audio file of decoding in the first multimedia file, obtains a PCM array.
First order module 512, for sorting the PCM data in a described PCM array according to order from small to large.
First quartile acquisition module 513, for searching the first lower quartile C1 and the first upper quartile C2 from the PCM array after sequence, wherein C1 is positioned at the PCM data of whole array 1/4 position in a PCM array after sequence, and C2 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
Second volume characteristics acquisition module 520 can comprise:
To mourn in silence playing module 521, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, set up and to be connected with the broadcasting link of the second multimedia file and to enter time-out play mode.By setting up the broadcasting link with the second multimedia file, the second multimedia file can be obtained and then obtain the second audio file, but, in order to avoid playing the second multimedia file immediately before volume adjusting, in an embodiment of the present invention, need to enter time-out play mode after link is play in foundation, postpone broadcasting second multimedia file.
Second decoder module 522, for second audio file of decoding in the second multimedia file, obtains the 2nd PCM array.
Second order module 523, for sorting the PCM data in described 2nd PCM array according to order from small to large.
Second quartile acquisition module 524, for searching the second lower quartile C3 and the second upper quartile C4 from the 2nd PCM array after sequence, wherein C3 is positioned at the PCM data of whole array 1/4 position in the 2nd PCM array after sequence, and C4 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
In this example, volume zoom factor adjustment module 530 can regulate the volume zoom factor of audio playing device according to C1, C2, C3, C4, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.The volume of upper quartile representative near the max volume of audio file (if such as PCM Data distribution8 is 0-255, then upper quartile may about 200), directly can represent the volume characteristics of the first audio file in the present embodiment with C2, represent the volume characteristics of the second audio file with C4.Preferably, in order to improve precision, the volume characteristics of the first audio file can also be represented with C2-C1, represent the volume characteristics of the second audio file with C4-C3.When implementing, the relation between the volume characteristics change of audio file and the volume zoom factor change of audio playing device can be pre-determined, such as, when the volume characteristics of audio file changes a preset difference value, volume zoom factor change 5%.
In the embodiment shown in fig. 6, for the first volume characteristics acquisition module 510, first decoder module 511 can be decoded to all audio frames of the first audio file, obtain the PCM data of the first audio file, again all PCM data are put into a PCM array so that first quartile acquisition module 513 carries out the analysis of quartile, thus obtain the first upper quartile C2 and the first lower quartile C1, in addition, first decoder module 511 also can be decoded to each audio frame of the first audio file respectively, the PCM data of single audio frame are put into a PCM array, lower quartile in upper quartile and frame in the frame that first quartile acquisition module 513 obtains this audio frame, then lower quartile in upper quartile in the frame of audio frames all in the first audio file and frame is put into a quartile array, after first order module 512 sorts, first quartile acquisition module 513 asks for upper quartile and the lower quartile of this quartile array again, as the first upper quartile C2 and the first lower quartile C1.Second decoder module 522, second order module 523 of the second volume characteristics acquisition module 520 and the course of work of the course of work of the second quartile acquisition module 524 and the first decoder module 511, first order module 512 of the first volume characteristics acquisition module 510 and first quartile acquisition module 513 similar.
Embodiment shown in Fig. 6 is that adopt in this way, degree of accuracy is higher to all PCM data analysis of audio file to obtain volume characteristics, but due to process numerous and diverse, therefore time delay is larger.
As shown in Figure 7, the structural representation of the multimedia playing apparatus 700 provided for third embodiment of the invention.In the embodiment shown in fig. 7, the first volume characteristics acquisition module 510 comprises:
First abstraction module 514, when multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, the first audio frame group is extracted from the first audio file the first multimedia file, comprise the audio frame of specific quantity in described first audio file in described first audio frame group, or comprise the audio frame in described first audio file in special time period in described first audio frame group.Audio frame in first audio frame group can be randomly drawed, and also can be to extract according to the rule that pre-sets, such as, can extract the rear N number of audio frame in the first audio file, wherein N be not less than 2 natural number.
First decoder module 511, for described first audio frame group of decoding, obtains a PCM array.
First order module 512, for sorting the PCM data in a described PCM array according to order from small to large.
First quartile acquisition module 513, for searching the first lower quartile C1 and the first upper quartile C2 from the PCM array after sequence, wherein C1 is positioned at the PCM data of whole array 1/4 position in a PCM array after sequence, and C2 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
Second volume characteristics acquisition module 520 comprises:
To mourn in silence playing module 521, to be connected with the broadcasting link of the second multimedia file for setting up and to enter time-out play mode.By setting up the broadcasting link with the second multimedia file, the second multimedia file can be obtained and then obtain the second audio file, but, in order to avoid playing the second multimedia file immediately before volume adjusting, in an embodiment of the present invention, need to enter time-out play mode after link is play in foundation, postpone broadcasting second multimedia file.
Second abstraction module 525, for extracting the second audio frame group from the second audio file in the second multimedia file, comprise the audio frame of specific quantity in described second audio file in described second audio frame group, or comprise the audio frame in described second audio file in special time period in described second audio frame group.Audio frame in second audio frame group can be randomly drawed, and also can be to extract according to the rule that pre-sets, such as, can extract front M audio frame in the second audio file, wherein M be not less than 2 natural number.
Second decoder module 522, for described second audio frame group of decoding, obtains the 2nd PCM array.
Second order module 523, for sorting the PCM data in described 2nd PCM array according to order from small to large.
Second quartile acquisition module 524, for searching the second lower quartile C3 and the second upper quartile C4 from the 2nd PCM array after sequence, wherein C3 is positioned at the PCM data of whole array 1/4 position in the 2nd PCM array after sequence, and C4 is the PCM data being positioned at whole array 3/4 position in the 2nd PCM array after sequence.
Similarly, in this example, volume zoom factor adjustment module 530 can regulate the volume zoom factor of audio playing device according to C1, C2, C3, C4, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.The volume of upper quartile representative near the max volume of audio file (if such as PCM Data distribution8 is 0-255, then upper quartile may about 200), directly can represent the volume characteristics of the first audio file in the present embodiment with C2, represent the volume characteristics of the second audio file with C4.Preferably, in order to improve precision, the volume characteristics of the first audio file can also be represented with C2-C1, represent the volume characteristics of the second audio file with C4-C3.When implementing, the relation between the volume characteristics change of audio file and the volume zoom factor change of audio playing device can be pre-determined, such as, when the volume characteristics of audio file changes a preset difference value, volume zoom factor change 5%.
In the embodiment shown in fig. 7, for the first volume characteristics acquisition module 510, first decoder module 511 can be decoded to all audio frames of the first audio frame group, obtain the PCM data of the first audio frame group, again all PCM data are put into a PCM array so that first quartile acquisition module 513 carries out the analysis of quartile, thus obtain the first upper quartile C2 and the first lower quartile C1, in addition, first decoder module 511 also can be decoded to each audio frame of the first audio frame group respectively, the PCM data of single audio frame are put into a PCM array, lower quartile in upper quartile and frame in the frame that first quartile acquisition module 513 obtains this audio frame, then lower quartile in upper quartile in the frame of all audio frames in the first audio frame group and frame is put into a quartile array, after first order module 512 sorts, first quartile acquisition module 513 asks for upper quartile and the lower quartile of this quartile array again, as the first upper quartile C2 and the first lower quartile C1.Second decoder module 522, second order module 523 of the second volume characteristics acquisition module 520 and the course of work of the course of work of the second quartile acquisition module 524 and the first decoder module 511, first order module 512 of the first volume characteristics acquisition module 510 and first quartile acquisition module 513 similar.
Preferably, in embodiment shown in Fig. 7, multimedia playing apparatus 500 also comprises: extract control module, for when the C2 that first quartile acquisition module 513 calculates is zero, controls the first abstraction module 514 and again from the first audio file the first multimedia file, extract the first audio frame group; Also for when the C4 that the second quartile acquisition module 524 calculates is zero, control the second abstraction module 525 and again from the second audio file the second multimedia file, extract the second audio frame group.As long as because in C2 and C4 one be zero, illustrate in the first audio file and the second audio file may have one in extracted PCM data everywhere in quiet or close to mute state, the volume characteristics now obtained lacks reference value, be not suitable for carrying out volume adjusting according to this group audio frame, and need again to extract audio frame analysis.In addition, analysis times threshold value can also be set, if the number of times again extracted when switching between the first multimedia file and the second multimedia file exceeds described analysis times threshold value, then terminate volume regulating step, play-over the second multimedia file.
Embodiment shown in Fig. 7 only to the part PCM data analysis of audio file, obtains the volume characteristics of whole audio file, obviously, adopts this precision of method lower, but calculates simple, and thus time delay is less.When reality is implemented, suitably can select the quantity of extracted audio frame, to obtain best equilibrium in precision and time delay.
Refer to Fig. 8, it is the structural representation of the multimedia playing apparatus 800 that fourth embodiment of the invention provides, wherein, the first volume characteristics acquisition module 510 and the second volume characteristics acquisition module 520 have been described in detail with reference to figure 6 and Fig. 7, do not repeat them here.
Wherein, volume zoom factor adjustment module 530 comprises:
Original sound volume zoom factor logging modle 531, when the multimedia file for current broadcasting switches to the second multimedia file from the first multimedia file, the volume zoom factor A of audio playing device during the first multimedia file described in recording played.
Revise volume zoom factor computing module 532, for regulating the volume zoom factor of audio playing device according to formula B=A+A (C2-C4)/(C4-C3), wherein B is the volume zoom factor of audio playing device when playing described second multimedia file, to make described audio playing device consistent with the volume scaled results of described audio playing device to described second audio file to the volume scaled results of described first audio file.
Preferably, multimedia playing apparatus 800 can also comprise: volume zoom factor correction module, when the value for the B calculated at described correction volume zoom factor computing module 532 is greater than 100%, the value of B is set to 100%.
In the embodiment above, if carry out play multimedia file by the audio playing software on multimedia equipment or video jukebox software, multimedia equipment and audio playing software or video jukebox software all have the audio playing device that can carry out volume convergent-divergent to sound, the volume adjusting module of such as audio playing software or video jukebox software and the loudspeaker of multimedia equipment, can the volume zoom factor of these two kinds of audio playing devices of comprehensive adjustment when volume zoom factor adjustment module 530 regulates volume zoom factor.
In addition, if it should be understood by one skilled in the art that the local volume characteristics storing the multimedia file play to some extent, then volume characteristics acquisition module directly can read this volume characteristics and contrasts, and does not need to carry out Decoding Analysis again.Such as, multimedia playing apparatus 500,600,700 or 800 is play multimedia file A, multimedia file B and multimedia file C successively, when switching to B from A, obtain the volume characteristics of B, when switching to C from B, just can no longer analyze the volume characteristics of B, but the volume characteristics of Direct Analysis C, then carry out contrasting to obtain new volume zoom factor.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
Above disclosedly be only a kind of preferred embodiment of the present invention, certainly the interest field of the present invention can not be limited with this, one of ordinary skill in the art will appreciate that all or part of flow process realizing above-described embodiment, and according to the equivalent variations that the claims in the present invention are done, still belong to the scope that invention is contained.