<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="hrtfer">
  <refmeta>
    <refentrytitle>hrtfer</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>hrtfer</refname>
    <refpurpose>
      Creates 3D audio for two speakers.
      <indexterm id="IndexHrtfer"><primary>hrtfer</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Output is binaural (headphone) 3D audio.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>aleft, aright <command>hrtfer</command> asig, kaz, kelev, <quote>HRTFcompact</quote></synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>kAz</emphasis> -- azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left.
    </para>

    <para>
      <emphasis>kElev</emphasis> -- elevation value in degrees. Positive values represent position above horizontal, negative values are positions above horizontal.
    </para>

    <para>
      At present, the only file which can be used with <emphasis>hrtfer</emphasis> is <ulink url="examples/HRTFcompact"><citetitle>HRTFcompact</citetitle></ulink>. It must be passed to the opcode as the last argument within quotes as shown above.
    </para>

    <para>
      HRTFcompact may also be obtained via anonymous ftp from: <ulink url="ftp://ftp.cs.bath.ac.uk/pub/dream/utilities/Analysis/HRTFcompact"><citetitle>ftp://ftp.cs.bath.ac.uk/pub/dream/utilities/Analysis/HRTFcompact</citetitle></ulink>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      These unit generators place a mono input signal in a virtual 3D space around the listener by convolving the input with the appropriate HRTF data specified by the opcode's azimuth and elevation values. <emphasis>hrtfer</emphasis> allows these values to be k-values, allowing for dynamic spatialization. <emphasis>hrtfer</emphasis> can only place the input at the requested position because the HRTF is loaded in at i-time (remember that currently, CSound has a limit of 20 files it can hold in memory, otherwise it causes a segmentation fault). The output will need to be scaled either by using balance or by multiplying the output by some scaling constant.
    </para>

    <note>
      <title>Note</title>
      <para>
        The sampling rate of the orchestra must be 44.1kHz. This is because 44.1kHz is the sampling rate at which the HRTFs were measured. In order to be used at a different rate, the HRTFs would need to be re-sampled at the desired rate.
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the hrtfer opcode. It uses the files <ulink url="examples/hrtfer.orc"><citetitle>hrtfer.orc</citetitle></ulink>, <ulink url="examples/hrtfer.sco"><citetitle>hrtfer.sco</citetitle></ulink>,  <ulink url="examples/HRTFcompact"><citetitle>HRTFcompact</citetitle></ulink>, and <ulink url="examples/beats.wav"><citetitle>beats.wav</citetitle></ulink>.

      <example>
        <title>Example of the hrtfer opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/hrtfer.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/hrtfer.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Authors: Eli Breder and David MacIntyre</member>
        <member>Montreal</member>
        <member>1996</member>
      </simplelist>
    </para>

    <para>Fixed the example thanks to a message from &nameistvan;.</para>
  </refsect1>
</refentry> 
