1. Field of the Invention
The present invention provides methods and a related circuit for automatic audio volume level control, and more particularly, for tracking the local maximum of the volume of an audio signal, so as to control volume automatically.
2. Description of the Prior Art
Video programs from mass media provide news, knowledge, and entertainment for audiences, and people can choose what they want from the available programs. However, for commercial purposes, these programs are often alternated with advertisements. Moreover, in order to enhance commercial effect, some advertising spots are played at a higher volume. The higher the volume of the commercial spots during programs, the more uncomfortable these commercials are for the audiences. In this situation, audiences can only decrease the volume during commercial spots, and increase the volume again after commercial spots. Such repeated tuning down and up causes the audience inconvenience.
It is therefore a primary objective of the claimed invention to provide methods and a related circuit for automatic audio volume level control.
The claimed invention discloses a method for controlling volume automatically. The method comprises: receiving an audio signal comprising a plurality of audio data, the audio signal being capable of providing each audio data according to a default order; recording a max-mean data; applying a volume-tracking process to each audio data of the audio signal; and performing a volume adjustment process after applying the volume-tracking process to an audio data for setting the volume of the audio data according to the value of the max-mean data. The volume-tracking process comprising: when applying the volume-tracking process to the audio data, performing a volume detection step for selecting a plurality of audio data according to an order of the audio data in the audio signal, and calculating a corresponding mean-volume data according to the selected audio data; comparing the mean-volume data with the value of the max-mean data; if the mean-volume data is larger than the max-mean data, then performing an update step for updating the max-mean data according to the mean-volume data; recording whether the max-mean data is updated; and when applying the volume-tracking process to an audio data, if the max-mean data has not been updated after applying the volume-tracking process to a predetermined number of audio data prior to the audio data, then updating the value of the max-mean data according to the mean-volume data corresponding to the audio data.
The claimed invention further discloses a control circuit for controlling volume automatically. The control circuit comprises: a reception circuit for receiving an audio signal, the audio signal comprising a plurality of audio data, the audio signal capable of providing each audio data according to a default order; a data register module for recording a max-mean data; a volume-tracking module; and a volume adjustment module which is capable of adjusting the volume of the audio data according to the value of the max-mean data after the volume-tracking module processes an audio data. The volume-tracking module comprises: a volume detection module for selecting a plurality of audio data according to an order of each audio data in the audio signal, and calculating a corresponding mean-volume data according to the selected audio data; a comparison module for receiving the mean-volume data, and comparing the mean-volume data with the value of the max-mean data; an update module which is capable of updating the max-mean data according to the mean-volume data when the comparison module determines that the mean-volume data is larger than the max-mean data; a continuation-status register module for recording whether the max-mean data has been updated according to the status of whether the update module has updated the max-mean data; and a decision module which updates the value of the max-mean data according to the mean-volume data corresponding to the audio data when the volume detection module processes an audio data, if the continuation-status register module indicates that the max-mean data is not yet updated after applying the volume-tracking process to a predetermined number of audio data prior to the audio data.
The claimed invention further discloses a method for tracking dynamic volume. The method comprises: receiving an audio signal comprising a plurality of audio data, the audio signal capable of providing each audio data according to a default order; recording a max-mean data; and applying a volume-tracking process to each audio data of the audio signal. The volume-tracking process comprises: when taking the volume-tracking process to an audio data, performing a volume detection step for selecting a plurality of audio data according to an order of the audio data in the audio signal, and calculating a corresponding mean-volume data according to the selected audio data; comparing the mean-volume data with the value of the max-mean data; if the mean-volume data is larger than the max-mean data, then performing an update step for updating an original value of the max-mean data according to the mean-volume data; recording whether the max-mean data is updated or not; and when taking the volume-tracking process to an audio data, if the max-mean data is not yet updated after taking the volume-tracking process to a predetermined number of audio data prior to the audio data, then updating the value of the max-mean data according to the mean-volume data corresponding to the audio data.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Please refer to
An overview of the operation of the control circuit 10 is as follows. First, the volume detection module 14 of the control circuit 10 calculates a mean-volume data mean in response to each audio data sample S(n), representing the mean volume around the audio data S(n). Then, the control circuit 10 compares the mean-volume data mean with the max-mean data max_mean. If the mean-volume data mean is larger than the max-mean data max_mean, the control circuit 10 updates the max-mean data max_mean according to the mean-volume data mean, so as to make the max-mean data max_mean track the maximum volume of the audio signal S. Alternatively, if the mean-volume data mean is not larger than the max-mean data max_mean, the control circuit 10 does not update the max-mean data max_mean, and continues to accumulate the data life_counter, which represents the number of times of the max-mean data max_mean was not updated. After the control circuit 10 handles the audio data S(n), S(n+1), and S(n+2), if the data life_counter indicates that the number of times that the max-mean data max_mean has not been updated is greater than a default, the control circuit 10 updates the max-mean data max_mean to ensure that the max-mean data max_mean reflects the local maximum of the volume of the audio signal S. As a result, according to the max-mean data max_mean, the control circuit 10 can determine spots of high volume in the audio signal S properly, and therefore control the volume automatically, so as to decrease volume during the high-volume periods.
The operation of the control circuit 10 can be described in detail as follows. First, the volume detection module 14 calculates a mean-volume data mean corresponding to each of the audio data samples S(n). In a preferred embodiment of the present invention, the volume detection module 14 determines the mean-volume data mean corresponding to the audio data samples neighboring the audio data sample S(n). For example, as shown in
After the volume detection module 14 calculates the mean-volume data mean corresponding to each of the audio data samples S(n), the comparison module 16 compares the mean-volume data mean with the max-mean data max_mean in the register module 26A. If the mean-volume data mean is larger than the max-mean data max_mean, the update module 18 updates the max-mean data max_mean in the register module 26A. In the preferred embodiment of the present invention, the update module 18 can take the mean of the max-mean data max_mean and the mean-volume data mean before updating (that is, (max_mean+mean)/2) as an updated max-mean data max_mean. Meanwhile, the update module 18 resets the data life_counter in the register module 26B after updating the max-mean data max_mean, indicating that the max-mean data max_mean has been updated.
On the other hand, if the result of the comparison module 16 is that the mean-volume data mean is not larger than the max-mean data max_mean, the decision module 20 compares the data life_counter with a constant data life_threshold in the register module 24B. If the data life_counter is greater than the data life_threshold, meaning that the number of times that the max-mean data max_mean has not been updated is greater than a default, the decision module 16 updates the max-mean data max_mean. In this situation, the decision module 16 uses the mean of the max-mean data max_mean and the mean-volume data mean before updating as an updated max-mean data max_mean. Alternatively, if the data life_counter is not larger than the data life_threshold, the current max-mean data max_mean is not updated, but the decision module 20 updates the data life_counter in the register module 26B to continue to accumulate the data life_counter, indicating that the number of times the max-mean data max_mean has not been updated increased again.
During operation of the update module 18 and the decision module 20, the max-mean data max_mean reflects the local maximum volume of the audio signal S, and the volume adjustment module 22 of the control circuit 10 adjusts volume accordingly when playing the audio signal S. In the preferred embodiment of the present invention, the volume adjustment module 22 compares the max-mean data max_mean with the constant data max_volume_level in the register module 24C. The constant data max_volume_level is a threshold volume data. When the volume adjustment module 22 determines that the max-mean data max_mean is greater than the threshold volume data max_volume_level, the volume adjustment module 22 calculates a volume adjustment scalar (such as a value of max_volume_level/max_mean) which is smaller than 1, to create an adjusted audio data S2(n) by multiplying the original audio data S(n) by the scalar. Otherwise, if the max-mean data max_mean is not greater than the threshold volume data max_volume_level, the volume adjustment module 22 sets the scalar to 1. After adjusting the volume based on the scalar, the audio data S2(n) is output by the control circuit 10. By playing the audio data S2(n), the control circuit 10 can compensate for the high volume sequences in the audio signal S.
The above-mentioned operations of the control circuit 10 can be further described with an algorithm process as shown in
Step 102: receiving an audio data S(n) from the audio signal S.
Step 104: calculating a corresponding mean-volume data mean according to the audio data neighboring the audio data S(n). This step can be performed by the volume detection module 14 in
Step 106: determining whether the mean-volume data mean is larger than the max-mean data max_mean. If true, proceed to step 110 to update the max-mean data max_mean, else proceed to step 108.
Step 108: checking if the data life_counter is larger than the constant data life_threshold. If true, proceed to step 110, else proceed to step 112.
Step 110: Updating the max-mean data max_mean according to the mean-volume data mean, and resetting the data life_counter. As mentioned above, in the preferred embodiment of the present invention, a mean of the previous max-mean data max_mean and the current mean-volume data mean is taken as the updated max-mean data max_mean. Also, the data life_counter is set to 0.
Step 112: incrementing the data life_counter each time an audio data S(n) is processed. The data life_counter is incremented by 1.
Step 114: checking if the max-mean data max_mean is larger than the threshold volume data max_volume_level. If true, proceed to step 118, else proceed to step 116.
Step 116: set the volume adjustment scalar to 1, so as to maintain the volume of the audio data S(n).
Step 118: calculating a volume adjustment scalar (such as max_volume_level/max-mean) which is in the range 0 to 1, including 0 but not including 1, and multiplying the audio data S(n) by the scalar, so as to decrease the volume of the audio data S(n).
Step 120: incrementing n, so as to perform the process 100 for the next audio data in the audio signal S.
In the process 100, step 102 to 112 can be seen as a volume-tracking process, while step 114 to 118 can be seen as a volume adjustment process. After applying the volume-tracking process of process 100 to each of the audio data in the audio signal S, if the max-mean data max_mean is not updated, the data life_counter will not be reset in step 110, but be incremented in step 112. With progressive incrementing of the data life_counter, the data life_counter will become larger than the data life_threshold, and from step 114 to step 118, the data life_counter will be zeroed and the max-mean data max_mean will be updated. Alternately, in the present invention, the data life_counter could be implemented by decrementing until it reaches zero. That is, when resetting the data life_counter in step 110, the data life_counter is set to equal the data life_threshold; in step 112, the data life_counter is decremented by 1; in step 108, the decision is made according to whether the data life_counter is decreased to a value smaller than 0. No matter which method is chosen, the data life_counter and the constant data life_threshold are designed to limit the number of times that the max-mean data max_mean is not updated.
In order to further describe how to track volume with the max-mean data max_mean in
In the example of
After finishing the audio data S(n1), the process 100 proceeds to the next audio data S(n1+1) for setting the corresponding max-mean data max_mean(n1+1), and so on. In
If the data life_counter increases to a value greater than the constant data life_threshold when dealing with the audio data S(n3), the process 100 proceeds to step 110 (in
In short, the max-mean data max_mean of the present invention increases as the mean-volume data mean increases. When the mean-volume data is descending, the max-mean data max_mean stays at its local peak level for a default duration. During the duration, if the mean-volume data mean is smaller than the max-mean data max_mean, the present invention forces an update of the max-mean data max_mean, so as to track the mean-volume data. Moreover, the default duration is determined by whether the data life_counter is larger than the data life_threshold. Basically, the max-mean data max_mean is to track the maximum volume of the audio signal S, but the local maximum is much better for representing volume changes of different parts of the audio signal S. Furthermore, the data life_counter is used to make the max-mean data max_mean more representative of the local maximum volume, instead of the global maximum volume. Take
From
In addition, the present invention can use causal or non-causal systems for calculating the mean-volume data mean. In a real-time and causal system, the audio signal S provides each audio data according to time sequence. In other words, when applying the process 100 to an audio signal S(n), the control circuit 10 receives audio signals only before the audio signal S(n), such as the audio data S(n−1), S(n−2), etc. In this situation, the present invention calculates the mean-volume data according to the audio data before the audio data S(n). For example, as long as L1 is a positive number and L2 equals 1, the mean-volume data mean(n) corresponding to the audio data S(n) is calculated with a mean of absolute values of the audio data S(n−L1), S(n−L1+1), S(n−L1+2), to S(n). Because these audio data are before the audio data S(n), the control circuit 10 should have received these audio data when calculating the mean-volume data mean(n).
Conversely, in a non-real-time and non-causal system, before playing an audio data, the audio signal S can provide audio data after the audio data. For example, in some specifications of media data compression (such as MPEG, motion picture experts group), the decompression process of the audio signal S is non-causal. That is, before playing an audio data S(n), later audio data, such as audio data S(n+1), S(n+2), etc. have to be decompressed. In this situation, the present invention can also use audio data after the audio data S(n) for calculating the corresponding mean-volume data mean(n). For instance, as long as L1 and L2 are positive (and L2 is larger than 1), the mean-volume data mean(n) corresponding to the audio data S(n) is calculated with a mean of absolute values of the audio data S(n−L1), S(n−L1+1), S(n−L1+2), to S(n), or even to S(n+1), S(n+2), to S(n+L2−1). Furthermore, the present invention can calculate the mean-volume data by means of a weighted averages method. That is, when calculating the mean-volume data corresponding to the audio data S(n), the absolute values of the audio data S(n−L1), S(n−L1+1), etc. are multiplied by different weighted values first, and a mean of the weighted absolute values is calculated for the corresponding mean-volume data mean(n).
As to how the present invention automatically controls volume by using the max-mean data max_mean, please refer to
After the sequence of high volume finishes, the present invention forces an update of the max-mean data max_mean by testing the data life_counter against life_threshold, so as to track the local maximum after time point t2. As shown in
There are three constant data for tracking/controlling volume: the data life_threshold, the threshold volume data max_volume_level, and the window range (or window, L1, and L2 shown in
As mentioned above, in the process 100, step 114, 116, and 118 can be seen as a volume adjustment process. Excepting that the volume of the audio data S(n) is decreased when the max-mean data max_mean is larger than the threshold volume data max_volume_level, the present invention can adjust volume automatically by other methods, such as an automatic volume adjustment for very low volume. Please refer to
Step 214: determining the range of the max-mean data max_mean. After steps 102 to 112, the process 200 has generated the max-mean data max_mean corresponding to the audio data S(n), so in this step, the range of the max-mean data max_mean can be determined. In addition, other than the maximum volume data max_volume_level, the process 200 can set another constant low threshold volume data min_volume_level, which is smaller than the threshold volume data max_volume_level, so the threshold volume data max_volume_level can be seen as a high threshold volume data. If the max-mean data max_mean is larger than the high threshold volume data max_volume_level, the process 200 proceeds to step 218. If the max-mean data max_mean is smaller than the low threshold volume data min_volume_level, the process 200 proceeds to step 220. If the max-mean data max_mean is between the high threshold volume data max_volume_level and the low threshold volume data min_volume_level, the process 200 proceeds to step 220.
Step 216: maintaining the volume of the audio data S(n).
Step 218: decreasing volume of the audio data S(n). As with step 118 of the process 100, in step 218, a volume adjustment scalar (such as max_volume_level/max-mean) smaller than 1 is calculated, and the audio data S(n) is multiplied by the scalar, so as to decrease the volume of the audio data S(n).
Step 220: increasing volume of the audio data S(n) if the max-mean data max_mean is smaller than the low threshold volume data min_volume_level. In step 220, a volume adjustment scalar (such as max_volume_level/max-mean) larger than 1 is calculated, and the audio data S(n) is multiplied by the scalar, so as to increase the volume of the audio data S(n).
Please refer to
In other words, because the max-mean data max_mean can track the local maximum of volume efficiently when performing the volume-tracking process, the present invention can not only increase volume when volume is low, but also decrease volume when volume is high as shown in the process 200. With the process 200, the control circuit 10 in
In summary, in contrast to the prior art, the present invention can track the local maximum volume of the audio signal automatically, so as to control volume of the audio signal during playing, decreasing the discomfort of high-volume sequences. As mentioned above, in a TV program, commercial spots are often played with louder volume, so the present invention can also detect commercial spots through volume tracking. In the embodiment of
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
093121163 | Jul 2004 | TW | national |