| 1 | |
| 2 | <refentry id="hrtfmove"> |
| 3 | <indexterm id="IndexHrtfmove"><primary>hrtfmove</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>hrtfmove</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>hrtfmove</refname> |
| 11 | <refpurpose> |
| 12 | Generates dynamic 3d binaural audio for headphones using magnitude interpolation and phase truncation. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | This opcode takes a source signal and spatialises it in the 3 dimensional space around a listener |
| 20 | by convolving the source with stored head related transfer function (HRTF) based filters. |
| 21 | </para> |
| 22 | </refsect1> |
| 23 | |
| 24 | <refsect1> |
| 25 | <title>Syntax</title> |
| 26 | <synopsis>aleft, aright <command>hrtfmove</command> asrc, kAz, kElev, ifilel, ifiler [, imode, ifade, isr]</synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Initialization</title> |
| 31 | <para> |
| 32 | <emphasis>ifilel </emphasis> -- left HRTF spectral data file |
| 33 | </para> |
| 34 | <para> |
| 35 | <emphasis>ifiler </emphasis> -- right HRTF spectral data file |
| 36 | </para> |
| 37 | <note> |
| 38 | <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 <emphasis>sr</emphasis> should match datafile <emphasis>sr</emphasis>. Files should be in the current directory or the SADIR (see <link linkend="CommandEnvironment"><citetitle>Environment Variables</citetitle></link>). |
| 39 | </para> |
| 40 | </note> |
| 41 | <note> |
| 42 | <para> |
| 43 | HRTF Data files for use with |
| 44 | <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>, |
| 45 | <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>, |
| 46 | <link linkend="hrtfstat"><citetitle>hrtfstat</citetitle></link>, |
| 47 | <link linkend="hrtfearly"><citetitle>hrtfearly</citetitle></link>, |
| 48 | <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link> |
| 49 | were updated for Csound 5.15 and later (the code was updated and is more efficient). Old datafiles are now deprecated. |
| 50 | </para> |
| 51 | </note> |
| 52 | <para> |
| 53 | <emphasis>imode</emphasis> -- optional, default 0 for phase truncation, 1 for minimum phase |
| 54 | </para> |
| 55 | <para> |
| 56 | <emphasis>ifade</emphasis> -- optional, number of processing buffers for phase change crossfade (default 8). Legal range is 1-24. A low value is recommended for complex sources (4 or less: a higher value may make the crossfade audible), a higher value (8 or more: a lower value may make the inconsistency when the filter changes phase values audible) for narrowband sources. Does not effect minimum phase processing. |
| 57 | </para> |
| 58 | <note> |
| 59 | <para> |
| 60 | Ocassionally fades may overlap (when unnaturally fast/complex trajectories are requested). In this case, a warning will be printed. Use a smaller crossfade or slightly change trajectory to avoid any possible inconsistencies that may arise. |
| 61 | </para> |
| 62 | </note> |
| 63 | <para> |
| 64 | <emphasis>isr</emphasis> - optional, default 44.1kHz, legal values: 44100, 48000 and 96000. |
| 65 | </para> |
| 66 | <title>Performance</title> |
| 67 | <para> |
| 68 | <emphasis>kAz</emphasis> -- azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left. |
| 69 | </para> |
| 70 | <para> |
| 71 | <emphasis>kElev</emphasis> -- elevation value in degrees. Positive values represent position above horizontal, negative values are positions below horizontal (min -40). |
| 72 | </para> |
| 73 | <para> |
| 74 | Artifact-free user-defined trajectories are made possible using an interpolation algorithm based on spectral |
| 75 | magnitude interpolation and phase truncation. Crossfades are implemented to minimise/eliminate any inconsistencies |
| 76 | caused by updating phase values. These crossfades are performed over a user definable number of convolution |
| 77 | processing buffers. Complex sources may only need to crossfade over 1 buffer; narrow band sources may need several. |
| 78 | The opcode also offers minimum phase based processing, a more traditional and complex method. In this mode, the hrtf |
| 79 | filters used are reduced to minimum phase representations and the interpolation process then uses the relationship |
| 80 | between minimum phase magnitude and phase spectra. Interaural time difference, which is inherent to the phase |
| 81 | truncation process, is reintroduced in the minimum phase process using variable delay lines. |
| 82 | </para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>Examples</title> |
| 87 | <para> |
| 88 | Here is an example of the hrtfmove opcode. It uses the file <ulink url="examples/hrtfmove.csd"><citetitle>hrtfmove.csd</citetitle></ulink>. |
| 89 | </para> |
| 90 | <example> |
| 91 | <title>Example of the htrfmove opcode.</title> |
| 92 | <xi:include href="examples-xml/hrtfmove.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 93 | </example> |
| 94 | </refsect1> |
| 95 | |
| 96 | <refsect1> |
| 97 | <title>See also</title> |
| 98 | <para><link linkend="SigmodPanspatl"><citetitle>Panning and Spatialization: Binaural spatialization</citetitle></link></para> |
| 99 | <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> |
| 100 | </refsect1> |
| 101 | |
| 102 | <refsect1> |
| 103 | <title>Credits</title> |
| 104 | <para> |
| 105 | <simplelist> |
| 106 | <member>Author: Brian Carty</member> |
| 107 | <member>Maynooth</member> |
| 108 | <member>2008</member> |
| 109 | </simplelist> |
| 110 | </para> |
| 111 | </refsect1> |
| 112 | </refentry> |