Maximal and minimal values represented by samples of a digital audio signal
are detected. A number of samples from a sample representing a minimal value to
a maximal-value-corresponding sample is detected. A number of samples from a sample
representing a maximal value to a minimal-value-corresponding sample is detected.
Calculation is given of a first difference between the maximal-value-corresponding
sample and the immediately-preceding sample. Calculation is given of a second difference
between the minimal-value-corresponding sample and the immediately-preceding sample.
First and second coefficients are calculated from the detected sample numbers.
The first coefficient and the first difference are multiplied to generate a first
multiplication result. The second coefficient and the second difference are multiplied
to generate a second multiplication result. The maximal value represented by the
maximal-value-corresponding sample is incremented by the first multiplication result.
The minimal value represented by the minimal-value-corresponding sample is decremented
by the second multiplication result.