| 1 | |
| 2 | <refentry id="hrtfearly"> |
| 3 | <indexterm id="IndexHrtfearly"><primary>hrtfearly</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Panning and Spatialization</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>hrtfearly</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>hrtfearly</refname> |
| 11 | <refpurpose> |
| 12 | Generates 3D binaural audio with high-fidelity early reflections in a parametric room using a Phase Truncation algorithm. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | This opcode essentially nests the <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link> opcode in an image model for a user-definable shoebox-shaped room. A default room can be selected, or advanced room parameters can be used. Room surfaces can be controlled with high and low-frequency absorption coefficients and gain factors of a three-band equaliser. |
| 20 | </para> |
| 21 | <para> |
| 22 | Although valid as a stand alone opcode, <emphasis>hrtfearly</emphasis> is designed to work with <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link> to provide spatially accurate, dynamic binaural reverberation. A number of sources can be processed dynamically using a number of <emphasis>hrtfearly</emphasis> instances. All can then be processed with one instance of <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link>. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>aleft, aright, irt60low, irt60high, imfp <command>hrtfearly</command> asrc, ksrcx, ksrcy, ksrcz, klstnrx, klstnry, klstnrz, \ |
| 29 | ifilel, ifiler, idefroom [,ifade, isr, iorder, ithreed, kheadrot, iroomx, iroomy, iroomz, iwallhigh, \ |
| 30 | iwalllow, iwallgain1, iwallgain2, iwallgain3, ifloorhigh, ifloorlow, ifloorgain1, ifloorgain2, \ |
| 31 | ifloorgain3, iceilinghigh, iceilinglow, iceilinggain1, iceilinggain2, iceilinggain3]</synopsis> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>ifilel</emphasis> - left HRTF spectral data file. |
| 38 | </para> |
| 39 | <para> |
| 40 | <emphasis>ifiler</emphasis> - right HRTF spectral data file. |
| 41 | </para> |
| 42 | <note> |
| 43 | <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>). |
| 44 | </para> |
| 45 | </note> |
| 46 | <note> |
| 47 | <para>HRTF Data files for use with |
| 48 | <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>, |
| 49 | <link linkend="hrtfmove2"><citetitle>hrtfmove2</citetitle></link>, |
| 50 | <link linkend="hrtfstat"><citetitle>hrtfstat</citetitle></link>, |
| 51 | <link linkend="hrtfearly"><citetitle>hrtfearly</citetitle></link>, |
| 52 | <link linkend="hrtfreverb"><citetitle>hrtfreverb</citetitle></link> |
| 53 | were updated for Csound 5.15 and later (the code was updated and is more efficient). Old datafiles are now deprecated. |
| 54 | </para> |
| 55 | </note> |
| 56 | <para> |
| 57 | <emphasis>idefroom</emphasis> - default room, medium (1: 10*10*3), small (2: 3*4*3) or large (3: 20*25*7). Wall details (high coef, low coef, gain1, gain2, gain3): .3, .1, .75, .95, .9. Floor: .6, .1, .95, .6, .35. Ceiling: .2, .1, 1, 1, 1. If 0 is entered, optional room parameters will be read. |
| 58 | </para> |
| 59 | <para> |
| 60 | <emphasis>ifade</emphasis> - optional, number of processing buffers for phase change crossfade (default 8). Legal range is 1-24. See <link linkend="hrtfmove"><citetitle>hrtfmove</citetitle></link>. |
| 61 | </para> |
| 62 | <para> |
| 63 | <emphasis>isr</emphasis> - optional, default 44.1kHz, legal values: 44100, 48000 and 96000. |
| 64 | </para> |
| 65 | <para> |
| 66 | <emphasis>iorder</emphasis> - optional, order of images processed: higher order: more reflections. Defaults to 1, legal range: 0-4. |
| 67 | </para> |
| 68 | <para> |
| 69 | <emphasis>ithreed</emphasis> - optional, process image sources in three dimensions (1) or two (0: default). |
| 70 | </para> |
| 71 | <para> |
| 72 | <emphasis>iroomx</emphasis> - optional, x room size in metres, will be read if no valid default room is entered (all below parameters behave similarly). Minimum room size is 2*2*2. |
| 73 | </para> |
| 74 | <para> |
| 75 | <emphasis>iroomy</emphasis> - optional, y room size. |
| 76 | </para> |
| 77 | <para> |
| 78 | <emphasis>iroomz</emphasis> - optional, z room size. |
| 79 | </para> |
| 80 | <para> |
| 81 | <emphasis>iwallhigh</emphasis> - optional, high frequency wall absorption coefficient (all 4 walls are assumed identical). Absorption coefficients will affect reverb time output. |
| 82 | </para> |
| 83 | <para> |
| 84 | <emphasis>iwalllow</emphasis> - optional, low frequency wall absorption coefficient. |
| 85 | </para> |
| 86 | <para> |
| 87 | <emphasis>iwallgain1</emphasis> - optional, gain on filter centred at 250 Hz (all filters have a Q implying 4 octaves). |
| 88 | </para> |
| 89 | <para> |
| 90 | <emphasis>iwallgain2</emphasis> - optional, as above, centred on 1000 Hz. |
| 91 | </para> |
| 92 | <para> |
| 93 | <emphasis>iwallgain3</emphasis> - optional, as above, centred on 4000 Hz. |
| 94 | </para> |
| 95 | <para> |
| 96 | <emphasis>ifloorhigh, ifloorlow, ifloorgain1, ifloorgain2, ifloorgain3 |
| 97 | </emphasis> - as above for floor. |
| 98 | </para> |
| 99 | <para> |
| 100 | <emphasis> |
| 101 | iceilinghigh, iceilinglow, iceilinggain1, iceilinggain2, iceilinggain3 |
| 102 | </emphasis> - as above for ceiling. |
| 103 | </para> |
| 104 | |
| 105 | <title>Performance</title> |
| 106 | <para> |
| 107 | <emphasis>ksrcx</emphasis> source x location, must be 10 cm inside room. Also, near-field HRTFs are not processed, so source will not change spatially within a 45 cm radius of the listener. These restrictions also apply to location parameters below. |
| 108 | </para> |
| 109 | <para> |
| 110 | <emphasis>ksrcy</emphasis> source y location. |
| 111 | </para> |
| 112 | <para> |
| 113 | <emphasis>ksrcz</emphasis> source z location. |
| 114 | </para> |
| 115 | <para> |
| 116 | <emphasis>klstnrx, klstnry, klstnrz</emphasis> listener location, as above. |
| 117 | </para> |
| 118 | <para> |
| 119 | <emphasis>kheadrot</emphasis> - optional, angular value for head rotation. |
| 120 | </para> |
| 121 | <para> |
| 122 | <emphasis>asrc</emphasis> - Input/source signal. |
| 123 | </para> |
| 124 | |
| 125 | <title>Output</title> |
| 126 | <para> |
| 127 | <emphasis>irt60low</emphasis> - suggested low frequency reverb time for later binaural reverb. |
| 128 | </para> |
| 129 | <para> |
| 130 | <emphasis>irt60high</emphasis> - as above, for high frequency. |
| 131 | </para> |
| 132 | <para> |
| 133 | <emphasis>imfp</emphasis> - mean free path of room, to be used with later reverb. |
| 134 | </para> |
| 135 | |
| 136 | </refsect1> |
| 137 | |
| 138 | <refsect1> |
| 139 | <title>Examples</title> |
| 140 | <para> |
| 141 | Here is an example of the hrtfearly and hrtfreverb opcodes. It uses the file <ulink url="examples/hrtfearly.csd"><citetitle>hrtfearly.csd</citetitle></ulink>. |
| 142 | </para> |
| 143 | <example> |
| 144 | <title>Example of the htrfearly opcode.</title> |
| 145 | <xi:include href="examples-xml/hrtfearly.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 146 | </example> |
| 147 | </refsect1> |
| 148 | |
| 149 | <refsect1> |
| 150 | <title>See also</title> |
| 151 | <para><link linkend="SigmodPanspatl"><citetitle>Panning and Spatialization: Binaural spatialization</citetitle></link></para> |
| 152 | </refsect1> |
| 153 | |
| 154 | <refsect1> |
| 155 | <title>Credits</title> |
| 156 | <para> |
| 157 | <simplelist> |
| 158 | <member>Author: Brian Carty</member> |
| 159 | <member>Maynooth</member> |
| 160 | <member>2011</member> |
| 161 | </simplelist> |
| 162 | </para> |
| 163 | </refsect1> |
| 164 | </refentry> |