<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>hrtfstat</title> <link rel="stylesheet" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="hrtfmove2.html" title="hrtfmove2" /> <link rel="next" href="hsboscil.html" title="hsboscil" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">hrtfstat</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="hrtfmove2.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="hsboscil.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="hrtfstat"> <a id="hrtfstat"></a> <div class="titlepage"></div> <a id="IndexHrtfstat" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">hrtfstat</span> </h2> <p>hrtfstat — Generates static 3d binaural audio for headphones using a Woodworth based spherical head model with improved low frequency phase accuracy. </p> </div> <div class="refsect1" title="Description"> <a id="id2941344"></a> <h2>Description</h2> <p> 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 <a class="link" href="hrtfmove.html" title="hrtfmove"><em class="citetitle">hrtfmove</em></a> and <a class="link" href="hrtfmove2.html" title="hrtfmove2"><em class="citetitle">hrtfmove2</em></a>,. </p> </div> <div class="refsect1" title="Syntax"> <a id="id2941098"></a> <h2>Syntax</h2> <pre class="synopsis"> aleft, aright <span class="command"><strong>hrtfstat</strong></span> asrc, iAz, iElev, ifilel, ifiler [,iradius, isr] </pre> </div> <div class="refsect1" title="Initialization"> <a id="id2941352"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>iAz</em></span> -- azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left. </p> <p> <span class="emphasis"><em>iElev</em></span> -- elevation value in degrees. Positive values represent position above horizontal, negative values are positions below horizontal (min -40). </p> <p> <span class="emphasis"><em>ifilel </em></span> -- left HRTF spectral data file </p> <p> <span class="emphasis"><em>ifiler </em></span> -- right HRTF spectral data file </p> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p> 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 <a class="link" href="CommandEnvironment.html" title="Csound Environment Variables"><em class="citetitle">Environment Variables</em></a>). </p> </td> </tr> </table> </div> <p> <span class="emphasis"><em>iradius</em></span> -- optional, head radius used for phase spectra calculation in centimeters (default 9.0) </p> <p> <span class="emphasis"><em>isr</em></span> - optional (default 44.1kHz). Legal values are 44100, 48000 and 96000. </p> </div> <div class="refsect1" title="Performance"> <a id="id2942035"></a> <h2>Performance</h2> <p> 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 <a class="link" href="hrtfmove2.html" title="hrtfmove2"><em class="citetitle">hrtfmove2</em></a>), and is thus considerably more efficient than <a class="link" href="hrtfmove2.html" title="hrtfmove2"><em class="citetitle">hrtfmove2</em></a> or <a class="link" href="hrtfmove.html" title="hrtfmove"><em class="citetitle">hrtfmove</em></a>, but cannot generate moving sources. </p> </div> <div class="refsect1" title="Examples"> <a id="id2942081"></a> <h2>Examples</h2> <p> It can be found in the file <a class="ulink" href="examples/htrfstat.csd" target="_top"><em class="citetitle">htrfstat.csd</em></a>. </p> <div class="example"> <a id="id2942098"></a> <p class="title"> <b>Example 301. Example of the htrfstat opcode. </b> </p> <div class="example-contents"> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select flags here</span> <span class="comment">; realtime audio out</span> -o dac <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o hrtf.wav</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 gasrc <span class="opc">init</span> 0 <span class="oblock">instr</span> 1 <span class="comment">;a plucked string</span> kamp <span class="op">=</span> p4 kcps <span class="op">=</span> <span class="opc">cpspch</span>(p5) icps <span class="op">=</span> <span class="opc">cpspch</span>(p5) a1 <span class="opc">pluck</span> kamp, kcps, icps, 0, 1 gasrc <span class="op">=</span> a1 <span class="oblock">endin</span> <span class="oblock">instr</span> 10 <span class="comment">;uses output from instr1 as source</span> aleft,aright <span class="opc">hrtfstat</span> gasrc, 90,0, "hrtf<span class="op">-</span>44100<span class="op">-</span>left.dat","hrtf<span class="op">-</span>44100<span class="op">-</span>right.dat" <span class="opc">outs</span> aleft, aright <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Play Instrument 1: a plucked string</span> <span class="stamnt">i</span>1 0 2 20000 8.00 <span class="comment">; Play Instrument 10 for 2 seconds.</span> <span class="stamnt">i</span>10 0 2 <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <br class="example-break" /> </div> <div class="refsect1" title="See Also"> <a id="id2942114"></a> <h2>See Also</h2> <p> <a class="link" href="hrtfmove.html" title="hrtfmove"><em class="citetitle">hrtfmove</em></a>, <a class="link" href="hrtfmove2.html" title="hrtfmove2"><em class="citetitle">hrtfmove2</em></a>, <a class="link" href="hrtfer.html" title="hrtfer"><em class="citetitle">hrtfer</em></a>. </p> </div> <div class="refsect1" title="Credits"> <a id="id2942147"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Brian Carty</td> </tr> <tr> <td>Maynooth</td> </tr> <tr> <td>2008</td> </tr> </table> <p> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="hrtfmove2.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="hsboscil.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">hrtfmove2 </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> hsboscil</td> </tr> </table> </div> </body> </html>