summaryrefslogtreecommitdiff
path: root/opcodes/pan.xml
blob: 771e46863ddff481644ba55b98a7de71737a17c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<refentry id="pan">
<indexterm id="IndexPan"><primary>pan</primary></indexterm>
  <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo>
  <refmeta>
    <refentrytitle>pan</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>pan</refname>
    <refpurpose>
      Distribute an audio signal amongst four channels.
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Distribute an audio signal amongst four channels with localization control.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>a1, a2, a3, a4 <command>pan</command> asig, kx, ky, ifn [, imode] [, ioffset]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis> -- function table number of a stored pattern describing the amplitude growth in a speaker channel as sound moves towards it from an adjacent speaker. Requires extended guard-point.
    </para>

    <para>
      <emphasis>imode</emphasis> (optional) -- mode of the <emphasis>kx, ky</emphasis> position values. 0 signifies raw index mode, 1 means the inputs are normalized (0 - 1). The default value is 0.
    </para>

    <para>
      <emphasis>ioffset</emphasis> (optional) -- offset indicator for <emphasis>kx, ky</emphasis>. 0 infers the origin to be at channel 3 (left rear); 1 requests an axis shift to the quadraphonic center. The default value is 0.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>pan</emphasis> takes an input signal <emphasis>asig</emphasis> and distributes it amongst four outputs (essentially quad speakers) according to the controls <emphasis>kx</emphasis> and <emphasis>ky</emphasis>. For normalized input (mode=1) and no offset, the four output locations are in order: left-front at (0,1), right-front at (1,1), left-rear at the origin (0,0), and right-rear at (1,0). In the notation (<emphasis>kx</emphasis>, <emphasis>ky)</emphasis>, the coordinates <emphasis>kx</emphasis> and <emphasis>ky</emphasis>, each ranging 0 - 1, thus control the 'rightness' and 'forwardness' of a sound location.
    </para>

    <para>
      Movement between speakers is by amplitude variation, controlled by the stored function table <emphasis>ifn</emphasis>. As <emphasis>kx</emphasis> goes from 0 to 1, the strength of the right-hand signals will grow from the left-most table value to the right-most, while that of the left-hand signals will progress from the right-most table value to the left-most. For a simple linear pan, the table might contain the linear function 0 - 1. A more correct pan that maintains constant power would be obtained by storing the first quadrant of a sinusoid. Since <emphasis>pan</emphasis> will scale and truncate <emphasis>kx</emphasis> and <emphasis>ky</emphasis> in simple table lookup, a medium-large table (say 8193) should be used.
    </para>

    <para>
      <emphasis>kx, ky</emphasis> values are not restricted to 0 - 1. A circular motion passing through all four speakers (inscribed) would have a diameter of root 2, and might be defined by a circle of radius R = root 1/2 with center at (.5,.5). <emphasis>kx, ky</emphasis> would then come from Rcos(angle), Rsin(angle), with an implicit origin at (.5,.5) (i.e. <emphasis>ioffset</emphasis> = 1). Unscaled raw values operate similarly. Sounds can thus be located anywhere in the polar or Cartesian plane; points lying outside the speaker square are projected correctly onto the square's perimeter as for a listener at the center.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      <informalexample>
        <programlisting>
<emphasis role="oblock">instr</emphasis>     1
  k1           <emphasis role="opc">phasor</emphasis>    1<emphasis role="op">/</emphasis>p3                     <emphasis role="comment">; fraction of circle</emphasis>
  k2           <emphasis role="opc">tablei</emphasis>    k1, 1, 1                 <emphasis role="comment">; sin of angle (sinusoid in f1)</emphasis>
  k3           <emphasis role="opc">tablei</emphasis>    k1, 1, 1, .25, 1         <emphasis role="comment">; cos of angle (sin offset 1/4 circle)</emphasis>
  a1           <emphasis role="opc">oscili</emphasis>    10000,440, 1             <emphasis role="comment">; audio signal..</emphasis>
  a1,a2,a3,a4  <emphasis role="opc">pan</emphasis>       a1, k2<emphasis role="op">/</emphasis>2, k3<emphasis role="op">/</emphasis>2, 2, 1, 1  <emphasis role="comment">; sent in a circle (f2=1st quad sin)</emphasis>
                                 
               <emphasis role="opc">outq</emphasis> a1, a2, a3, a4
<emphasis role="oblock">endin</emphasis></programlisting>
      </informalexample>
    </para>
  </refsect1>
</refentry>