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.
56 lines
2.4 KiB
56 lines
2.4 KiB
<script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
|
|
<h3>Summary</h3>
|
|
<div class=tooltipinfo>
|
|
<p>Detect the level of a single tone</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 analyze</td></tr>
|
|
</table>
|
|
<h3>Functions</h3>
|
|
<p class=func><span class=keyword>frequency</span>(freq);</p>
|
|
<p class=desc>Set the frequency to detect. The default detection time
|
|
will be 10 cycles of this frequency.
|
|
</p>
|
|
<p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
|
|
<p class=desc>Set the frequency to detect, and the number of cycles.
|
|
Longer detection time (more cycles) will give higher precision,
|
|
but of course slower response.
|
|
</p>
|
|
<p class=func><span class=keyword>available</span>();</p>
|
|
<p class=desc>Returns true (non-zero) each time a detection interval
|
|
(number of cycles) completed and a new level is detected.
|
|
</p>
|
|
<p class=func><span class=keyword>read</span>();</p>
|
|
<p class=desc>Read the detected signal level. Range is 0 to 1.0.
|
|
</p>
|
|
<p class=func><span class=keyword>threshold</span>(level);</p>
|
|
<p class=desc>Set a detection threshold, where the bool test operation
|
|
will return true if at or above this level, or false when below.
|
|
</p>
|
|
<p class=func>(bool)</p>
|
|
<p class=desc>By testing the object as a boolean value, you can respond
|
|
to detection of a tone.
|
|
</p>
|
|
<h3>Examples</h3>
|
|
<p class=exam>File > Examples > Audio > Analysis > DialTone_Serial
|
|
</p>
|
|
<p class=exam>File > Examples > Audio > Analysis > DialTone_7segment
|
|
</p>
|
|
<h3>Notes</h3>
|
|
<p>Low frequency detection has trouble with numerical precision.
|
|
Works really well for all 8 DTMF frequencies, but fails for
|
|
detecting "sub audible tones" used in some control applications.</p>
|
|
<p>The (bool) test continues to return true until the next detection
|
|
interval (the configured number of cycles). This behavior may
|
|
change in future versions, for a single true each time the signal
|
|
is detected, and then false for the remainder of that interval.</p>
|
|
</script>
|
|
<script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
|
|
<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>
|
|
|
|
|