| 1 | |
| 2 | <refentry id="deltapi"> |
| 3 | <indexterm id="IndexDeltapi"><primary>deltapi</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Delay</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>deltapi</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>deltapi</refname> |
| 11 | <refpurpose> |
| 12 | Taps a delay line at variable offset times, uses interpolation. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Taps a delay line at variable offset times, uses interpolation. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>deltapi</command> xdlt</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Performance</title> |
| 30 | <para> |
| 31 | <emphasis>xdlt</emphasis> -- specifies the tapped delay time in seconds. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal; the <emphasis>xdlt</emphasis> argument in <emphasis>deltapi</emphasis> implies that an audio-varying delay is permitted there. |
| 32 | </para> |
| 33 | |
| 34 | <para> |
| 35 | <emphasis>deltapi</emphasis> extracts sound by interpolated readout. By interpolating between adjacent stored samples <emphasis>deltapi</emphasis> represents a particular delay time with more accuracy, but it will take about twice as long to run. |
| 36 | </para> |
| 37 | |
| 38 | |
| 39 | <para> |
| 40 | This opcode can tap into a <link linkend="delayr"><citetitle>delayr</citetitle></link>/<link linkend="delayw"><citetitle>delayw</citetitle></link> pair, extracting delayed audio from the <emphasis>idlt</emphasis> seconds of stored sound. There can be any number of <link linkend="deltap"><citetitle>deltap</citetitle></link> and/or <emphasis>deltapi</emphasis> units between a read/write pair. Each receives an audio tap with no change of original amplitude. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | This opcode can provide multiple delay taps for arbitrary delay path and feedback networks. They can deliver either constant-time or time-varying taps, and are useful for building chorus effects, harmonizers, and Doppler shifts. Constant-time delay taps (and some slowly changing ones) do not need interpolated readout; they are well served by <emphasis>deltap</emphasis>. Medium-paced or fast varying dlt's, however, will need the extra services of <emphasis>deltapi</emphasis>. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>delayr</emphasis>/<emphasis>delayw</emphasis> pairs may be interleaved. To associate a delay tap unit with a specific <emphasis>delayr</emphasis> unit, it not only has to be located between that <emphasis>delayr</emphasis> and the appropriate <emphasis>delayw</emphasis> unit, but must also precede any following <emphasis>delayr</emphasis> units. See Example 2. (This feature added in Csound version 3.57 by Jens Groh and &namejohn;). |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>N.B.</emphasis> k-rate delay times are not internally interpolated, but rather lay down stepped time-shifts of audio samples; this will be found quite adequate for slowly changing tap times. For medium to fast-paced changes, however, one should provide a higher resolution audio-rate timeshift as input. |
| 53 | </para> |
| 54 | </refsect1> |
| 55 | |
| 56 | <refsect1> |
| 57 | <title>Examples</title> |
| 58 | <para> |
| 59 | <example> |
| 60 | <title>deltap example #1</title> |
| 61 | <programlisting> |
| 62 | asource <emphasis role="opc">buzz</emphasis> 1, 440, 20, 1 |
| 63 | atime <emphasis role="opc">linseg</emphasis> 1, p3<emphasis role="op">/</emphasis>2,.01, p3<emphasis role="op">/</emphasis>2,1 <emphasis role="comment">; trace a distance in secs</emphasis> |
| 64 | ampfac <emphasis role="op">=</emphasis> 1<emphasis role="op">/</emphasis>atime<emphasis role="op">/</emphasis>atime <emphasis role="comment">; and calc an amp factor</emphasis> |
| 65 | adump <emphasis role="opc">delayr</emphasis> 1 <emphasis role="comment">; set maximum distance</emphasis> |
| 66 | amove <emphasis role="opc">deltapi</emphasis> atime <emphasis role="comment">; move sound source past</emphasis> |
| 67 | <emphasis role="opc">delayw</emphasis> asource <emphasis role="comment">; the listener</emphasis> |
| 68 | <emphasis role="opc">out</emphasis> amove <emphasis role="op">*</emphasis> ampfac</programlisting> |
| 69 | </example> |
| 70 | </para> |
| 71 | |
| 72 | <para> |
| 73 | <example> |
| 74 | <title>deltap example #2</title> |
| 75 | <programlisting> |
| 76 | ainput1 <emphasis role="op">=</emphasis> ..... |
| 77 | ainput2 <emphasis role="op">=</emphasis> ..... |
| 78 | kdlyt1 <emphasis role="op">=</emphasis> ..... |
| 79 | kdlyt2 <emphasis role="op">=</emphasis> ..... |
| 80 | |
| 81 | <emphasis role="comment">;Read delayed signal, first delayr instance:</emphasis> |
| 82 | adump <emphasis role="opc">delayr</emphasis> 4.0 |
| 83 | adly1 <emphasis role="opc">deltap</emphasis> kdlyt1 <emphasis role="comment">; associated with first delayr instance</emphasis> |
| 84 | |
| 85 | <emphasis role="comment">;Read delayed signal, second delayr instance:</emphasis> |
| 86 | adump <emphasis role="opc">delayr</emphasis> 4.0 |
| 87 | adly2 <emphasis role="opc">deltap</emphasis> kdlyt2 <emphasis role="comment">; associated with second delayr instance</emphasis> |
| 88 | |
| 89 | <emphasis role="comment">;Do some cross-coupled manipulation:</emphasis> |
| 90 | afdbk1 <emphasis role="op">=</emphasis> 0.7 <emphasis role="op">*</emphasis> adly1 <emphasis role="op">+</emphasis> 0.7 <emphasis role="op">*</emphasis> adly2 <emphasis role="op">+</emphasis> ainput1 |
| 91 | afdbk2 <emphasis role="op">=</emphasis> -0.7 <emphasis role="op">*</emphasis> adly1 <emphasis role="op">+</emphasis> 0.7 <emphasis role="op">*</emphasis> adly2 <emphasis role="op">+</emphasis> ainput2 |
| 92 | |
| 93 | <emphasis role="comment">;Feed back signal, associated with first delayr instance:</emphasis> |
| 94 | <emphasis role="opc">delayw</emphasis> afdbk1 |
| 95 | |
| 96 | <emphasis role="comment">;Feed back signal, associated with second delayr instance:</emphasis> |
| 97 | <emphasis role="opc">delayw</emphasis> afdbk2 |
| 98 | <emphasis role="opc">outs</emphasis> adly1, adly2</programlisting> |
| 99 | </example> |
| 100 | </para> |
| 101 | |
| 102 | <para> |
| 103 | Here is yet another example of the deltapi opcode. It uses the file <ulink url="examples/deltapi.csd"><citetitle>deltapi.csd</citetitle></ulink>. |
| 104 | |
| 105 | <example> |
| 106 | <title>Example of the deltapi opcode.</title> |
| 107 | |
| 108 | <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> |
| 109 | <xi:include href="examples-xml/deltapi.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 110 | </example> |
| 111 | </para> |
| 112 | </refsect1> |
| 113 | |
| 114 | <refsect1> |
| 115 | <title>See also</title> |
| 116 | <para><link linkend="SigmodDelay"><citetitle>Delay</citetitle></link></para> |
| 117 | </refsect1> |
| 118 | |
| 119 | </refentry> |