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.
70 lines
2.9 KiB
70 lines
2.9 KiB
<script type="text/x-red" data-help-name="AudioSynthWaveform">
|
|
<h3>Summary</h3>
|
|
<div class=tooltipinfo>
|
|
<p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</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>Out 0</td><td>Waveform Output</td></tr>
|
|
</table>
|
|
<h3>Functions</h3>
|
|
<p class=func><span class=keyword>begin</span>(waveform);</p>
|
|
<p class=desc>Configure the waveform type to create.
|
|
</p>
|
|
<p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
|
|
<p class=desc>Output a waveform, and set the amplitude and frequency.
|
|
</p>
|
|
<p class=func><span class=keyword>frequency</span>(freq);</p>
|
|
<p class=desc>Change the frequency.
|
|
</p>
|
|
<p class=func><span class=keyword>amplitude</span>(level);</p>
|
|
<p class=desc>Change the amplitude. Set to 0 to turn the signal off.
|
|
</p>
|
|
<p class=func><span class=keyword>phase</span>(angle);</p>
|
|
<p class=desc>
|
|
Cause the generated waveform to jump to a specific point within
|
|
its cycle. Angle is from 0 to 360 degrees. When multiple objects
|
|
are configured,
|
|
<a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
|
|
should be used to guarantee all new settings take effect together.
|
|
</p>
|
|
<p class=func><span class=keyword>pulseWidth</span>(amount);</p>
|
|
<p class=desc>Change the width (duty cycle) of the pulse.</p>
|
|
<p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
|
|
<p class=desc>
|
|
Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
|
|
must be an array of 256 samples. Currently, the data is used
|
|
without any filtering, which can cause aliasing with frequencies
|
|
above 172 Hz. For higher frequency output, you must bandwidth
|
|
limit your waveform data. Someday, "maxFreq" will be used to
|
|
do this automatically.
|
|
</p>
|
|
<h3>Examples</h3>
|
|
<p class=exam>File > Examples > Audio > Synthesis > PlaySynthMusic
|
|
</p>
|
|
<p class=exam>File > Examples > Audio > Synthesis > pulseWidth
|
|
</p>
|
|
<p class=exam>File > Examples > Audio > HardwareTesting > WM8731MikroSine
|
|
</p>
|
|
<h3>Notes</h3>
|
|
<p>Supported Waveforms:<br>
|
|
<ul>
|
|
<li><span class=literal>WAVEFORM_SINE</span></li>
|
|
<li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
|
|
<li><span class=literal>WAVEFORM_SAWTOOTH_REVERSE</span></li>
|
|
<li><span class=literal>WAVEFORM_SQUARE</span></li>
|
|
<li><span class=literal>WAVEFORM_TRIANGLE</span></li>
|
|
<li><span class=literal>WAVEFORM_ARBITRARY</span></li>
|
|
<li><span class=literal>WAVEFORM_PULSE</span></li>
|
|
<li><span class=literal>WAVEFORM_SAMPLE_HOLD</span></li>
|
|
</ul>
|
|
</p>
|
|
</script>
|
|
<script type="text/x-red" data-template-name="AudioSynthWaveform">
|
|
<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>
|
|
|
|
|