Summary of the invention
Support the problem that audio plays is of low quality to need a kind of method of self-adaptative adjustment sampling rate and sampling precision for acquiescence.
A kind of method that Android system improves audio recording and reproducing quality is proposed herein, comprise the steps: the audio types according to current setting, judge whether to carry out variable sampling rate and sampling precision, when being judged as YES, then obtain sampling rate and the sampling precision information of the current audio track needing system variable sampling rate and precision to support;
Above-mentioned sampling rate and sampling precision and current Audio Mixing Recorder corresponding informance are compared, if confirm inconsistent, then destroy present video mixer, re-create Audio Mixing Recorder according to the audio stream sampling rate of comparison and sampling precision, and the aftertreatment link before exporting; Audio frequency exports the sampling rate and the sampling precision that then export demand according to this, reinitializes a whole set of audio frequency output channel.
Further, before obtaining sampling rate and sampling precision, also comprise the interface that the newly-built audio track of step makes its compatible original audio track, the audio sample rate originally supported and sampling precision restriction are revised.
Further, can carry out variable sampling rate and sampling precision is judged as NO if no, then audio frequency is exported by audio hardware level of abstraction after directly entering the Audio Mixing Recorder process of system default sampling rate and sampling precision.
Further, judge whether present video exports setting consistent according to audio track sampling rate and sampling precision information, if inconsistent, export to audio frequency, audio hardware level of abstraction and audio mixing rail notice namely will the sampling rate of output audio and sampling precisions, audio frequency output, audio hardware level of abstraction and audio mixing rail is allowed to adjust accordingly, if consistent, by exporting after current effective Audio Mixing Recorder process.
Concrete, described aftertreatment link is mixer mixing track and sound effect control.
Improve a device for Android system audio recording and reproducing quality, comprise as lower module: judge module, acquisition module, contrast module, destruction creation module and output module; Described judge module is used for the audio types according to current setting, judge whether to carry out audio system variable sampling rate and sampling precision, acquisition module is used for when whether carrying out audio system variable sampling rate and sampling precision is judged as YES, and obtains sampling rate and the sampling precision information of the current audio track needing system variable sampling rate and precision to support;
Contrast module is used for comparing to above-mentioned sampling rate and sampling precision and current Audio Mixing Recorder corresponding informance, destroy creation module to be used for destroying present video mixer when comparison is inconsistent, and re-create Audio Mixing Recorder according to the audio stream sampling rate of comparison and sampling precision, then the aftertreatment link before exporting; Output module is used for the sampling rate and the sampling precision that export demand according to this, reinitializes a whole set of audio frequency output channel.
Further, also comprise load module, described load module is used for the interface that newly-built audio track makes its compatible original audio track, revises the audio sample rate originally supported and sampling precision restriction.
Further, described output module also for when whether carrying out variable sampling rate and sampling precision is judged as NO, is exported by audio hardware level of abstraction after allowing audio frequency directly enter the Audio Mixing Recorder process of system default sampling rate and sampling precision.
Further, whether judge module is also consistent for judging that according to audio track sampling rate and sampling precision information present video exports setting;
Also comprise notification module, described notification module be used for audio frequency export arrange be inconsistent time export to audio frequency, audio hardware level of abstraction and audio mixing rail notice will the sampling rate of output audio and sampling precisions;
Also comprise and arrange adjusting module, the described adjusting module that arranges is for adjusting accordingly audio frequency output, audio hardware level of abstraction and audio mixing rail;
By exporting after current effective Audio Mixing Recorder process when output module also arranges consistent for audio frequency output.
Concrete, the aftertreatment link that described destruction creation module is carried out is mixer mixing track and sound effect control.
Be different from prior art, the idiographic flow of scheme of the present invention is by the more branched music type input of holding of expansion, variable sampling rate and the Variable sampling precision of dynamic self-adapting is carried out when different audio data streams enters, when Audio Mixing Recorder and present video inconsistent time destroy Audio Mixing Recorder and create new Audio Mixing Recorder, more different audio data stream is carried out synthesizing rear output.Serve and shake off the effect that Android system acquiescence supports the constraint of sample rate accuracy limitations, reach the effect improving Android system audio recording and reproducing quality, solve the problem that prior art sound intermediate frequency is of low quality.
Embodiment
By describe in detail technical scheme technology contents, structural attitude, realized object and effect, coordinate accompanying drawing to be explained in detail below in conjunction with specific embodiment.
As shown in Figure 1, show the original audio system of android system and export block diagram, the AudioClient shown in figure is the external interface that Android system carries out gathering sound signal; AudioFlinger is the audio frequency controller service in Android system, is the main tool of processing audio; AudioOutput is that audio frequency exports, and is responsible for carrying out output function to the audio frequency processed.As we can see from the figure, the audio input signal collected of different track (AudioTrack, and most multipotency supports 32 tracks) by AudioClient, is delivered to audio frequency controller service (AudioFlinger) by Android system.Then carry out the links such as resampling, volume control, audio effect processing to deliver to audio frequency and export (AudioOutPut) through Audio Mixing Recorder (AudioMixer) and carry out final digital audio territory and export.And in fact, as shown in Figure 3, in the process that the audio frequency of Android system to input processes, for the audio frequency of the sampling rate exceeded in the scope of original acquiescence and sampling precision (such as higher than sampling rate 48KHz sampling precision 16Bit/8Bit), carry out the resampling giving tacit consent to 44.1KHz frequency, distortion to a certain degree will be caused.In some practical application, for the audio frequency processing above-mentioned high sampling rate and high sampling precision, also can point out and not support to wait the generation affecting the unfavorable condition of Consumer's Experience.
Unlike the prior art, some specific embodiment that Fig. 4 demonstrates the technical program carries out some amendments to MixerThread, and Android system can be supported, and the audio frequency of nonsystematic default sample rate exports.Particular flow sheet refers to Fig. 2, the present embodiment proposes a kind of method improving Android system audio recording and reproducing quality, comprise the steps: the audio types of step S1 according to current setting, judge whether to carry out variable sampling rate and sampling precision, when being judged as YES, then carry out sampling rate and sampling precision information that step S2 obtains the current audio track needing system variable sampling rate and precision to support.Described audio types is the audio types of setting in Android, such as, in Android system audio types is divided into MUSIC, VOIP, RING, ALARM etc., is equipped with the attribute of audio types when each audio frequency is created.The wherein broadcasting of high quality audio, as the high quality audio such as music, film, all plays with MUSIC type.This method can according to practical application need audio types is set, as in certain embodiments, when the current audio types (namely needing the audio types of variable sampling rate and Variable sampling precision) pre-set is for MUSIC and VOIP type, when so other audio types (as RING) input, then without the need to carrying out variable sampling rate and the support of Variable sampling precision, also without the need to operating it.When being judged as YES, then obtain the information such as sampling rate and sampling precision of described input audio frequency.
Carry out step S5 subsequently to compare to above-mentioned sampling rate and sampling precision and current Audio Mixing Recorder corresponding informance (i.e. sampling rate and sampling precision), if confirm inconsistent, namely Audio Mixing Recorder cannot directly process above-mentioned audio frequency, then carry out step S6 and destroy present video mixer, carry out step S7 again and re-create Audio Mixing Recorder according to the audio sample rate of comparison and sampling precision, namely the Audio Mixing Recorder of the above-mentioned sampling rate of new support and sampling precision is created, and the aftertreatment link before exporting.Audio frequency exports the sampling rate and the sampling precision that then export demand according to this, reinitializes a whole set of audio frequency output channel.By above-mentioned destruction present video mixer, the step creating Audio Mixing Recorder, initialization audio frequency output channel, reach and the sampling rate do not supported is given tacit consent to script Android system and sampling precision audio frequency carries out adjusting the object adapted to, these audio frequency can be exported by Audio Mixing Recorder and audio frequency directly export, avoid the distortion causing audio frequency after resampling is carried out to these audio frequency to prior art, reach the object improving Android system audio recording and reproducing quality.
In other specific embodiments, can variable sampling rate be carried out if no and sampling precision is judged as NO, then carry out being exported by audio hardware level of abstraction after step S8 audio frequency directly enters the Audio Mixing Recorder process of system default sampling rate and sampling precision.Such as, when the audio types (namely needing the audio types of variable sampling rate and Variable sampling precision) of current setting is for MUSIC and VOIP type, if run into the audio frequency input of RING, ALARM type, then do not carry out the operation of variable sampling rate sampling precision, user can be arranged according to the needs of oneself, the operation of raising tonequality is not then carried out for the audio types that quality requirements is not high, reach saving system resource, improve the effect of this method operational efficiency.
In some specific embodiment, before obtaining sampling rate and sampling precision, also comprise the interface that the newly-built audio track of step makes its compatible original audio track, the audio sample rate originally supported and sampling precision restriction are revised.Input mode corresponding to different audio types is also different, we can see in fig. 2, there is audio/video player in the source of AudioClient sound intermediate frequency, games, the source of VOIP audio types can be sound pick-up outfit, its sample rate accuracy limitations is revised by newly-built audio track, the audio frequency of its sampling rate supporting 8K ~ 192KHz and 8bit/16bit/24bit/32bit is inputted, reach the effect of the more high-precision audio quality of support, when solving the audio frequency processing high sampling rate sampling precision in the present case, Android system can point out the problem do not supported, improve the experience of user.In addition, also better reach by change input restriction the object improving Android system inputting audio quality simultaneously.
In order to the audio frequency of better outputting high quality, other unit such as audio frequency output etc. is also needed to carry out more effective cooperation, in some specific embodiment, also comprise step S3, judge whether present video exports setting consistent according to audio track sampling rate and sampling precision information, if inconsistent, carry out step S4 and export to audio frequency, audio hardware level of abstraction and audio mixing rail notice namely will the sampling rate of output audio and sampling precisions, audio frequency is allowed to export, audio hardware level of abstraction and audio mixing rail adjust accordingly, audio frequency is exported, audio hardware level of abstraction and audio mixing rail can support sampling rate and the sampling precision of present video.If consistent, carry out step S9 by exporting after current effective Audio Mixing Recorder process.Described audio hardware level of abstraction (AudioHal) can simulate software control interface on hardware view; It is the necessary ways that audio stream exports after AudioFlinger that described audio frequency exports; Described audio mixing rail is used for the audio stream of multitone rail to synthesize, and specifically refers to these parts of MixerThread in the method.Determine inconsistent after, carry out above-mentioned set-up procedure S3, play as audio frequency to be output provides the effect of output environment.Current AudioMixer and AudioOutput can be directly used to export when determining consistent, it should be noted that, the AudioMixer of what AudioMixer current here referred to can be system default sampling rate and sampling precision, also can before with the created AudioMixer of this method.When being judged to be consistent, output being set with existing, adjusting when judging inconsistent, treat output audio output environment and carried out good process and configuration, serve the effect exporting higher-quality audio frequency.
In other specific embodiments, described step S10 aftertreatment link is mixer mixing track and sound effect control, and namely mixer carries out to audio frequency the sound effect control mixing track and audio frequency.Concrete, after AudioMixer process, carrying out mixing track and sound effect control again, what the audio stream of original multiple track to be processed can be made to play is more natural.And after aftertreatment link, make sound to export or to play.
And inventor also provides a kind of device improving Android system audio recording and reproducing quality, comprises as lower module: judge module 102, acquisition module 103, contrast module 105, destruction creation module 107 and output module 108; Described judge module 102 is for the audio types according to current setting, judge whether to carry out audio system variable sampling rate and sampling precision, acquisition module 103, for when whether carrying out audio system variable sampling rate and sampling precision is judged as YES, obtains sampling rate and the sampling precision information of the current audio track needing system variable sampling rate and precision to support;
Contrast module 105 is for comparing to above-mentioned sampling rate and sampling precision and current Audio Mixing Recorder corresponding informance, destroy creation module 107 for destroying present video mixer when comparison is inconsistent, and re-create Audio Mixing Recorder according to the audio stream sampling rate of comparison and sampling precision, then the aftertreatment link before exporting; Output module 108, for exporting sampling rate and the sampling precision of demand according to this, reinitializes a whole set of audio frequency output channel.The benefit designing these modules is to reach sampling rate that to be given tacit consent to by script Android system and do not support and sampling precision audio frequency carries out adjusting the object adapted to, these audio frequency can be exported by Audio Mixing Recorder and audio frequency directly export, avoid and the distortion that resampling causes is carried out to these audio frequency, solve the problem improving Android system audio recording and reproducing quality.
Concrete, also comprise load module 101, described load module is used for the interface that newly-built audio track makes its compatible original audio track, revises the audio sample rate originally supported and sampling precision restriction.The operation revising sampling rate and sampling precision is exercised by design load module, reach the effect of the more high-precision audio quality of support, when solving the audio frequency processing high sampling rate sampling precision in some circumstances, Android system can point out the problem do not supported, improves the experience of user.
In further embodiments, described output module 108 also for when whether carrying out variable sampling rate and sampling precision is judged as NO, is exported by audio hardware level of abstraction after allowing audio frequency directly enter the Audio Mixing Recorder process of system default sampling rate and sampling precision.Output module is designed to, to not needing the audio file of variable sampling rate sampling precision directly to export, improve the work efficiency of system, save the resource of system.
Concrete, whether described judge module 102 is also consistent for judging that according to audio track sampling rate and sampling precision information present video exports setting;
Also comprise notification module 104, described notification module be used for audio frequency export arrange be inconsistent time export to audio frequency, audio hardware level of abstraction and audio mixing rail notice will the sampling rate of output audio and sampling precisions;
Also comprise and arrange adjusting module 106, the described adjusting module that arranges is for adjusting accordingly audio frequency output, audio hardware level of abstraction and audio mixing rail;
By exporting after current effective Audio Mixing Recorder process when output module 108 also arranges consistent for audio frequency output.
By designing above-mentioned judge module 102, notification module 104, arranging interactive cooperation between adjusting module 106 and output module 108, serve, when being judged to be consistent, output is set with existing, adjust when judging inconsistent, treat output audio output environment and carry out the effect of good process and configuration, reach the effect making the higher-quality audio frequency of output, also better solve the not high problem of Android system playing quality.
Concrete, the aftertreatment link that described destruction creation module 107 is carried out is mixer mixing track and sound effect control.Destroyed the aftertreatment link of creation module by design, what the audio stream of original multiple track to be processed can be made to play is more natural, and sound effect control also can improve the quality of audio plays, also reaches and solves Android system audio plays problem of low quality.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or terminal device and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or terminal device.When not more restrictions, the key element limited by statement " comprising ... " or " comprising ... ", and be not precluded within process, method, article or the terminal device comprising described key element and also there is other key element.In addition, in this article, " be greater than ", " being less than ", " exceeding " etc. be interpreted as and do not comprise this number; " more than ", " below ", " within " etc. be interpreted as and comprise this number.
Those skilled in the art should understand, the various embodiments described above can be provided as method, device or computer program.These embodiments can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.The hardware that all or part of step in the method that the various embodiments described above relate to can carry out instruction relevant by program has come, described program can be stored in the storage medium that computer equipment can read, for performing all or part of step described in the various embodiments described above method.Described computer equipment, includes but not limited to: personal computer, server, multi-purpose computer, special purpose computer, the network equipment, embedded device, programmable device, intelligent mobile terminal, intelligent home device, wearable intelligent equipment, vehicle intelligent equipment etc.; Described storage medium, includes but not limited to: the storage of RAM, ROM, magnetic disc, tape, CD, flash memory, USB flash disk, portable hard drive, storage card, memory stick, the webserver, network cloud storage etc.
The various embodiments described above describe with reference to the process flow diagram of method, equipment (system) and computer program according to embodiment and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of computer equipment to produce a machine, making the instruction performed by the processor of computer equipment produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer equipment readable memory that works in a specific way of vectoring computer equipment, the instruction making to be stored in this computer equipment readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded on computer equipment, make to perform sequence of operations step on a computing device to produce computer implemented process, thus the instruction performed on a computing device is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although be described the various embodiments described above; but those skilled in the art are once obtain the basic creative concept of cicada; then can make other change and amendment to these embodiments; so the foregoing is only embodiments of the invention; not thereby scope of patent protection of the present invention is limited; every utilize instructions of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included within scope of patent protection of the present invention.