You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
3.0 KiB
67 lines
3.0 KiB
<script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
|
|
<h3>Summary</h3>
|
|
<div class=tooltipinfo>
|
|
<p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
|
|
with real value (magnitude) output. The frequency resolution is
|
|
172 Hz, useful for simple audio visualization.</p>
|
|
</div>
|
|
<h3>Audio Connections</h3>
|
|
<table class=doc align=center cellpadding=3>
|
|
<tr class=top><th>Port</th><th>Purpose</th></tr>
|
|
<tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
|
|
</table>
|
|
<h3>Functions</h3>
|
|
<p class=func><span class=keyword>available</span>();</p>
|
|
<p class=desc>Returns true each time the FFT analysis produces new output data.
|
|
</p>
|
|
<p class=func><span class=keyword>read</span>(binNumber);</p>
|
|
<p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
|
|
so 1.0 represents a full scale sine wave.
|
|
</p>
|
|
<p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
|
|
<p class=desc>Read several frequency bins, returning their sum. The higher
|
|
audio octaves are represented by many bins, which are typically read
|
|
as a group for audio visualization.
|
|
</p>
|
|
<p class=func><span class=keyword>averageTogether</span>(number);</p>
|
|
<p class=desc>New data is produced very radidly, approximately 344 times
|
|
per second. Multiple outputs can be averaged together, so available()
|
|
returns true at a slower rate.
|
|
</p>
|
|
<p class=func><span class=keyword>windowFunction</span>(window);</p>
|
|
<p class=desc>Set the window function to be used. AudioWindowHanning256
|
|
is the default. Windowing may be disabled by NULL, but windowing
|
|
should be used for all non-periodic (music) signals, and all periodic
|
|
signals that are not exact integer division of the sample rate.
|
|
</p>
|
|
|
|
<h3>Examples</h3>
|
|
<p class=exam>File > Examples > Audio > MemoryAndCpuUsage
|
|
</p>
|
|
<h3>Notes</h3>
|
|
<p>The raw 16 bit output data bins may be access with myFFT.output[num], where
|
|
num is 0 to 127.</p>
|
|
<p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
|
|
<p>Window Types:
|
|
<ul>
|
|
<li><span class=literal>AudioWindowHanning256</span> (default)</li>
|
|
<li><span class=literal>AudioWindowBartlett256</span></li>
|
|
<li><span class=literal>AudioWindowBlackman256</span></li>
|
|
<li><span class=literal>AudioWindowFlattop256</span></li>
|
|
<li><span class=literal>AudioWindowBlackmanHarris256</span></li>
|
|
<li><span class=literal>AudioWindowNuttall256</span></li>
|
|
<li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
|
|
<li><span class=literal>AudioWindowWelch256</span></li>
|
|
<li><span class=literal>AudioWindowHamming256</span></li>
|
|
<li><span class=literal>AudioWindowCosine256</span></li>
|
|
<li><span class=literal>AudioWindowTukey256</span></li>
|
|
</ul>
|
|
</p>
|
|
</script>
|
|
<script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
</div>
|
|
</script>
|
|
|
|
|