drc

Functions

int main(int argc, char *argv[])

drc [ option ] [ infile ]

  • -v double

    • absolute maximum value of input \((0 < V)\)

  • -s double

    • sampling rate [kHz] \((0 < F_s)\)

  • -t double

    • threshold [dB] \((T \le 0)\)

  • -r double

    • ratio \((1 \le R)\)

  • -w double

    • knee width [dB] \((0 \le W)\)

  • -A double

    • attack time [msec] \((0 < \tau_A)\)

  • -R double

    • release time [msec] \((0 < \tau_R)\)

  • -m double

    • make-up gain \((0 \le M)\)

  • infile str

    • double-type input data sequence

  • stdout

    • double-type compressed data sequence

The below example applies DRC to 16-bit speech waveform.

x2x +sd data.short | drc -v 32768 | x2x +ds -r | \
  sox -c 1 -t s16 -r 16000 - -t wav output.wav
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

class DynamicRangeCompression

Balances the range between the loudest and quietest signals.

The input is a signal \(x(t)\) in the \(T\)-length signals:

\[ \begin{array}{cccc} x(0), & x(1), & \ldots, & x(T-1), \end{array} \]
and the output is the processed corresponding signal \(y(t)\) in
\[ \begin{array}{cccc} y(0), & y(1), & \ldots, & y(T-1). \end{array} \]

[1] D. Giannoulis, M. Massberg, and J. D. Reiss, “Digital dynamic range compressor design - A tutorial and analysis,” Journal of the Audio Engineering Society, vol. 60, no. 6, pp. 399-408, 2012.

Public Types

enum DetectorType

Detector type.

Values:

enumerator kBranching
enumerator kDecoupled
enumerator kBranchingSmooth
enumerator kDecoupledSmooth

Public Functions

DynamicRangeCompression(double abs_max_value, double sampling_rate, double threshold, double ratio, double knee_width, double attack_time, double release_time, double makeup_gain, DetectorType detector_type = DetectorType::kDecoupled)
Parameters:
  • abs_max_value[in] Absolute maximum value.

  • sampling_rate[in] Sampling rate in Hz.

  • threshold[in] Threshold in dB.

  • ratio[in] Input/output ratio.

  • knee_width[in] Knee width in dB.

  • attack_time[in] Attack time in msec.

  • release_time[in] Release time in msec.

  • makeup_gain[in] Make-up gain to compensate output loudness.

  • detector_type[in] Detector type (optional).

inline double GetAbsMaxValue() const
Returns:

Absolute maximum value.

inline double GetSamplingRate() const
Returns:

Sampling rate.

inline double GetThreshold() const
Returns:

Threshold.

inline double GetRatio() const
Returns:

Ratio.

inline double GetKneeWidth() const
Returns:

Knee width.

inline double GetAttackTime() const
Returns:

Attack time.

inline double GetReleaseTime() const
Returns:

Release time.

inline double GetMakeupGain() const
Returns:

Makeup gain.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const double input, double *output, DynamicRangeCompression::Buffer *buffer) const
Parameters:
  • input[in] Input signal.

  • output[out] Output signal.

  • buffer[inout] Buffer.

Returns:

True on success, false on failure.

bool Run(double *input_and_output, DynamicRangeCompression::Buffer *buffer) const
Parameters:
  • input_and_output[inout] Input/output signal.

  • buffer[inout] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for DynamicRangeCompression class.