| 1 | |
| 2 | <refentry id="ATSreadnz"> |
| 3 | <indexterm id="IndexATSreadnz"><primary>ATSreadnz</primary></indexterm> |
| 4 | <refentryinfo><title>Spectral Processing:ATS</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ATSreadnz</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ATSreadnz</refname> |
| 11 | <refpurpose> reads data from an ATS file. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | <refsect1> |
| 15 | <title>Description</title> |
| 16 | <para> |
| 17 | <emphasis>ATSreadnz</emphasis> returns the energy (<emphasis>kenergy</emphasis>) of a user specified noise band (1-25 bands) at the time indicated by the time pointer <emphasis>ktimepnt</emphasis>. |
| 18 | </para> |
| 19 | </refsect1> |
| 20 | <refsect1> |
| 21 | <title>Syntax</title> |
| 22 | <synopsis>kenergy <command>ATSreadnz</command> ktimepnt, iatsfile, iband</synopsis> |
| 23 | </refsect1> |
| 24 | <refsect1> |
| 25 | <title>Initialization</title> |
| 26 | <para> |
| 27 | <emphasis>iatsfile</emphasis> – the ATS number (n in ats.n) or the name in quotes of the analysis file made using <link linkend="UtilityAtsa"><citetitle>ATSA</citetitle></link>. |
| 28 | </para> |
| 29 | <para> |
| 30 | <emphasis>iband</emphasis> – the number of the noise band to return the energy data. |
| 31 | </para> |
| 32 | </refsect1> |
| 33 | <refsect1> |
| 34 | <title>Performance</title> |
| 35 | <para> |
| 36 | <emphasis>kenergy</emphasis> outputs the linearly interpolated energy of the noise band indicated in <emphasis>iband</emphasis>. The output is dependent on the data in the analysis file and the <emphasis>ktimepnt</emphasis>. |
| 37 | </para> |
| 38 | <para><emphasis>ktimepnt</emphasis> – The time pointer in seconds used to index the ATS file. Used for <emphasis>ATSreadnz</emphasis> exactly the same as for <link linkend="pvoc"><citetitle>pvoc</citetitle></link> and <link linkend="ATSadd"><citetitle>ATSadd</citetitle></link>.</para> |
| 39 | <para><emphasis>ATSaddnz</emphasis> reads from an ATS file and resynthesizes the noise from noise energy data contained in the ATS file. It uses a modified randi function to create band limited noise and modulates that with a user supplied wave table (one period of a cosine wave), to synthesize a user specified selection of frequency bands. Modulating the noise is required to put the band limited noise in the correct place in the frequency spectrum. |
| 40 | </para> |
| 41 | <para>An ATS analysis differs from a pvanal in that ATS tracks the partials and computes the noise energy of the sound being analyzed. For more info about ATS analysis read Juan Pampin's description on the the <ulink url="https://ccrma.stanford.edu/~juan/ATS_manual.html"><citetitle>ATS</citetitle></ulink> web-page. |
| 42 | </para> |
| 43 | </refsect1> |
| 44 | <refsect1> |
| 45 | <title>Examples</title> |
| 46 | <programlisting> |
| 47 | ktime <emphasis role="opc">line</emphasis> 2.5, p3, 0 |
| 48 | kenergy <emphasis role="opc">ATSreadnz</emphasis> ktime, "clarinet.ats", 5</programlisting> |
| 49 | <para>Here we are extracting the noise energy from band 5 in the |
| 50 | 'clarinet.ats' ATS analysis file. We are actually reading backwards from 2.5 seconds to the beginning of the analysis file. We could use this to synthesize noise like this: |
| 51 | </para> |
| 52 | <programlisting> |
| 53 | anoise <emphasis role="opc">randi</emphasis> <emphasis role="opc">sqrt</emphasis>(kenergy), 55 |
| 54 | aout <emphasis role="opc">oscili</emphasis> 4000000000000000000000000, 455, 2 |
| 55 | aout <emphasis role="op">=</emphasis> aout <emphasis role="op">*</emphasis> anoise</programlisting> |
| 56 | <para>Function table 2 used in the oscillator is a cosine, |
| 57 | which is needed to shift the band limited noise into the |
| 58 | correct place in the frequency spectrum. The |
| 59 | <emphasis>randi</emphasis> function creates a band of noise |
| 60 | centered about 0 Hz that has a bandwidth of about 110 Hz; |
| 61 | multiplying it by a cosine will shift it to be centered at 455 |
| 62 | Hz, which is the center frequency of the 5th critical noise |
| 63 | band. This is only an example, for synthesizing the noise you would be better off just using <link linkend="ATSaddnz"><citetitle>ATSaddnz</citetitle></link> unless you want to use your own noise synthesis algorithm. Maybe you could use the noise energy for something else like applying a small amount of jitter to specific partials or for controlling something totally unrelated to the source sound? |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | Here is a complete example of the ATSreadnz opcode. It uses the file <ulink url="examples/ATSreadnz.csd"><citetitle>ATSreadnz.csd</citetitle></ulink>. |
| 68 | <example> |
| 69 | <title>Another example of the ATSreadnz opcode.</title> |
| 70 | <xi:include href="examples-xml/ATSreadnz.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 71 | </example> |
| 72 | </para> |
| 73 | </refsect1> |
| 74 | |
| 75 | <refsect1> |
| 76 | <title>See also</title> |
| 77 | <para><link linkend="SpectralATS"><citetitle>ATS Spectral Processing</citetitle></link></para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>Credits</title> |
| 82 | <para> |
| 83 | <simplelist> |
| 84 | <member>Author: Alex Norman</member> |
| 85 | <member>Seattle,Washington</member> |
| 86 | <member>2004</member> |
| 87 | </simplelist> |
| 88 | </para> |
| 89 | </refsect1> |
| 90 | </refentry> |