| 1 | <refentry id="hrtfstat"> |
| 2 | <indexterm id="IndexHrtfstat"> |
| 3 | <primary>hrtfstat</primary> |
| 4 | </indexterm> |
| 5 | <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo> |
| 6 | <refmeta> |
| 7 | <refentrytitle>hrtfstat</refentrytitle> |
| 8 | </refmeta> |
| 9 | |
| 10 | <refnamediv> |
| 11 | <refname>hrtfstat</refname> |
| 12 | <refpurpose> |
| 13 | Generates static 3d binaural audio for headphones using a |
| 14 | Woodworth based spherical head model with improved low frequency |
| 15 | phase accuracy. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | 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>,. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis> |
| 29 | aleft, aright <command>hrtfstat</command> asrc, iAz, iElev, ifilel, ifiler [,iradius, isr] |
| 30 | </synopsis> |
| 31 | </refsect1> |
| 32 | |
| 33 | <refsect1> |
| 34 | <title>Initialization</title> |
| 35 | <para> |
| 36 | <emphasis>iAz</emphasis> -- azimuth value in degrees. Positive |
| 37 | values represent position on the right, negative values are |
| 38 | positions on the left. |
| 39 | </para> |
| 40 | <para> |
| 41 | <emphasis>iElev</emphasis> -- elevation value in |
| 42 | degrees. Positive values represent position above horizontal, |
| 43 | negative values are positions below horizontal (min -40). |
| 44 | </para> |
| 45 | <para> |
| 46 | <emphasis>ifilel </emphasis> -- left HRTF spectral data file |
| 47 | </para> |
| 48 | <para> |
| 49 | <emphasis>ifiler </emphasis> -- right HRTF spectral data file |
| 50 | </para> |
| 51 | <note> |
| 52 | <para> |
| 53 | Spectral datafiles (based on the MIT |
| 54 | HRTF database) are available in 3 different sampling rates: |
| 55 | 44.1, 48 and 96 khz and are labelled accordingly. Input and |
| 56 | processing sr should match datafile sr. Files should be in the |
| 57 | current directory or the SADIR (see <link linkend="CommandEnvironment"><citetitle>Environment Variables</citetitle></link>). |
| 58 | </para> |
| 59 | </note> |
| 60 | <note> |
| 61 | <para> |
| 62 | HRTF Data files for use with |
| 63 | <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>, |
| 64 | <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>, |
| 65 | <link linkend="hrtfstat"><citetitle>hrtfstat</citetitle></link>, |
| 66 | <link linkend="hrtfearly"><citetitle>hrtfearly</citetitle></link>, |
| 67 | <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link> |
| 68 | were updated for Csound 5.15 and later (the code was updated and is more efficient). Old datafiles are now deprecated. |
| 69 | </para> |
| 70 | </note> |
| 71 | |
| 72 | <para> |
| 73 | <emphasis>iradius</emphasis> -- optional, head radius used for |
| 74 | phase spectra calculation in centimeters (default 9.0) |
| 75 | </para> |
| 76 | <para> |
| 77 | <emphasis>isr</emphasis> - optional (default 44.1kHz). Legal |
| 78 | values are 44100, 48000 and 96000. |
| 79 | </para> |
| 80 | </refsect1> |
| 81 | |
| 82 | <refsect1> |
| 83 | <title>Performance</title> |
| 84 | <para> |
| 85 | Artifact-free user-defined static spatialisation is made |
| 86 | possible using an interpolation algorithm based on spectral |
| 87 | magnitude interpolation and a derived phase based on the |
| 88 | Woodworth spherical head model. |
| 89 | Accuracy is increased for the data set provided by extracting |
| 90 | and applying a frequency dependent scaling factor to the phase |
| 91 | spectra, leading to a more precise low frequency interaural time |
| 92 | difference. |
| 93 | Users can control head radius for the phase derivation, allowing |
| 94 | a crude level of individualisation. |
| 95 | The static source version of the opcode uses overlap add |
| 96 | convolution (it does not need STFT processing, see <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>), |
| 97 | and is thus considerably more efficient than <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link> or |
| 98 | <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>, but cannot generate moving sources. |
| 99 | </para> |
| 100 | </refsect1> |
| 101 | |
| 102 | <refsect1> |
| 103 | <title>Examples</title> |
| 104 | <para> |
| 105 | Here is an example of the hrtfstat opcode. It uses the file <ulink url="examples/hrtfstat.csd"><citetitle>hrtfstat.csd</citetitle></ulink>. |
| 106 | </para> |
| 107 | |
| 108 | <example> |
| 109 | <title>Example of the hrtfstat opcode. |
| 110 | </title> |
| 111 | <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> |
| 112 | <xi:include href="examples-xml/hrtfstat.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 113 | </example> |
| 114 | <para> |
| 115 | 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. |
| 116 | |
| 117 | <example> |
| 118 | <title>Example two of the hrtfstat opcode</title> |
| 119 | |
| 120 | <xi:include href="examples-xml/hrtfstat-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 121 | </example> |
| 122 | </para> |
| 123 | </refsect1> |
| 124 | |
| 125 | <refsect1> |
| 126 | <title>See also</title> |
| 127 | <para><link linkend="SigmodPanspatl"><citetitle>Panning and Spatialization: Binaural spatialization</citetitle></link></para> |
| 128 | <para> More information on this opcode: <ulink url="http://www.csoundjournal.com/issue9/newHRTFOpcodes.html"><citetitle>http://www.csoundjournal.com/issue9/newHRTFOpcodes.html</citetitle></ulink>, written by Brian Carty </para> |
| 129 | </refsect1> |
| 130 | |
| 131 | <refsect1> |
| 132 | <title>Credits</title> |
| 133 | <para> |
| 134 | <simplelist> |
| 135 | <member>Author: Brian Carty</member> |
| 136 | <member>Maynooth</member> |
| 137 | <member>2008</member> |
| 138 | </simplelist> |
| 139 | </para> |
| 140 | </refsect1> |
| 141 | </refentry> |