音频直流偏置

957 阅读2分钟

不对称波形

image.png

image.png

“不对称波形”(Asymmetrical Waveform) 常常可以在人声、铜管等乐器的录音中见到。平时见到的音乐文件的波形,一般都是对称的。

导致波形不对称的原因有两种,一种是直流偏移,一种是谐波之间的相位关系

直流偏移

要了解不对称的波形,首先要提一个叫做 “直流偏移”(DC Offset) 的概念。信号的直流分量指的是信号的平均值。

想一想,一个过原点的正弦波,正负两个半周是对称的,它的平均值为0,也就是说它不存在直流分量。

平时我们见到的音频信号应该是要不带有直流分量的,因为我们的耳朵只对震动敏感,而若振膜一直维持在某个固定的位置(直流信号),就不会引起气压的变化,没有震动产生,也就没办法被我们听到。所以这部分信号是没有意义的。 信号中的直流部分,就称为直流偏移。它不会给听觉带来任何效果,反倒是会带来不少麻烦。

比如,如果一个信号带有直流分量,它就会呈现出“不对称”的特性。波形的一个半周已经接近0dB了,而另一个半周却还有大量的空间。这就会减少我们处理音频时可以使用的动态范围。另外,直流信号长期作用在耳机、音箱和其他设备上面,还可能给它们带来损害。

对于直流偏移的信号,我们只要把它整体减去它的偏移量,就可以解决。

使用sox解决直流偏移

sox dc.wav fixed.wav highpass 10
   dcshift shift [limitergain]
          Apply  a  DC shift to the audio.  This can be useful to
          remove a DC offset (caused perhaps by a hardware  prob-
          lem in the recording chain) from the audio.  The effect
          of a DC offset is reduced headroom  and  hence  volume.
          The  stat or stats effect can be used to determine if a
          signal has a DC offset.

          The given dcshift value is a floating point  number  in
          the range of +-2 that indicates the amount to shift the
          audio (which is in the range of +-1).

          An optional limitergain can be specified as  well.   It
          should  have  a  value  much  less than 1 (e.g. 0.05 or
          0.02) and is used only on peaks to prevent clipping.
                            *        *        *

          An alternative approach to removing a DC offset (albeit
          with  a  short  delay)  is  to  use the highpass filter
          effect at a frequency of say 10Hz,  as  illustrated  in
          the following example:

             sox -n dc.wav synth 5 sin %0 50
             sox dc.wav fixed.wav highpass 10