Principles of Dynamic Range Control

DRC introduction

  Straight to the point, the definition of dynamic range is the logarithm (in dB) of the ratio of the maximum amplitude to the minimum amplitude of the signal,

  Dynamic range is affected by various aspects of the system. For example, if the same piece of music is played in an environment with 40dB background noise, then due to the masking effect and other factors, the dynamic range of the music actually heard is actually 50dB.

  Dynamic range is affected by various aspects of the system. For example, if the same piece of music is played in an environment with 40dB background noise, then due to the masking effect and other factors, the dynamic range of the music actually heard is actually 50dB. If you are interested in loudness and dynamic range, you can read the ingenious article " Detailed Explanation of Loudness and Dynamic Range in Audio". (Thrust, amp, loudness wars, high resolution, etc.)

  Dynamic Range Control (Dynamic Range Control, DRC) maps the dynamic range of the input audio signal to a specified dynamic range, which can make the sound softer or louder, that is, a signal amplitude adjustment method. Usually the dynamic range after mapping is smaller than the dynamic range before mapping, so it is called dynamic range compression. The audio signal can be controlled for the overall dynamic range, or can be divided into several sub-bands for dynamic range control respectively. DRC is widely used in the field of audio signal processing, such as the most common wide dynamic range compression method (Wide Dynamic Range Compression, WDRC ) in hearing aids, the most commonly used automatic gain control (Automatic Gain Control, AGC ) method in audio signal processing, etc. DRC focuses on selectively and purposefully adjusting the gain from the digital domain to ensure that the largest signal has a suitable headroom, the intermediate signal is properly amplified, and the small signal or background noise is cut off.

effect

  • Match audio signal levels to their environment
  • Dynamically stretch the input voice, which is loud and small, so that the voice sounds stable.
  • Suppress low-level noise to prevent noise from being amplified in the subsequent module AGC.
  • Protect AD Converter from Overload
  • Optimizing information; that is, making the audio signal use the full dynamic range;

Types of Dynamic Range Control

  • Dynamic range compressor : Attenuates the volume of sounds above a given threshold; often used in recording systems to protect hardware and increase overall loudness.
  • Dynamic range limiter (Dynamic range limiter): is a type of compressor that can limit signals that exceed a given threshold;
  • Dynamic range expander : Attenuates the volume of quiet sounds below a given threshold. They are often used to make quiet sounds quieter.
  • Noise gate : A type of expander that limits sound below a given threshold

The gain adjustment of DRC basically has three stages: three stages of different processing for background noise, medium-amplitude signal, and large-amplitude signal, such as:

  • Bottom noise: Cutoff, attenuation
  • Medium-amplitude signals: Expander
  • Larger range to prevent top clipping: Limiter

  On the whole, the algorithm is relatively simple, and the most critical part is the design of the curve. The curve of DRC generally has a structure like the figure below, which shows the curve for filtering small signals. If you want the function of dynamic stretching, the overall curve needs to be higher than the straight line $y=x$.

Static curve (picture from Chapter 7 of "Digital Audio Signal Processing-Udo Zölzer")

Glossary

  • NT: Noise Gate (Noise Gate), input signals lower than NT will be filtered out
  • LT: Limiter threshold, signals above CT and below LT will also be compressed, and signals above LT will be directly limited
  • CT: Compressor threshold, signals above ET and below CT will remain unchanged
  • ET: Expander threshold, signals above NT and below ET will be suppressed

MALTAB的Audio Toolbox中实现了 动态范围压缩器动态范围限幅器动态范围扩展器噪声门。本教程还提供了动态范围限制器各个阶段的动态范围限制示例。

基本原理

  DRC的原理其实很简单,就是通过设计一条曲线,将输入语音幅度$x(n)$通过曲线进行映射得到另一语音幅度值$y(n)$。然后计算两者之间的差值得到增益值$g_c(n)$,然后根据设置的attack time和release time进行增益平滑以及计算make-up增益,最后再应用到语音得到处理后的语音。基本流程如下

通用的动态范围控制系统 (来自Matlab官网)

1、线性到dB转换

从线性值转换为dB值

$$x_{dB}(n) = 20log_{10}(x(n))$$

2、计算增益

通过将$x_{dB}(n) $信号传递到静态特征方程(DRC静态曲线),假设设计的曲线函数关系为$f(x)$

$$x_{sc}(x_{db})=f(x_{db}(n))$$

计算差值:$g_c(n)=x_{sc}(n)-x_{dB}(n)$

不同类型的DRC都具有不同的静态特征和不同的可调属性:

  • Threshold:所有的静态特性都有一个阈值。在阈值的一侧,信号不变。在阈值的另一侧,应用compression, expansion, limiting, 或 gating。
  • Ratio:Expanders  和 compressors 使您能够将静态特性的输入输出比调整为高于或低于给定阈值。
  • KneeWidth:expander、compressors和 limiters 使您能够调整静态特性的拐点宽度。静态特性的拐点以阈值为中心。knee width的增加会在阈值周围产生更平滑的过渡。knee width为零不提供平滑,称为硬拐点(hard knee)。knee width大于零被称为软拐点(soft knee)。

在下面这些静态特性图中,expander、limiter和compressor 各有一个 knee width 的拐点宽度。

3、增益平滑

  增益平滑减少了增益的急剧变化,避免伪像和不自然的声音。expander和noiseGate具有相同的平滑方程(都是扩展器),limiter和compressor具有相同的平滑方程(都是压缩器)。

  增益平滑的类型由启动时间(attack time)、释放时间(release time)和保持时间(hold time)组合指定。启动时间和释放时间对应于增益信号从其最终值的10%上升到90%所需的时间。保持时间是应用增益之前的延迟时间。

expander 和 noiseGate 的平滑方程

$$g_s[n]=\left\{\begin{array}{cl}
\alpha_A g_s[n-1]+\left(1-\alpha_A\right) g_c[n] & \text { if }\left(C_A>k\right) \&\left(g_c[n] \leq g_s[n-1]\right) \\
g_S[n-1] & \text { if } C_A \leq k \\
\alpha_{R}g_s[n-1]+\left(1-\alpha_R\right) g_c[n] & \text { if }\left(C_R>k\right) \&\left(g_c[n]>g_s[n-1]\right) \\
g_S[n-1] & \text { if } C_R \leq k
\end{array}\right.$$

$\alpha_A$和$\alpha_R$由采样率和指定的启动和释放时间确认:$\alpha_A=exp(\frac{-log(9)}{Fs*T_A})$,$\alpha_R=exp(\frac{-log(9)}{Fs*T_R})$

$k$是以样本为单位的指定保持时间。$C_A$和$C_R$分别是启动和释放hold counters

compressor 和 limiter 的平滑方程

$$g_s(n)=\left\{\begin{matrix}
a_Ag_s(n-1)+(1-\alpha_A)g_c(n),\ \ g_c\le g_s(n-1) \\
a_Rg_s(n-1)+(1-\alpha_R)g_c(n),\ \ g_c > g_s(n-1)
\end{matrix}\right.$$

$\alpha_A$和$\alpha_R$由采样率和指定的启动和释放时间确认:$\alpha_A=exp(\frac{-log(9)}{Fs*T_A})$,$\alpha_R=exp(\frac{-log(9)}{Fs*T_R})$

增益平滑实例

输入信号两步动态范围压缩的一个简单案例。在此示例中,压缩器的阈值为 –10 dB,压缩比为 5,拐点较硬。

下图为了显示了增益平滑的几种变化。

  • 在顶部,显示了针对不同启动时间值的平滑增益曲线,释放时间设置为零秒
  • 在中间,释放时间是变化的,启动时间保持在零秒不变
  • 在底部,启动和释放时间均由非零值指定

4、补偿增益(make-up gain)

  补偿增益适用于compressors 和 limiters,其中信号的较高 dB 部分被衰减或阻塞。dB 降低会显著降低总信号功率。在这些情况下,增益平滑后应用补偿增益以增加信号功率。在MATLAB的 Audio Toolbox 中,可以指定一个设定的补偿量或将补偿模式指定为'auto'。

'auto'补偿增益确保 0 dB 输入产生 0 dB 输出。例如,假设具有软拐点的compressors 的静态特性:

$$x_{s c}\left(x_{d B}\right)=\left\{\begin{array}{cc}
x_{d B} & x_{d B}<\left(T-\frac{W}{2}\right) \\
x_{d B}+\frac{\left(\frac{1}{R}-1\right)\left(x_{d B}-T+\frac{W}{2}\right)^2}{2 W} & \left(T-\frac{W}{2}\right) \leq x_{d B} \leq\left(T+\frac{W}{2}\right) \\
T+\frac{\left(x_{d B}-T\right)}{R} & x_{d B}>\left(T+\frac{W}{2}\right)
\end{array}\right.$$

$T$是threshold,$W$是knee width,$R$是compression ratio。计算出的自动补偿增益是在 0 dB 时评估的静态特性方程的负值:

$$\text { MAKE-UP GAIN }=-x_{s c}(0)=\left\{\begin{array}{cl}
0 & \frac{W}{2}<T \\
-\frac{\left(\frac{1}{R}-1\right)\left(T-\frac{W}{2}\right)^2}{2 W} & -\frac{W}{2} \leq T \leq \frac{W}{2} \\
-T+\frac{T}{R} & -\frac{W}{2}>T
\end{array}\right.$$

5、dB到线性转换

将增益从dB域变换到线性域:$g_{lin}(n)=10^{\frac{g_m(n)}{20}}$

6、应用增益

$$y(n)=x(n)*g_{lin}(n)$$

栗子

示例:动态范围限制器

本例中描述的音频信号是 0.5 秒间隔的鼓音。limiter属性是:

  • Threshold  = –15 dB
  • Knee width = 0(硬膝盖)
  • Attack time = 0.004 秒
  • Release time = 0.1 秒
  • Make-up gain = 1 dB

此示例提供了动态范围限制器系统各个阶段的可视化演练。

线性到 dB 转换

增益计算

静态特性将 dB 信号限制在 –15 dB。为了确定导致此限制的 dB 增益,增益计算从静态特性处理的 dB 信号中减去原始 dB 信号。

增益平滑

当所应用的增益突然增加时,相对较短的启动时间规格会导致陡峭的曲线。相对较长的释放时间会导致应用增益逐渐减小。

补偿增益

假设限制器具有 1 dB 补偿增益值。补偿增益被添加到平滑增益信号。

dB 到线性转换

以 dB 为单位的增益逐个元素转换为线性标度。

应用计算增益

原始信号乘以线性增益

参考

【书籍】Digital Audio Signal Processing 2nd Edition

【音频探险记】DRC--动态范围控制

【MATLAB】Dynamic Range Control

【MATLAB】Multiband Dynamic Range Compression

【知乎】详解音频中的响度与动态范围。(推力、耳放、响度战争、高解析度等)

【论文】Zolzer, Udo. "Dynamic Range Control." Digital Audio Signal Processing. 2nd ed. Chichester, UK: Wiley, 2008.

【论文】Giannoulis, Dimitrios, Michael Massberg, and Joshua D. Reiss. "Digital Dynamic Range Compressor Design –– A Tutorial And Analysis." Journal of Audio Engineering Society. Vol. 60, Issue 6, 2012, pp. 399–408.

Guess you like

Origin blog.csdn.net/qq_34218078/article/details/128653267