Debian Codegraph @

opcodes/compress.xml

raw symbols SCIP
1
2 <refentry id="compress">
3 <indexterm id="IndexCompress"><primary>compress</primary></indexterm>
4 <refentryinfo><title>Signal Modifiers:Amplitude Modifiers</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>compress</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>compress</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>compress</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 positive values, where 0 db
39 corresponds to an amplitude of 0dbfs/32768, and 90 db corresponds to an
40 amplitude of 0dbfs.
41 </para>
42 </refsect1>
43
44 <refsect1>
45 <title>Syntax</title>
46 <synopsis>ar <command>compress</command> aasig, acsig, kthresh, kloknee, khiknee, kratio, katt, krel, ilook</synopsis>
47 </refsect1>
48
49 <refsect1>
50 <title>Initialization</title>
51 <para>
52
53 <emphasis>ilook</emphasis> -- lookahead time in seconds, by which an
54 internal envelope release can sense what is coming. This induces
55 a delay between input and output, but a small amount of lookahead
56 improves the performance of the envelope detector. Typical value
57 is .05 seconds, sufficient to sense the peaks of the lowest
58 frequency in <emphasis>acsig</emphasis>.
59
60 </para>
61 </refsect1>
62
63 <refsect1>
64 <title>Performance</title>
65 <para>
66 <emphasis>kthresh</emphasis> -- sets the lowest decibel level that will be allowed through. Normally 0 or less, but if higher the threshold will begin removing low-level signal energy such as background noise.
67 </para>
68 <para>
69 <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 48 and 60 db. If the two breakpoints are equal, a hard-knee (angled) map will result.
70 </para>
71 <para>
72 <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.
73 </para>
74 <para>
75 The actions of compress 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.
76 </para>
77
78 </refsect1>
79
80 <refsect1>
81 <title>Examples</title>
82 <para>
83 Here is an example of the compress opcode. It uses the file <ulink url="examples/compress.csd"><citetitle>compress.csd</citetitle></ulink>.
84
85 <example>
86 <title>Example of the compress opcode.</title>
87
88
89
90 <xi:include href="examples-xml/compress.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
91 </example>
92 </para>
93 </refsect1>
94
95 <refsect1>
96 <title>See also</title>
97 <para><link linkend="SigProcAmpMod"><citetitle>Amplitude Modifiers and Dynamic processing</citetitle></link></para>
98 </refsect1>
99
100 <refsect1>
101 <title>Credits</title>
102 <para>Written by &namebarry; for Extended Csound and released in
103 csound5.02.
104 </para>
105 </refsect1>
106 </refentry>