summaryrefslogtreecommitdiff
path: root/opcodes/hrtfstat.xml
blob: 66b0d2287a0e252302e66e94c1d641df9c45e8e6 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<refentry id="hrtfstat">
  <indexterm id="IndexHrtfstat">
    <primary>hrtfstat</primary>
  </indexterm>
  <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo>
  <refmeta>
    <refentrytitle>hrtfstat</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>hrtfstat</refname>
    <refpurpose>
      Generates static 3d binaural audio for headphones using a
      Woodworth based spherical head model with improved low frequency
      phase accuracy.
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      This opcode takes a source signal and spatialises it in the 3 dimensional space around a listener using head related transfer function (HRTF) based filters. It produces a static output (azimuth and elevation parameters are i-rate), because a static source allows much more efficient processing than <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link> and <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>,. 
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>
      aleft, aright <command>hrtfstat</command> asrc, iAz, iElev, ifilel, ifiler [,iradius, isr]
    </synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iAz</emphasis> -- azimuth value in degrees. Positive
      values represent position on the right, negative values are
      positions on the left. 
    </para>
    <para>
      <emphasis>iElev</emphasis> -- elevation value in
      degrees. Positive values represent position above horizontal,
      negative values are positions below horizontal (min -40). 
    </para>
    <para>
      <emphasis>ifilel </emphasis> -- left HRTF spectral data file
    </para>
    <para>
      <emphasis>ifiler </emphasis> -- right HRTF spectral data file
    </para>
    <note>
      <para>
        Spectral datafiles (based on the MIT
        HRTF database) are available in 3 different sampling rates:
        44.1, 48 and 96 khz and are labelled accordingly. Input and
        processing sr should match datafile sr. Files should be in the
        current directory or the SADIR (see <link linkend="CommandEnvironment"><citetitle>Environment Variables</citetitle></link>).
      </para>
    </note>
<note>
      <para>
       HRTF Data files for use with 
      <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>,
      <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>,
      <link linkend="hrtfstat"><citetitle>hrtfstat</citetitle></link>,
      <link linkend="hrtfearly"><citetitle>hrtfearly</citetitle></link>,
      <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link>
       were updated for Csound 5.15 and later (the code was updated and is more efficient). Old datafiles are now deprecated.
      </para>
</note>

    <para>
      <emphasis>iradius</emphasis> --  optional, head radius used for
      phase spectra calculation in centimeters (default 9.0)
    </para>
    <para>
      <emphasis>isr</emphasis> - optional (default 44.1kHz). Legal
      values are 44100, 48000 and 96000.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      Artifact-free user-defined static spatialisation is made
      possible using an interpolation algorithm based on spectral
      magnitude interpolation and a derived phase based on the
      Woodworth spherical head model.
      Accuracy is increased for the data set provided by extracting
      and applying a frequency dependent scaling factor to the phase
      spectra, leading to a more precise low frequency interaural time
      difference.
      Users can control head radius for the phase derivation, allowing
      a crude level of individualisation.
      The static source version of the opcode uses overlap add
      convolution (it does not need STFT processing, see <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>),
      and is thus considerably more efficient than <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link> or
      <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>, but cannot generate moving sources. 
    </para>
  </refsect1>
  
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the hrtfstat opcode. It uses the file <ulink url="examples/hrtfstat.csd"><citetitle>hrtfstat.csd</citetitle></ulink>. 
    </para>

    <example>
      <title>Example of the hrtfstat opcode.
      </title>
              <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>
<xi:include href="examples-xml/hrtfstat.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    </example>
        <para>
      Here is another example of the hrtfstat opcode. It uses the file <ulink url="examples/hrtfstat-2.csd"><citetitle>htrfstat-2.csd</citetitle></ulink>, and <ulink url="examples/Church.wav"><citetitle>Church.wav</citetitle></ulink>, which is a looped sample.

      <example>
        <title>Example two of the hrtfstat opcode</title>

          <xi:include href="examples-xml/hrtfstat-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>,
      <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>,
      <link linkend="hrtfer"><citetitle>hrtfer</citetitle></link>.
    </para>
        <para> More information on this opcode: <ulink url="http://www.csounds.com/journal/issue9/newHRTFOpcodes.html"><citetitle>http://www.csounds.com/journal/issue9/newHRTFOpcodes.html</citetitle></ulink>  , written by Brian Carty </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: Brian Carty</member>
        <member>Maynooth</member>
        <member>2008</member>
      </simplelist>
    </para>
  </refsect1>
</refentry>