| 1 | |
| 2 | <refentry id="dam"> |
| 3 | <indexterm id="IndexDam"><primary>dam</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Amplitude Modifiers</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>dam</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>dam</refname> |
| 13 | <refpurpose> |
| 14 | A dynamic compressor/expander. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | This opcode dynamically modifies a gain value applied to the input sound <emphasis>ain</emphasis> by comparing its power level to a given threshold level. The signal will be compressed/expanded with different factors regarding that it is over or under the threshold. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ares <command>dam</command> asig, kthreshold, icomp1, icomp2, irtime, iftime</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>icomp1</emphasis> -- compression ratio for upper zone. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>icomp2</emphasis> -- compression ratio for lower zone |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>irtime</emphasis> -- gain rise time in seconds. Time over which the gain factor is allowed to raise of one unit. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>iftime</emphasis> -- gain fall time in seconds. Time over which the gain factor is allowed to decrease of one unit. |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Performance</title> |
| 51 | <para> |
| 52 | <emphasis>asig</emphasis> -- input signal to be modified |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>kthreshold</emphasis> -- level of input signal which acts as the threshold. Can be changed at k-time (e.g. for ducking) |
| 57 | </para> |
| 58 | |
| 59 | <para> |
| 60 | Note on the compression factors: A compression ratio of one leaves the sound unchanged. Setting the ratio to a value smaller than one will compress the signal (reduce its volume) while setting the ratio to a value greater than one will expand the signal (augment its volume). |
| 61 | </para> |
| 62 | </refsect1> |
| 63 | |
| 64 | <refsect1> |
| 65 | <title>Examples</title> |
| 66 | <para> |
| 67 | Because the results of the <emphasis>dam</emphasis> opcode can be subtle, I recommend looking at them in a graphical audio editor program like <emphasis>audacity</emphasis>. <emphasis>audacity</emphasis> is available for Linux, Windows, and the MacOS and may be downloaded from <ulink url="http://audacity.sourceforge.net/"><citetitle>http://audacity.sourceforge.net</citetitle></ulink>. |
| 68 | </para> |
| 69 | |
| 70 | <para> |
| 71 | Here is an example of the dam opcode. It uses the file <ulink url="examples/dam.csd"><citetitle>dam.csd</citetitle></ulink>, and <ulink url="examples/drumsMlp.wav"><citetitle>drumsMlp.wav</citetitle></ulink>. |
| 72 | <example> |
| 73 | <title>An example of the dam opcode compressing an audio signal.</title> |
| 74 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 75 | <xi:include href="examples-xml/dam.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 76 | </example> |
| 77 | |
| 78 | This example compresses the audio file <quote>drumsMlp.wav</quote>. You should hear a drum pattern repeat twice. The second time, the sound should be quieter (compressed) than the first. |
| 79 | </para> |
| 80 | |
| 81 | <para> |
| 82 | Here is another example of the dam opcode. It uses the file <ulink url="examples/dam_expanded.csd"><citetitle>dam_expanded.csd</citetitle></ulink>, and <ulink url="examples/drumsMlp.wav"><citetitle>drumsMlp.wav</citetitle></ulink>. |
| 83 | |
| 84 | <example> |
| 85 | <title>An example of the dam opcode expanding an audio signal.</title> |
| 86 | |
| 87 | <xi:include href="examples-xml/dam_expanded.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 88 | </example> |
| 89 | |
| 90 | This example expands the audio file <quote>drumsMlp.wav</quote>. You should hear a drum pattern repeat twice. The second time, the sound should be louder (expanded) than the first. To prevent distortion the volume of the signal has been lowered. |
| 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> |
| 102 | <simplelist> |
| 103 | <member>Author: Marc Resibois</member> |
| 104 | <member>Belgium</member> |
| 105 | <member>1997</member> |
| 106 | </simplelist> |
| 107 | </para> |
| 108 | <para>New in version 3.47</para> |
| 109 | </refsect1> |
| 110 | </refentry> |