Summary of the invention
The invention provides a kind of volume adjusting method and device, can be by obtaining the gain of the voice signal of input source, the size of automatic regulating volume, and then strengthened terminal and user's interaction capabilities.
For achieving the above object, embodiments of the invention adopt following technical scheme:
The embodiment of the present invention provides a kind of volume adjusting method, comprising:
Obtain the pulse-code modulation PCM data of the voice signal of input source;
According to described PCM data, calculate the gain of the voice signal of described input source;
According to the gain of the voice signal of described input source, adopt preset algorithm, obtain step gain value;
According to described step gain value, regulate the gain of the voice signal of follow-up input source.
The described pulse-code modulation PCM data of obtaining the voice signal of input source; According to described PCM data, calculate the gain of the voice signal of described input source, comprising:
Voice signal to described input source is sampled, and obtains the voice signal value of some PCM sampled points;
The voice signal value of described some PCM sampled points is asked square divided by the value of sampling number, and the described value of asking square be take and 10 the end of as, taken the logarithm, then described logarithm value is multiplied by 10, obtain the gain of the voice signal of described input source.
According to described step gain value, before regulating the gain of voice signal of follow-up input source, described method also comprises:
Obtain the output threshold range of audio output device.
According to described step gain value, regulate the gain of the voice signal of follow-up input source, comprising:
If the gain of the voice signal of described follow-up input source, in described output threshold range,, according to described step gain value, regulates the gain of the voice signal of follow-up input source;
Or,
If the gain of the voice signal of described follow-up input source, in described output threshold range, is not controlled at the gain-adjusted of the voice signal of described follow-up input source in threshold range.
Before the pulse-code modulation PCM data of the described voice signal that obtains input source, also comprise:
Receive Intelligent volume regulating command.
The embodiment of the present invention provides a kind of volume adjustment device, comprising:
Acquiring unit, for obtaining the pulse-code modulation PCM data of the voice signal of input source;
Processing unit, for according to described PCM data, calculates the gain of the voice signal of described input source, and according to the gain of the voice signal of described input source, adopts preset algorithm, obtains step gain value;
Regulon, for according to described step gain value, regulates the gain of the voice signal of follow-up input source.
Described processing unit, specifically for the voice signal to described input source, sample, obtain the voice signal value of some PCM sampled points, and the voice signal value of described some PCM sampled points is asked square divided by the value of sampling number, and the described value of asking square be take and 10 the end of as, taken the logarithm, then described logarithm value is multiplied by 10, obtains the gain of the voice signal of described input source.
Described acquiring unit, also for obtaining the output threshold range of audio output device.
Described regulon, if specifically for the gain of the voice signal of described follow-up input source in described output threshold range,, according to described step gain value, regulate the gain of the voice signal of follow-up input source;
Or,
If, the gain-adjusted of the voice signal of described follow-up input source is controlled in threshold range not in described output threshold range specifically for the gain of the voice signal of described follow-up input source.
Described volume adjustment device, also comprises:
Receiving element, for receiving Intelligent volume regulating command.
The embodiment of the present invention provides a kind of volume adjusting method and device, by obtaining the pulse-code modulation PCM data of the voice signal of input source, and according to described PCM data, calculate the gain of the voice signal of described input source, according to the gain of the voice signal of described input source, adopt preset algorithm again, obtain step gain value, finally, according to described step gain value, regulate the gain of the voice signal of follow-up input source.In this programme, by obtaining gain and the step gain value of the voice signal of input source, and according to step gain value, regulate the gain of the voice signal of follow-up input source, thereby realize the size of automatic regulating volume, can make user when not regulating output gain, can hear the yield value in reasonable sound interval range, embody more intelligent one side.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment mono-
The embodiment of the present invention provides a kind of volume adjusting method, as shown in Figure 1, comprising:
S101, volume adjustment device obtain the pulse-code modulation PCM data of the voice signal of input source.
Concrete, when user is watching video or listening in the process of audio frequency, user may need to carry out volume adjusting by certain operations, and in a kind of volume adjusting method providing in the embodiment of the present invention, user can directly carry out volume by Intelligent volume adjusting device and automatically regulate.First open Intelligent volume adjusting device, volume adjustment device is accepted to receive Intelligent volume regulating command, then obtains the pulse-code modulation PCM data of the voice signal of input source.Illustrate, the input source that obtains voice signal can be TV input source HDMI(High Definition Multimedia Interface, HDMI (High Definition Multimedia Interface)), TV signal source or CVBS(Composite Video Broadcast Signal, Composite Video Broadcast Signal).The pulse-code modulation PCM of voice signal (Pulse Code Modulation) data are by simulated audio signal digitlization by pulse code modulation.
S102, volume adjustment device, according to PCM data, calculate the gain of the voice signal of input source.
Concrete, volume adjustment device is sampled to the voice signal of input source, obtains the voice signal value of some PCM sampled points; The voice signal value of some PCM sampled points is asked square divided by the value of sampling number, and the value of asking square be take and 10 the end of as, taken the logarithm, then logarithm value is multiplied by 10, obtain the gain of the voice signal of input source.Illustrate, as shown in Figure 5, abscissa is sample frequency, ordinate is sampling precision, and 2 bytes (16bit) are 65536 sampled points, ordinate is divided into 65536 parts of 2 16 powers, sample frequency is 44100Hz, be to sample each second 44100 times, the voice signal value of obtaining some PCM sampled points is x, and the gain computing formula of the voice signal of input source is:
dB=10*lg[(x/65536)
2]
In embodiments of the present invention, above-mentioned gain calculating method is exemplary a kind of method for optimizing, is not limited in take 10 the end of as, to calculate, also can be by other the truth of a matter, the precision of sampling in above-mentioned calculating can be also other numerical value, and the embodiment of the present invention is not specifically limited this.Calculating for gain is not limited in the above-mentioned computational methods that provide, and can be also that other method is calculated, and the embodiment of the present invention is also not specifically limited this.
S103, volume adjustment device, according to the gain of the voice signal of input source, adopt preset algorithm, obtain step gain value.
It should be noted that, this preset algorithm is the algorithm of volume adjustment device self configuration, is mainly to obtain step gain value by algorithm, is not limited only to a certain algorithm, can be also other algorithm, and the embodiment of the present invention is not done concrete restriction to this.
S104, volume adjustment device, according to step gain value, regulate the gain of the voice signal of follow-up input source.
Concrete, if the gain of the voice signal of follow-up input source is in output threshold range, according to step gain value, regulate the gain of the voice signal of follow-up input source; Or, if the gain of the voice signal of follow-up input source is not in output threshold range, the gain-adjusted of the voice signal of follow-up input source is controlled in threshold range.To guarantee that output sound signal can distortion wave absorption, and can protect acoustic device can not caused damage by excessive voice output.
The embodiment of the present invention provides a kind of volume adjusting method, by obtaining the pulse-code modulation PCM data of the voice signal of input source, and according to PCM data, calculate the gain of the voice signal of input source, according to the gain of the voice signal of input source, adopt preset algorithm again, obtain step gain value, finally, according to step gain value, regulate the gain of the voice signal of follow-up input source.In this programme, by obtaining gain and the step gain value of the voice signal of input source, and according to step gain value, regulate the gain of the voice signal of follow-up input source, thereby realize the size of automatic regulating volume, can make user when not regulating output gain, can hear the yield value in reasonable sound interval range, embody more intelligent one side.
Embodiment bis-
The embodiment of the present invention provides a kind of volume adjusting method, as shown in Figure 2, comprising:
S201, volume adjustment device receive Intelligent volume regulating command.
Concrete, when user is watching video or listening in the process of audio frequency, user may need to carry out volume adjusting by certain operations, and in a kind of volume adjusting method providing in the embodiment of the present invention, user can directly carry out volume by Intelligent volume adjusting device and automatically regulate.First open Intelligent volume adjusting device, volume adjustment device is accepted to receive Intelligent volume regulating command, then obtains the pulse-code modulation PCM data of the voice signal of input source.Illustrate, the input source that obtains voice signal can be TV input source HDMI(High Definition Multimedia Interface, HDMI (High Definition Multimedia Interface)), TV signal source, CVBS(Composite Video Broadcast Signal, Composite Video Broadcast Signal).
S202, volume adjustment device are sampled to the voice signal of input source, obtain the voice signal value of some PCM sampled points; The voice signal value of some PCM sampled points is asked square divided by the value of sampling number, and the value of asking square be take and 10 the end of as, taken the logarithm, then logarithm value is multiplied by 10, obtain the gain of the voice signal of input source.
Illustrate, as shown in Figure 5, abscissa is sample frequency, ordinate is sampling precision, and 2 bytes (16bit) are 65536 sampled points, ordinate is divided into 65536 parts of 2 16 powers, sample frequency is 44100Hz, be to sample each second 44100 times, the voice signal value of obtaining some PCM sampled points is x, and the gain computing formula of the voice signal of input source is:
dB=10*lg[(x/65536)
2]
In embodiments of the present invention, above-mentioned gain calculating method is exemplary a kind of method for optimizing, is not limited in take 10 the end of as, to calculate, also can be by other the truth of a matter, the precision of sampling in above-mentioned calculating can be also other numerical value, and the embodiment of the present invention is not specifically limited this.Calculating for gain is not limited in the above-mentioned computational methods that provide, and can be also that other method is calculated, and the embodiment of the present invention is also not specifically limited this.
S203, volume adjustment device obtain the output threshold range of audio output device.
Volume adjustment device obtains the output threshold range of audio output device; if the gain of the voice signal of follow-up input source is not in output threshold range; the gain-adjusted of the voice signal of follow-up input source is controlled in threshold range; to guarantee that output sound signal can distortion wave absorption, and can protect acoustic device can not caused damage by excessive voice output.
If the gain of the voice signal of the input source that S204 is follow-up is in output threshold range, volume adjustment device, according to step gain value, regulates the gain of the voice signal of follow-up input source; Or,
If the gain of the voice signal of follow-up input source is not in output threshold range, volume adjustment device is controlled at the gain-adjusted of the voice signal of follow-up input source in threshold range.
Illustrate, the yield value of input audio signal is-5dB that the output threshold range of audio output device is-20dB~+ 20dB that step gain is 2dB, after regulating by volume adjustment device, the yield value of output sound signal is-3dB that output sound signal can be exaggerated 2dB.If the gain of the voice signal of follow-up input source, in output threshold range, is not controlled at the gain-adjusted of the voice signal of follow-up input source in threshold range.To guarantee that output sound signal can distortion wave absorption, and can protect acoustic device can not caused damage by excessive voice output.
The embodiment of the present invention provides a kind of volume adjusting method, by obtaining the pulse-code modulation PCM data of the voice signal of input source, and according to PCM data, calculate the gain of the voice signal of input source, according to the gain of the voice signal of input source, adopt preset algorithm again, obtain step gain value, finally, according to step gain value, regulate the gain of the voice signal of follow-up input source.This programme can carry out intelligence to volume and regulate, by obtaining gain and the step gain value of the voice signal of input source, the size of automatic regulating volume, can make user when not regulating output gain, can hear the yield value in reasonable sound interval range, embody more intelligent one side.
Embodiment tri-
The embodiment of the present invention provides a kind of volume adjustment device 1, as shown in Figure 3, comprising:
Acquiring unit 10, for obtaining the pulse-code modulation PCM data of the voice signal of input source;
Processing unit 11, for according to PCM data, calculates the gain of the voice signal of input source, and according to the gain of the voice signal of input source, adopts preset algorithm, obtains step gain value;
Regulon 12, for according to step gain value, regulates the gain of the voice signal of follow-up input source.
Processing unit 11, specifically for the voice signal to input source, sample, obtain the voice signal value of some PCM sampled points, and the voice signal value of some PCM sampled points is asked square divided by the value of sampling number, and the value of asking square be take and 10 the end of as, taken the logarithm, then logarithm value is multiplied by 10, obtains the gain of the voice signal of input source.
Acquiring unit 10, also for obtaining the output threshold range of audio output device.
Regulon 12, if specifically for the gain of the voice signal of follow-up input source in output threshold range, according to step gain value, regulate the gain of the voice signal of follow-up input source; Or,
If, the gain-adjusted of the voice signal of follow-up input source is controlled in threshold range not in output threshold range specifically for the gain of the voice signal of follow-up input source.
Volume adjustment device 1, as shown in Figure 4, also comprises:
Receiving element 13, for receiving Intelligent volume regulating command.
The embodiment of the present invention provides a kind of volume adjustment device, by obtaining the pulse-code modulation PCM data of the voice signal of input source, and according to PCM data, calculate the gain of the voice signal of input source, according to the gain of the voice signal of input source, adopt preset algorithm again, obtain step gain value, finally, according to step gain value, regulate the gain of the voice signal of follow-up input source.In this programme, by obtaining gain and the step gain value of the voice signal of input source, and according to step gain value, regulate the gain of the voice signal of follow-up input source, thereby realize the size of automatic regulating volume, can make user when not regulating output gain, can hear the yield value in reasonable sound interval range, embody more intelligent one side.
Those skilled in the art can be well understood to, for convenience and simplicity of description, only the division with above-mentioned each functional module is illustrated, in practical application, can above-mentioned functions be distributed and by different functional modules, completed as required, the internal structure that is about to device is divided into different functional modules, to complete all or part of function described above.The system of foregoing description, the specific works process of device and unit, can, with reference to the corresponding process in preceding method embodiment, not repeat them here.
In the several embodiment that provide in the application, should be understood that, disclosed system, apparatus and method, can realize by another way.For example, device embodiment described above is only schematic, for example, the division of module or unit, be only that a kind of logic function is divided, during actual realization, can have other dividing mode, for example a plurality of unit or assembly can in conjunction with or can be integrated into another system, or some features can ignore, or do not carry out.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, indirect coupling or the communication connection of device or unit can be electrically, machinery or other form.
Unit as separating component explanation can or can not be also physically to separate, and the parts that show as unit can be or can not be also physical locations, can be positioned at a place, or also can be distributed in a plurality of network element.Can select according to the actual needs some or all of unit wherein to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can be also that the independent physics of unit exists, and also can be integrated in a unit two or more unit.Above-mentioned integrated unit both can adopt the form of hardware to realize, and also can adopt the form of SFU software functional unit to realize.
If the form of SFU software functional unit of usining integrated unit realizes and during as production marketing independently or use, can be stored in a computer read/write memory medium.Understanding based on such, the all or part of of the part that technical scheme of the present invention contributes to prior art in essence in other words or this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprise that some instructions are with so that a computer equipment (can be personal computer, server, or the network equipment etc.) or processor (processor) carry out all or part of step of each embodiment method of the present invention.And aforesaid storage medium comprises: various media that can be program code stored such as USB flash disk, portable hard drive, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CDs.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of described claim.