| 1 | |
| 2 | <refentry id="locsend"> |
| 3 | <indexterm id="IndexLocsend"><primary>locsend</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>locsend</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>locsend</refname> |
| 11 | <refpurpose> |
| 12 | Distributes the audio signals of a previous <emphasis>locsig</emphasis> opcode. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | <emphasis>locsend</emphasis> depends upon the existence of a previously defined <link linkend="locsig"><citetitle>locsig</citetitle></link>. The number of output signals must match the number in the previous <emphasis>locsig</emphasis>. The output signals from <emphasis>locsend</emphasis> are derived from the values given for distance and reverb in the <emphasis>locsig</emphasis> and are ready to be sent to local or global reverb units (see example below). The reverb amount and the balance between the 2 or 4 channels are calculated in the same way as described in the Dodge book (an essential text!). |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>a1, a2 <command>locsend</command></synopsis> |
| 26 | |
| 27 | <synopsis>a1, a2, a3, a4 <command>locsend</command></synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Examples</title> |
| 32 | <para> |
| 33 | <informalexample> |
| 34 | <programlisting> |
| 35 | asig some audio signal |
| 36 | kdegree <emphasis role="opc">line</emphasis> 0, p3, 360 |
| 37 | kdistance <emphasis role="opc">line</emphasis> 1, p3, 10 |
| 38 | a1, a2, a3, a4 <emphasis role="opc">locsig</emphasis> asig, kdegree, kdistance, .1 |
| 39 | ar1, ar2, ar3, ar4 <emphasis role="opc">locsend</emphasis> |
| 40 | ga1 <emphasis role="op">=</emphasis> ga1<emphasis role="op">+</emphasis>ar1 |
| 41 | ga2 <emphasis role="op">=</emphasis> ga2<emphasis role="op">+</emphasis>ar2 |
| 42 | ga3 <emphasis role="op">=</emphasis> ga3<emphasis role="op">+</emphasis>ar3 |
| 43 | ga4 <emphasis role="op">=</emphasis> ga4<emphasis role="op">+</emphasis>ar4 |
| 44 | <emphasis>outq</emphasis> a1, a2, a3, a4 |
| 45 | <emphasis role="oblock">endin</emphasis> |
| 46 | |
| 47 | <emphasis role="oblock">instr</emphasis> 99 <emphasis role="comment">; reverb instrument</emphasis> |
| 48 | a1 <emphasis role="opc">reverb2</emphasis> ga1, 2.5, .5 |
| 49 | a2 <emphasis role="opc">reverb2</emphasis> ga2, 2.5, .5 |
| 50 | a3 <emphasis role="opc">reverb2</emphasis> ga3, 2.5, .5 |
| 51 | a4 <emphasis role="opc">reverb2</emphasis> ga4, 2.5, .5 |
| 52 | <emphasis role="opc">outq</emphasis> a1, a2, a3, a4 |
| 53 | ga1<emphasis role="op">=</emphasis>0 |
| 54 | ga2<emphasis role="op">=</emphasis>0 |
| 55 | ga3<emphasis role="op">=</emphasis>0 |
| 56 | ga4<emphasis role="op">=</emphasis>0</programlisting> |
| 57 | </informalexample> |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | In the above example, the signal, <emphasis>asig</emphasis>, is sent around a complete circle once during the duration of a note while at the same time it becomes more and more <quote>distant</quote> from the listeners' location. <emphasis>locsig</emphasis> sends the appropriate amount of the signal internally to <emphasis>locsend</emphasis>. The outputs of the <emphasis>locsend</emphasis> are added to global accumulators in a common Csound style and the global signals are used as inputs to the reverb units in a separate instrument. |
| 62 | For an example, see <link linkend="locsig"><citetitle>locsig</citetitle></link>. |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | <emphasis>locsig</emphasis> is useful for quad and stereo panning as well as fixed placed of sounds anywhere between two loudspeakers. Below is an example of the fixed placement of sounds in a stereo field. |
| 67 | It uses the file <ulink url="examples/locsend_stereo.csd"><citetitle>locsend_stereo.csd</citetitle></ulink>. |
| 68 | <example> |
| 69 | <title>Example of the locsend opcode.</title> |
| 70 | <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> |
| 71 | <xi:include href="examples-xml/locsend_stereo.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 72 | </example> |
| 73 | </para> |
| 74 | <para> |
| 75 | A few notes: |
| 76 | <informalexample> |
| 77 | <programlisting> |
| 78 | <emphasis role="comment">;place the sound in the left speaker and near:</emphasis> |
| 79 | <emphasis role="stamnt">i</emphasis>1 0 1 0 1 |
| 80 | |
| 81 | <emphasis role="comment">;place the sound in the right speaker and far:</emphasis> |
| 82 | <emphasis role="stamnt">i</emphasis>1 1 1 90 25 |
| 83 | |
| 84 | <emphasis role="comment">;place the sound equally between left and right and in the middle ground distance:</emphasis> |
| 85 | <emphasis role="stamnt">i</emphasis>1 2 1 45 12 |
| 86 | <emphasis role="stamnt">e</emphasis></programlisting> |
| 87 | </informalexample> |
| 88 | </para> |
| 89 | |
| 90 | <para> |
| 91 | The next example shows a simple intuitive use of the distance value to simulate Doppler shift. The same value is used to scale the frequency as is used as the distance input to <emphasis>locsig</emphasis>. |
| 92 | <informalexample> |
| 93 | <programlisting> |
| 94 | kdistance <emphasis role="opc">line</emphasis> 1, p3, 10 |
| 95 | kfreq <emphasis role="op">=</emphasis> (ifreq <emphasis role="op">*</emphasis> 340) <emphasis role="op">/</emphasis> (340 <emphasis role="op">+</emphasis> kdistance) |
| 96 | asig <emphasis role="opc">oscili</emphasis> iamp, kfreq, 1 |
| 97 | kdegree <emphasis role="opc">line</emphasis> 0, p3, 360 |
| 98 | a1, a2, a3, a4 <emphasis role="opc">locsig</emphasis> asig, kdegree, kdistance, .1 |
| 99 | ar1, ar2, ar3, ar4 <emphasis role="opc">locsend</emphasis></programlisting> |
| 100 | </informalexample> |
| 101 | </para> |
| 102 | </refsect1> |
| 103 | |
| 104 | <refsect1> |
| 105 | <title>See also</title> |
| 106 | <para><link linkend="SigmodPanspatl"><citetitle>Panning and Spatialization: Amplitude spatialization</citetitle></link></para> |
| 107 | </refsect1> |
| 108 | |
| 109 | <refsect1> |
| 110 | <title>Credits</title> |
| 111 | <para> |
| 112 | <simplelist> |
| 113 | <member>Author: Richard Karpen</member> |
| 114 | <member>Seattle, WA USA</member> |
| 115 | <member>1998</member> |
| 116 | </simplelist> |
| 117 | </para> |
| 118 | |
| 119 | <para>New in Csound version 3.48</para> |
| 120 | </refsect1> |
| 121 | </refentry> |