# Patent

## Title
Signal level adjusting apparatus, gain value updating method, and program

## Abstract

A signal level adjusting apparatus comprises an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal; a gain calculator that obtains a second gain value according to a signal level of the input signal; and a gain updater that updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to an error between the first gain value and the second gain value.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to a signal level adjusting apparatus, a gain value updating method, and a program.
2. Description of the Related Art
In the playback process for music, it is usual that the input signal is amplified with a gain of a gain value according to the level of the signal and the amplified signal is outputted. For example, in MP3 (MPEG Audio Layer-3) players, when consecutively playing back MP3 files of different audio recording levels, dynamic range control, auto-gain control, and the like are performed in order that sound volume does not change much when switching the files. See, for example, Japanese Patent Application Laid-Open Publication No. 2003-46353.
As such, in a signal level adjusting apparatus that adjusts a signal level and outputs a signal, the gain value is updated according to the signal level of the input signal, but if the gain value is rapidly changed, playback sound volume will rapidly change or noise will occur. Hence, the gain value is updated such that the gain value approaches a target gain value stepwise.
FIG. 11 is a flow chart illustrating an example of a conventional procedure with which the gain value is updated by steps corresponding to a predetermined value. First, the signal level of the input signal (xi) is detected (S1101). Then, a gain value gt corresponding to the signal level is obtained (S1102). Note that the function f is a predefined function for obtaining the signal level of an output signal from the signal level of the input signal.
Then, if a current gain value ga is greater than the target gain value gt (S1103: YES), by multiplying the ga by a predetermined value α− (α−<1) or subtracting α− from ga, the ga is decreased by steps corresponding to α− (S1104). On the other hand, if a current gain value ga is smaller than the target gain value gt (S1105: YES), by multiplying the ga by a predetermined value α+ (α+>1) or adding α+ to ga, the ga is increased by steps corresponding to α+ (S1106). Then, the input signal is amplified with a gain of the updated value ga and outputted (S1107).
By updating the gain value ga by steps corresponding to predetermined values (α+, α−) as above, the gain value ga approaches the target gain value gt.
Here, because the ga is increased or decreased by a step corresponding to the predetermined value, by increasing the step size, the speed at which the ga converges on the gt can be increased. As shown in FIG. 12, however, if the step size is large, the ga oscillates without converging on the gt when the difference between the ga and the gt becomes small. If the gain value ga oscillates, the problem occurs that output sound oscillates or vibrates. On the other hand, by decreasing the step size, the ga can be prevented from oscillating, but the speed at which the ga converges on the gt becomes slow, and it takes a long time before starting to adjust the signal level with a gain of the gain value according to the signal level of the input signal.
SUMMARY OF THE INVENTION
The present invention was made in view of the above problem, and an object thereof is to provide a signal level adjusting apparatus that updates the gain value stepwise such that the gain value approaches a target gain value at high speed without oscillating.
To achieve the above object, a signal level adjusting apparatus of the present invention comprises an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal; a gain calculator that obtains a second gain value according to a signal level of the input signal; and a gain updater that updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to an error between the first gain value and the second gain value.
Furthermore, a signal level adjusting apparatus of the present invention comprises an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal; a gain calculator that obtains a second gain value according to a signal level of the input signal; and a gain updater that, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and, when the error is less than the threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.
Yet further, a signal level adjusting apparatus of the present invention comprises an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal; a gain calculator that obtains a second gain value according to a signal level of the input signal; and a gain updater that, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and to the error and, when the error is less than the threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.
The gain updater may obtain the threshold value based on the second gain value.
Also, the gain updater may obtain the steps corresponding to the error by using a least-squares method so that the error approaches a zero.
The apparatus can update the gain value stepwise such that the gain value approaches a target gain value at high speed without oscillating.
Features and objects of the present invention other than the above will become clear by reading the description of the present specification with reference to the accompanying drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
For a more complete understanding of the present invention and the advantages thereof, reference is now made to the following description taken in conjunction with the accompanying drawings wherein:
FIG. 1 is a block diagram of a signal level adjusting apparatus according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an example of a relationship between the signal levels of an input signal and of an output signal;
FIG. 3 is a flow chart illustrating an example of the process of updating a gain value ga by steps according to an error between the gain value ga and a gain value gt;
FIG. 4 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 3;
FIG. 5 is a flow chart illustrating an example of the process of updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt or to a predetermined value;
FIG. 6 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 5;
FIG. 7 is a flow chart illustrating another example of the process of updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt and to a predetermined value;
FIG. 8 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 7;
FIG. 9 is a graph showing results of simulating the transition of the error between the gain value ga and the gain value gt according to the methods of updating the gain value when the input signal is a sine wave;
FIG. 10 is a graph showing results of simulating the transition of the error between the gain value ga and the gain value gt according to the methods of updating the gain value when the input signal is random noise;
FIG. 11 is a flow chart illustrating an example of a conventional procedure with which the gain value is updated by steps corresponding to a predetermined value; and
FIG. 12 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 11.



DETAILED DESCRIPTION OF THE INVENTION
At least the following matters will be made clear by the explanation in the present specification and the description of the accompanying drawings.
=Configuration of a Signal Level Adjusting Apparatus=
FIG. 1 is a block diagram of a signal level adjusting apparatus according to an embodiment of the present invention. A signal level adjusting apparatus 1 is an apparatus that changes the signal level of a digital signal inputted and outputs the level-changed signal, and comprises an amplifier 11, a gain calculator 12, and a gain updater 13. Note that each section 11 to 13 can be implemented by, for example, a processor such as DSP (Digital Signal Processor) executing a program stored in a ROM (Read Only Memory).
The amplifier 11 amplifies the signal level of the input signal to the gain value ga (a first gain value) times that level and outputs an amplified signal. The gain calculator 12 calculates the gain value gt (a second gain value) corresponding to the signal level of the input signal. The gain updater 13 updates the gain value ga stepwise such that the gain value ga approaches a target gain value gt.
FIG. 2 is a diagram illustrating an example of a relationship between the signal levels of the input signal and of the output signal. Here, the function f is a predefined function representing the relationship between the signal levels of the input signal and of the output signal.
For example, when the signal level of the input signal is at 0.5, the signal level of the output signal f(0.5) equals 1.0. Hence, the gt=f(0.5)/0.5=2, and thus the signal level of the input signal is required to be amplified to twice that level in order to output the inputted signal adjusted in level according to the characteristic of the function f. Accordingly, the gain updater 13 updates the gain value ga of the amplifier 11 such that the gain value ga approaches the gain value gt.
=Process of Updating the Gain Value (Part 1)=
Next, a process of updating the gain value ga by the signal level adjusting apparatus 1 will be described in detail. FIG. 3 is a flow chart illustrating an example of the process of updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt.
First, the gain calculator 12 detects the signal level xi of the input signal (S301). Note that in the present invention the method of detecting the signal level xi can be any one of various methods such as calculating based on an average over a predetermined period of time. Then, the gain calculator 12 obtains the gain value gt according to the signal level xi of the input signal by using the equation (1) (S302):




  
    
      
        
          g
          t
        
        =
        
          
            f
            ⁡
            
              (
              
                x
                i
              
              )
            
          
          
            x
            i
          
        
      
    
    
      
        (
        1
        )
      
    
  




Next, the gain updater 13 updates the gain value ga such that the error between the gain value ga and the gain value gt approaches a zero (S303), by using a least-squares method expressed by the equation (2):




  
    
      
        
          g
          a
        
        =
        
          
            g
            a
          
          -
          
            2
            ⁢
            
              μ
              ⁡
              
                (
                
                  
                    g
                    a
                  
                  -
                  
                    g
                    t
                  
                
                )
              
            
            ⁢
            
              
                ∑
                
                  k
                  =
                  1
                
                n
              
              ⁢
              
                x
                ik
                2
              
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




Here, μ is a parameter for determining the step by which to update the ga; n is the number of channels; and xik is the signal level of the k'th channel, which in the case of, for example, a two channel stereo signal, includes xi1 (e.g., a left side signal) and xi2 (e.g., a right side signal). Note that the xi in the equation (1) may be any of the xik, or a value obtained based on a plurality of xik.
Then, the amplifier 11 amplifies the input signal with a gain of the updated gain value ga and outputs an amplified signal (S304).
As such, by updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt such that the gain value ga approaches the gain value gt, the error between the gain value ga and the gain value gt can be made to approach a zero.
FIG. 4 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 3. When updating the gain value ga by using the least-squares method, as shown in the equation (2), the step by which to update the gain value ga is large during the time that the error between the gain value ga and the gain value gt is large, and thereby the speed at which the gain value ga approaches the gain value gt becomes fast. Then, as the error becomes smaller, the step by which to update becomes smaller and thus the error between the gain value ga and the gain value gt converges on a zero. Therefore, by updating the gain value ga by using the least-squares method, the gain value ga can be made to approach the target gain value gt at high speed without oscillating.
=Process of Updating the Gain Value (Part 2)=
FIG. 5 is a flow chart illustrating an example of the process of updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt or to a predetermined value.
First, as in the process of FIG. 3, the gain calculator 12 detects the signal level of the input signal and obtains the gain value gt according to the signal level of the input signal (S501, S502).
Then, the gain updater 13 obtains a gain value gmax greater than the gain value gt, and a gain value gmin smaller than the gain value gt (S503). Note that in the present embodiment, the gmax is obtained by multiplying the gain value gt by a predetermined value αmax (>1) and the gmin is obtained by multiplying the gain value gt by a predetermined value αmin (<1), although the method of obtaining the gmax and gmin is not limited to this. For example, they may be obtained by adding and subtracting a predetermined value to and from the gain value gt, or by using a predetermined function of the gain value gt as a variable.
Subsequently, the gain updater 13 confirms whether the gain value ga is no greater than the gmax and no less than the gmin (S504).
If the gain value ga is greater than the gmax or less than the gmin (S504: NO), the gain updater 13 further confirms whether the gain value ga is greater than the gmax (S505). If the gain value ga is greater than the gmax (S505: YES), the gain updater 13 decreases the ga by a step corresponding to α− by multiplying the gain value ga by a predetermined value α− (α−<1) or subtracting α− from ga (S506). Also, the gain updater 13 confirms whether the gain value ga is less than the gmin (S507). If the gain value ga is less than the gmin (S507: YES), the gain updater 13 increases the ga by a step corresponding to α+ by multiplying the gain value ga by a predetermined value α+ (α+>1) or adding α+ to ga (S508).
If the gain value ga is less than the gmax and greater than the gmin (S504: YES), the gain updater 13 updates the gain value ga according to the previous equation (2) (S509).
Then, the amplifier 11 amplifies the input signal with a gain of the updated gain value ga and outputs an amplified signal (S510).
That is, when the error between the gain value ga and the gain value gt is greater than a threshold value (gmax−gt, or gt−gmin), the gain value ga is updated stepwise so as to approach the gain value gt by steps corresponding to the predetermined values (α+, α−), and when the error between the gain value ga and the gain value gt is less than the threshold value, the gain value ga is updated stepwise so as to approach the gain value gt by steps corresponding to the error, by using the least-squares method.
FIG. 6 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 5. As shown in the Figure, the gain value ga is updated so as to approach the gt by steps corresponding to the predetermined values during the time that the gain value ga is outside the range of from gmax to gmin. In contrast, during the time that the gain value ga is within the range of from gmax to gmin, the gain value ga is updated so as to approach the gain value gt by steps corresponding to the error, by using the least-squares method.
Therefore, when the gain value ga is outside the range of from gmax to gmin, the speed for until the error between the gain value ga and the gain value gt becomes small to a certain degree can be made faster by setting the steps corresponding to the predetermined values to be large. Thereafter, the gain value ga is updated by using the least-squares method, and hence can be made to approach the gain value gt without oscillating.
=Process of Updating the Gain Value (Part 3)=
FIG. 7 is a flow chart illustrating another example of the process of updating the gain value ga by steps corresponding to the error between the gain value ga and the gain value gt and to a predetermined value.
First, as in the process of FIG. 3, the gain calculator 12 detects the signal level of the input signal and obtains the gain value gt according to the signal level of the input signal (S701, S702).
Then, the gain updater 13 obtains a gain value gmax and a gain value gmin as in the process of FIG. 5 (S703). Subsequently, the gain updater 13 confirms whether the gain value ga is greater than the gmax (S704). If the gain value ga is greater than the gmax (S704: YES), the gain updater 13 decreases the ga by a step corresponding to α− by multiplying the gain value ga by a predetermined value α− (α−<1) or subtracting α− from ga (S705). Also, the gain updater 13 confirms whether the gain value ga is less than the gmin (S706). If the gain value ga is less than the gmin (S706: YES), the gain updater 13 increases the ga by a step corresponding to α+ by multiplying the gain value ga by a predetermined value α+ (α+>1) or adding α+ to ga (S707).
Further, the gain updater 13 updates the gain value ga according to the previous equation (2) regardless of the gain value ga (S708).
Then, the amplifier 11 amplifies the input signal with a gain of the updated gain value ga and outputs an amplified signal (S709).
That is, when the error between the gain value ga and the gain value gt is greater than a threshold value (gmax−gt, or gt−gmin), the gain value ga is updated stepwise so as to approach the gain value gt by steps corresponding to the predetermined values (α+, α−), and the updated gain value ga is updated stepwise so as to approach the gain value gt by steps corresponding to the error, by using the least-squares method. When the error between the gain value ga and the gain value gt is less than the threshold value, the gain value ga is updated stepwise so as to approach the gain value gt, by using only the least-squares method.
FIG. 8 is a graph showing an example of the transition of the gain value ga when the gain value ga is updated by the process of FIG. 7. As shown in the Figure, during the time that the gain value g, is outside the range of from gmax to gmin, the gain value ga is updated by steps corresponding to the predetermined values, and further the updated gain value ga is updated so as to approach the gain value gt by steps corresponding to the error, by using the least-squares method. In contrast, during the time that the gain value ga is within the range of from gmax to gmin, the gain value ga is updated so as to approach the gain value gt, by using only the least-squares method.
Therefore, when the gain value ga is outside the range of from gmax to gmin the gain value ga is updated by steps corresponding to the predetermined values and further by steps corresponding to the error so as to approach the gain value gt. Hence, the error can be decreased fast. After the error has become small, the gain value ga is updated by using only the least-squares method, and thus can be made to approach the target gain value gt without oscillating.
=Simulation Results=
FIGS. 9 and 10 are graphs showing results of simulating the transition of the error between the gain value ga and the gain value gt according to the methods of updating the gain value. A method 1 is a conventional method shown in FIG. 11, and methods 2, 3, 4 are the methods according to the present invention shown in FIGS. 3, 5, 7 respectively. The abscissa of the graph represents the number of samplings, that is, the passage of time and the ordinate represents the error E between the gain value ga and the gain value gt given by the equation (3):




  
    
      
        E
        =
        
          20.0
          ⨯
          
            
              log
              10
            
            ⁡
            
              (
              
                
                
                  
                    g
                    t
                  
                  -
                  
                    g
                    a
                  
                
                
              
              )
            
          
        
      
    
    
      
        (
        3
        )
      
    
  




It is assumed that updating the gain value ga by steps corresponding to the predetermined values (α+, α−) is performed by adding and subtracting the predetermined values to and from the gain value ga. Let α+=α−= 1/128 and μ of equation (2)= 1/16. Further, it is assumed that the input signal in FIG. 9 is a sine wave having a maximum signal level of 1 and that the input signal in FIG. 10 is random noise having a maximum signal level of 1.
And it is assumed that the threshold values for the methods 3, 4 are −20 dB. That is, in the method 3, if the error E is greater than −20 dB, the gain value ga is updated by steps corresponding to the predetermined values, and if the error E is less than −20 dB, the gain value ga is updated by steps corresponding to the error. In contrast, in the method 4, if the error E is greater than −20 dB, the gain value ga is updated by steps corresponding to the predetermined values and further by steps corresponding to the error. Note that in the graphs of FIGS. 9 and 10, the error E equals −100 dB when |gt−ga| is at zero.
As shown in FIGS. 9 and 10, with the conventional method 1, the error oscillates without converging on a zero. On the other hand, it can be seen that with the method 2, the error converges faster without oscillating than with the method 1. Also, it can be seen that with the method 3, the error converges on a zero without oscillating. Moreover, it can be seen that with the method 4, the error converges faster without oscillating than with the method 2. Note that in the method 3, by setting the predetermined values (α+, α−) greater than 1/128, the error can be made to converge faster than in FIGS. 9, 10.
The signal level adjusting apparatus 1 according to an embodiment of the present invention has been described above. As described above, the signal level adjusting apparatus 1 can update the gain value ga stepwise so as to approach the gt by steps corresponding to the error between the gain value ga and the gain value gt. By this means, the gain value ga can be made to approach the gain value gt without oscillating. Also in this case, when the error is large, the steps by which to update the gain value ga become large, and thus the convergence of the gain value ga can be speeded up.
Alternatively, when the error is greater than a predetermined threshold value, the signal level adjusting apparatus 1 can update the gain value ga stepwise so as to approach the gain value gt by steps corresponding to the predetermined values (α+, α−), and when the error becomes less than the predetermined threshold value, update the gain value ga by steps corresponding to the error. By this means, the gain value ga can be made to approach the gain value gt without oscillating. Also in this case, by increasing the steps corresponding to the predetermined values, the convergence of the gain value ga can be speeded up.
Alternatively, when the error is greater than a predetermined threshold value, the signal level adjusting apparatus 1 can update the gain value ga stepwise so as to approach the gain value gt by steps corresponding to the predetermined values (α+, α−) and further by steps corresponding to the error, and when the error becomes less than the predetermined threshold value, update the gain value ga by only steps corresponding to the error. By this means, the gain value ga can be made to approach the gain value gt without oscillating. Also in this case, when the error is greater than the predetermined threshold value, the gain value ga is updated by steps corresponding to the predetermined values and further by steps corresponding to the error, and thus the convergence of the gain value ga can be further speeded up.
The signal level adjusting apparatus 1 may determine the predetermined threshold values with which to compare the error from the gmax and gmin. That is, the predetermined threshold values can be obtained based on the gain value gt. Hence, the predetermined threshold values can be set appropriately according to the target gain value gt.
Furthermore, the signal level adjusting apparatus 1 can obtain steps corresponding to the error by using the least-squares method. By this means, the gain value ga can be updated such that the error approaches a zero.
Although the preferred embodiment of the present invention has been described, the above embodiment is provided to facilitate the understanding of the present invention and not intended to limit the present invention. It should be understood that various changes and alterations can be made therein without departing from spirit and scope of the invention and that the present invention includes its equivalents.
For example, although in the present embodiment the steps corresponding to the error are obtained by using the least-squares method, not being limited to this, the method of obtaining steps corresponding to the error may be to use a general adaptive filter including a recursive type.

## Claims

1. A signal level adjusting apparatus comprising:
an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal;
a gain calculator that obtains a second gain value according to a signal level of the input signal; and
a gain updater that updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to an error between the first gain value and the second gain value,
wherein the gain updater obtains the steps corresponding to the error by using a least-squares method so that the error approaches a zero.

2. A signal level adjusting apparatus comprising:
an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal;
a gain calculator that obtains a second gain value according to a signal level of the input signal; and
a gain updater that, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and, when the error is less than the threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

3. The signal level adjusting apparatus according to claim 2, wherein the gain updater obtains the steps corresponding to the error by using a least-squares method so that the error approaches a zero.

4. The signal level adjusting apparatus according to claim 2, wherein the gain updater obtains the threshold value based on the second gain value.

5. A signal level adjusting apparatus comprising:
an amplifier that amplifies an input signal with a gain of a first gain value and outputs an amplified signal;
a gain calculator that obtains a second gain value according to a signal level of the input signal; and
a gain updater that, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and to the error and, when the error is less than the threshold value, updates the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

6. The signal level adjusting apparatus according to claim 5, wherein the gain updater obtains the steps corresponding to the error by using a least-squares method so that the error approaches a zero.

7. The signal level adjusting apparatus according to claim 5, wherein the gain updater obtains the threshold value based on the second gain value.

8. A method of updating a first gain value for a signal level adjusting apparatus which amplifies an input signal with a gain of the first gain value and outputs an amplified signal, the method comprising:
obtaining a second gain value according to a signal level of the input signal; and
updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to an error between the first gain value and the second gain value,
wherein when updating the first gain value stepwise, the steps corresponding to the error are obtained by using a least-squares method so that the error approaches a zero.

9. A method of updating a first gain value for a signal level adjusting apparatus which amplifies an input signal with a gain of the first gain value and outputs an amplified, the method comprising:
obtaining a second gain value according to a signal level of the input signal; and
when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and, when the error is less than the threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

10. The method of updating a gain value according to claim 9, wherein when updating the first gain value stepwise, the steps corresponding to the error are obtained by using a least-squares method so that the error approaches a zero.

11. A method of updating a first gain value for a signal level adjusting apparatus which amplifies an input signal with a gain of the first gain value and outputs an amplified signal, the method comprising:
obtaining a second gain value according to a signal level of the input signal; and
when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and to the error and, when the error is less than the threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

12. The method of updating a gain value according to claim 11, wherein when updating the first gain value by the steps corresponding to the predetermined value and to the error and when updating the first gain value by the steps corresponding to the error, the steps corresponding to the error are obtained by using a least-squares method so that the error approaches a zero.

13. A computer-readable medium containing a computer software program that makes a signal level adjusting apparatus amplifying an input signal with a gain of the first gain value and outputting an amplified signal execute:
a procedure of obtaining a second gain value according to a signal level of the input signal; and
a procedure of updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to an error between the first gain value and the second gain value,
wherein the procedure of updating the first gain value stepwise includes obtaining the steps corresponding to the error by using a least-squares method so that the error approaches a zero.

14. A computer-readable medium containing a computer software program that makes a signal level adjusting apparatus amplifying an input signal with a gain of the first gain value and outputting an amplified signal execute:
a procedure of obtaining a second gain value according to a signal level of the input signal;
a procedure of, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value; and
a procedure of, when the error is less than the threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

15. The computer-readable medium containing a computer software program according to claim 14, wherein the procedure of updating the first gain value stepwise includes obtaining the steps corresponding to the error by using a least-squares method so that the error approaches a zero.

16. A computer-readable medium containing a computer software program that makes a signal level adjusting apparatus amplifying an input signal with a gain of the first gain value and outputting an amplified signal execute:
a procedure of obtaining a second gain value according to a signal level of the input signal;
a procedure of, when an error between the first gain value and the second gain value is greater than a predetermined threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to a predetermined value and to the error; and
a procedure of, when the error is less than the threshold value, updating the first gain value stepwise such that the first gain value approaches the second gain value by steps corresponding to the error.

17. The computer-readable medium containing a computer software program according to claim 16, wherein the procedure of updating the first gain value by the steps corresponding to the predetermined value and to the error and the procedure of updating the first gain value by the steps corresponding to the error each include obtaining the steps corresponding to the error by using a least-squares method so that the error approaches a zero.