Debian Codegraph @

opcodes/compress2.xml

raw symbols SCIP
1
2 <refentry id="compress2">
3 <indexterm id="IndexCompress2"><primary>compress2</primary></indexterm>
4 <refentryinfo><title>Signal Modifiers:Amplitude Modifiers</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>compress2</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>compress2</refname>
11 <refpurpose>
12 Compress, limit, expand, duck or gate an audio signal.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para> This unit functions as an audio
19 compressor, limiter, expander, or noise gate, using either
20 soft-knee or hard-knee mapping, and with dynamically variable
21 performance characteristics. It takes two audio input signals,
22 <emphasis>aasig</emphasis> and <emphasis>acsig</emphasis>, the first of which is modified by a running
23 analysis of the second. Both signals can be the same, or the first
24 can be modified by a different controlling signal.
25 </para>
26 <para>
27 <command>compress2</command> first examines the controlling <emphasis>acsig</emphasis>
28 by performing envelope detection. This is directed by two control
29 values <emphasis>katt</emphasis> and <emphasis>krel</emphasis>, defining the attack and release time
30 constants (in seconds) of the detector. The detector rides the
31 peaks (not the RMS) of the control signal. Typical values are .01
32 and .1, the latter usually being similar to <emphasis>ilook</emphasis>.
33 </para>
34 <para>
35 The running envelope is next converted to decibels, then passed
36 through a mapping function to determine what compresser action (if
37 any) should be taken. The mapping function is defined by four decibel
38 control values. These are given as negative values, where 0 db
39 corresponds to an amplitude of 0dbfs.
40 </para>
41 </refsect1>
42
43 <refsect1>
44 <title>Syntax</title>
45 <synopsis>ar <command>compress2</command> aasig, acsig, kthresh, kloknee, khiknee, kratio, katt, krel, ilook</synopsis>
46 </refsect1>
47
48 <refsect1>
49 <title>Initialization</title>
50 <para>
51
52 <emphasis>ilook</emphasis> -- lookahead time in seconds, by which an
53 internal envelope release can sense what is coming. This induces
54 a delay between input and output, but a small amount of lookahead
55 improves the performance of the envelope detector. Typical value
56 is .05 seconds, sufficient to sense the peaks of the lowest
57 frequency in <emphasis>acsig</emphasis>.
58
59 </para>
60 </refsect1>
61
62 <refsect1>
63 <title>Performance</title>
64 <para>
65 <emphasis>kthresh</emphasis> -- sets the lowest decibel level that will be allowed through. Normally -90 or less, but if higher the threshold will begin removing low-level signal energy such as background noise.
66 </para>
67 <para>
68 <emphasis>kloknee</emphasis>, <emphasis>khiknee</emphasis> -- decibel break-points denoting where compression or expansion will begin. These set the boundaries of a soft-knee curve joining the low-amplitude 1:1 line and the higher-amplitude compression ratio line. Typical values are -52 and -30 db. If the two breakpoints are equal, a hard-knee (angled) map will result.
69 </para>
70 <para>
71 <emphasis>kratio</emphasis> -- ratio of compression when the signal level is above the knee. The value 2 will advance the output just one decibel for every input gain of two; 3 will advance just one in three; 20 just one in twenty, etc. Inverse ratios will cause signal expansion: .5 gives two for one, .25 four for one, etc. The value 1 will result in no change.
72 </para>
73 <para>
74 The actions of compress2 will depend on the parameter settings given. A hard-knee compressor-limiter, for instance, is obtained from a near-zero attack time, equal-value break-points, and a very high ratio (say 100). A noise-gate plus expander is obtained from some positive threshold, and a fractional ratio above the knee. A voice-activated music compressor (ducker) will result from feeding the music into <emphasis>aasig</emphasis> and the speech into <emphasis>acsig</emphasis>. A voice de-esser will result from feeding the voice into both, with the <emphasis>acsig</emphasis> version being preceded by a band-pass filter that emphasizes the sibilants. Each application will require some experimentation to find the best parameter settings; these have been made k-variable to make this practical.
75 </para>
76
77 </refsect1>
78
79 <refsect1>
80 <title>Examples</title>
81 <para>
82 Here is an example of the compress2 opcode. It uses the file <ulink url="examples/compress2.csd"><citetitle>compress2.csd</citetitle></ulink>.
83
84 <example>
85 <title>Example of the compress2 opcode.</title>
86
87
88
89 <xi:include href="examples-xml/compress2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
90 </example>
91 </para>
92 </refsect1>
93
94 <refsect1>
95 <title>See also</title>
96 <para><link linkend="SigProcAmpMod"><citetitle>Amplitude Modifiers and Dynamic processing</citetitle></link></para>
97 </refsect1>
98
99 <refsect1>
100 <title>Credits</title>
101 <para>Written by &namejohn; after &namebarry; from Extended but
102 with more common dB values, new in version 6.07.
103 </para>
104 </refsect1>
105 </refentry>