<?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>fft</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="fillarray.html" title="fillarray" /> <link rel="next" href="filter2.html" title="filter2" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">fft</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="fillarray.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="filter2.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="fft"></a> <div class="titlepage"></div> <a id="IndexFft" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">fft</span> </h2> <p>fft — Complex-to-complex Fast Fourier Transform. </p> </div> <div class="refsect1"> <a id="idm281472937519288"></a> <h2>Description</h2> <p> Applies a forward Fast Fourier Transform to a complex-valued input 1-dimensional array producing a complex-valued output. The output is another array containing the complex-valued signal, and both arrays are arranged in interleaved real-imaginary format. The output array will have the same size as the input, and the transform size will be equivalent to half of the length of the array. Non-power-of-two transforms are limited to even sizes with not too many factors. </p> </div> <div class="refsect1"> <a id="idm281472937517608"></a> <h2>Syntax</h2> <pre class="synopsis">kout[] <span class="command"><strong>fft</strong></span> kin[]</pre> </div> <div class="refsect1"> <a id="idm281472937459320"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kout[]</em></span> -- output array containing the complex-valued output. It will be created if it does not exist. </p> <p> <span class="emphasis"><em>kin[]</em></span> -- input array containing the complex-valued input. </p> </div> <div class="refsect1"> <a id="idm281472937456792"></a> <h2>Examples</h2> <p> Here is an example of the fft opcode. It uses the file <a class="ulink" href="examples/fft.csd" target="_top"><em class="citetitle">fft.csd</em></a>.</p> <div class="example"> <a id="idm281472937454840"></a> <p class="title"> <strong>Example 276. Example of the fft opcode.</strong> </p> <div class="example-contents"> <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p> <div class="refsect1"> <a id="idm281472769676040"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> -d -o dac <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">64</span> <span class="kd">instr</span> <span class="nf">1</span> i<span class="n">fftsize</span> <span class="o">=</span> <span class="mi">1024</span> k<span class="n">cnt</span> <span class="nb">init</span> <span class="mi">0</span> k<span class="n">In</span><span class="p">[]</span> <span class="nb">init</span> i<span class="n">fftsize</span> k<span class="n">Out</span><span class="p">[]</span> <span class="nb">init</span> i<span class="n">fftsize</span> a<span class="n">1</span> <span class="nb">oscili</span> <span class="vg">0dbfs</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">440</span> <span class="k">if</span> k<span class="n">cnt</span> <span class="o">>=</span> i<span class="n">fftsize</span> <span class="k">then</span> k<span class="n">Cmplx</span><span class="p">[]</span> <span class="nb">r2c</span> k<span class="n">In</span> k<span class="n">Spec</span><span class="p">[]</span> <span class="nb">fft</span> k<span class="n">Cmplx</span> k<span class="n">Cmplx</span> <span class="nb">fftinv</span> k<span class="n">Spec</span> k<span class="n">Out</span> <span class="nb">c2r</span> k<span class="n">Cmplx</span> k<span class="n">cnt</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">endif</span> k<span class="n">In</span><span class="p">[]</span> <span class="nb">shiftin</span> a<span class="n">1</span> a<span class="n">2</span> <span class="nb">shiftout</span> k<span class="n">Out</span> k<span class="n">cnt</span> <span class="o">+=</span> <span class="vg">ksmps</span> <span class="nb">out</span> a<span class="n">2</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">10</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <br class="example-break" /> </div> <div class="refsect1"> <a id="idm281472937450776"></a> <h2>See Also</h2> <p> <a class="link" href="vectorial.html" title="Vectorial Opcodes"><em class="citetitle"></em>Vectorial opcodes</a>, <a class="link" href="arrayOpcodes.html" title="Array Opcodes"><em class="citetitle"></em>array opcodes</a> </p> </div> <div class="refsect1"> <a id="idm281472937447768"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Victor Lazzarini</td> </tr> <tr> <td>NUI Maynooth</td> </tr> <tr> <td>2014</td> </tr> </table> <p> </p> <p>New in version 6.04</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="fillarray.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="filter2.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">fillarray </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> filter2</td> </tr> </table> </div> </body> </html>