GUI: begin adding per-node HTML docs

pull/5/head
Chip Audette 8 years ago
parent 44057d28ea
commit 342b42aa10
  1. 0
      docs/audio_html/AudioAnalyzeFFT1024.html
  2. 0
      docs/audio_html/AudioAnalyzeFFT256.html
  3. 0
      docs/audio_html/AudioAnalyzeNoteFrequency.html
  4. 0
      docs/audio_html/AudioAnalyzePeak.html
  5. 0
      docs/audio_html/AudioAnalyzePrint.html
  6. 0
      docs/audio_html/AudioAnalyzeRMS.html
  7. 0
      docs/audio_html/AudioAnalyzeToneDetect.html
  8. 0
      docs/audio_html/AudioControlAK4558.html
  9. 0
      docs/audio_html/AudioControlCS4272.html
  10. 0
      docs/audio_html/AudioControlSGTL5000.html
  11. 0
      docs/audio_html/AudioControlWM8731.html
  12. 0
      docs/audio_html/AudioControlWM8731master.html
  13. 0
      docs/audio_html/AudioEffectBitcrusher.html
  14. 0
      docs/audio_html/AudioEffectChorus.html
  15. 0
      docs/audio_html/AudioEffectDelay.html
  16. 0
      docs/audio_html/AudioEffectDelayExternal.html
  17. 0
      docs/audio_html/AudioEffectEnvelope.html
  18. 0
      docs/audio_html/AudioEffectFade.html
  19. 0
      docs/audio_html/AudioEffectFlange.html
  20. 0
      docs/audio_html/AudioEffectMidSide.html
  21. 0
      docs/audio_html/AudioEffectMultiply.html
  22. 0
      docs/audio_html/AudioEffectReverb.html
  23. 0
      docs/audio_html/AudioFilterBiquad.html
  24. 0
      docs/audio_html/AudioFilterFIR.html
  25. 0
      docs/audio_html/AudioFilterStateVariable.html
  26. 0
      docs/audio_html/AudioInputAnalog.html
  27. 0
      docs/audio_html/AudioInputAnalogStereo.html
  28. 0
      docs/audio_html/AudioInputI2S.html
  29. 0
      docs/audio_html/AudioInputI2SQuad.html
  30. 0
      docs/audio_html/AudioInputI2Sslave.html
  31. 0
      docs/audio_html/AudioInputUSB.html
  32. 0
      docs/audio_html/AudioMixer4.html
  33. 0
      docs/audio_html/AudioOutputAnalog.html
  34. 0
      docs/audio_html/AudioOutputAnalogStereo.html
  35. 0
      docs/audio_html/AudioOutputI2S.html
  36. 0
      docs/audio_html/AudioOutputI2SQuad.html
  37. 0
      docs/audio_html/AudioOutputI2Sslave.html
  38. 0
      docs/audio_html/AudioOutputPT8211.html
  39. 0
      docs/audio_html/AudioOutputPWM.html
  40. 0
      docs/audio_html/AudioOutputSPDIF.html
  41. 0
      docs/audio_html/AudioOutputUSB.html
  42. 0
      docs/audio_html/AudioPlayMemory.html
  43. 0
      docs/audio_html/AudioPlayQueue.html
  44. 0
      docs/audio_html/AudioPlaySdRaw.html
  45. 0
      docs/audio_html/AudioPlaySdWav.html
  46. 0
      docs/audio_html/AudioPlaySerialflashRaw.html
  47. 0
      docs/audio_html/AudioRecordQueue.html
  48. 0
      docs/audio_html/AudioSynthKarplusStrong.html
  49. 0
      docs/audio_html/AudioSynthNoisePink.html
  50. 0
      docs/audio_html/AudioSynthNoiseWhite.html
  51. 0
      docs/audio_html/AudioSynthSimpleDrum.html
  52. 0
      docs/audio_html/AudioSynthToneSweep.html
  53. 0
      docs/audio_html/AudioSynthWaveform.html
  54. 0
      docs/audio_html/AudioSynthWaveformDc.html
  55. 0
      docs/audio_html/AudioSynthWaveformSine.html
  56. 0
      docs/audio_html/AudioSynthWaveformSineHires.html
  57. 0
      docs/audio_html/AudioSynthWaveformSineModulated.html
  58. 756
      docs/index.html
  59. 6
      docs/scripts/NewOutputs/new_nodes.txt
  60. 51
      docs/scripts/findAndLoadMatchingDoc.m
  61. 6
      docs/scripts/functions/buildNewNodes.m
  62. 71
      docs/scripts/functions/generateNodes.m
  63. 4
      docs/scripts/functions/parseAudioObjectHTML.m
  64. 2
      docs/scripts/parseIndexHTML.m
  65. 6
      docs/scripts/writeNewIndexHTML.m

@ -344,9 +344,9 @@ span.mainfunction {color: #993300; font-weight: bolder}
<script type="text/x-red" data-container-name="NodeDefinitions"> <script type="text/x-red" data-container-name="NodeDefinitions">
{"nodes":[ {"nodes":[
{"type":"AudioInputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"inputI2S","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"outputI2S","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlTLV320AIC3206","data":{"defaults":{"name":{"value":"new"}},"shortName":"tlv320aic3206","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}}, {"type":"AudioControlTLV320AIC3206","data":{"defaults":{"name":{"value":"new"}},"shortName":"tlv320aic3206","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}},
{"type":"AudioInputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioConvert_I16toF32","data":{"defaults":{"name":{"value":"new"}},"shortName":"I16toF32","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioConvert_I16toF32","data":{"defaults":{"name":{"value":"new"}},"shortName":"I16toF32","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioConvert_F32toI16","data":{"defaults":{"name":{"value":"new"}},"shortName":"F32toI16","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioConvert_F32toI16","data":{"defaults":{"name":{"value":"new"}},"shortName":"F32toI16","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioEffectCompressor_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"compressor","inputs":"1","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioEffectCompressor_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"compressor","inputs":"1","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
@ -355,7 +355,7 @@ span.mainfunction {color: #993300; font-weight: bolder}
{"type":"AudioFilterIIR_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"iir","inputs":"1","outputs":"1","category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioFilterIIR_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"iir","inputs":"1","outputs":"1","category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioMixer4_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer4","inputs":"4","outputs":"1","category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioMixer4_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer4","inputs":"4","outputs":"1","category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioMultiply_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":"2","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioMultiply_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":"2","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlSGTL5000_Extended","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000ext","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}}, {"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}},
{"type":"AudioInputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioInputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioOutputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioSynthWaveformSine_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":"0","outputs":"1","category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioSynthWaveformSine_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":"0","outputs":"1","category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
@ -363,24 +363,137 @@ span.mainfunction {color: #993300; font-weight: bolder}
]} ]}
</script> </script>
<script type="text/x-red" data-template-name="AudioInputI2S_F32 "> <script type="text/x-red" data-template-name="AudioControlTLV320AIC3206 ">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioOutputI2S_F32 "> <script type="text/x-red" data-help-name="AudioInputI2S_F32">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Receive 16 bit stereo audio from the
<a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
or another I2S device, using I2S master mode.</p>
<p align=center><img src="img/audioshield_inputs.jpg"></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>Left Channel</td></tr>
<tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
</table>
<h3>Functions</h3>
<p>This object has no functions to call from the Arduino sketch. It
simply streams data from the I2S hardware to its 2 output ports.</p>
<h3>Hardware</h3>
<p align=center><img src="img/audioshield_backside.jpg"></p>
<p>The I2S signals are used in "master" mode, where Teensy creates
all 3 clock signals and controls all data timing.</p>
<table class=doc align=center cellpadding=3>
<tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
<tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
<tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
<tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
<tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
</table>
<p>Audio from
master mode I2S may be used in the same project as ADC, DAC and
PWM signals, because all remain in sync to Teensy's timing</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
</p>
<h3>Notes</h3>
<p>Normally, this object is used with the Audio Shield, which
is controlled separately by the "sgtl5000" object.</p>
<p>Only one I2S input and one I2S output object may be used. Master
and slave modes may not be mixed (both must be of the same type).
</p>
<p>I2S master objects can be used together with non-I2S input and output
objects, for simultaneous audio streaming on different hardware.</p>
</script>
<script type="text/x-red" data-template-name="AudioInputI2S_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioControlTLV320AIC3206 ">
<script type="text/x-red" data-help-name="AudioOutputI2S_F32">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Transmit 16 bit stereo audio to the
<a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
or another I2S device, using I2S master mode.</p>
<p align=center><img src="img/audioshield_outputs.jpg"></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>Left Channel</td></tr>
<tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
</table>
<h3>Functions</h3>
<p>This object has no functions to call from the Arduino sketch. It
simply streams data from its 2 input ports to the I2S hardware.</p>
<h3>Hardware</h3>
<p align=center><img src="img/audioshield_backside.jpg"></p>
<p>The I2S signals are used in "master" mode, where Teensy creates
all 3 clock signals and controls all data timing.</p>
<table class=doc align=center cellpadding=3>
<tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
<tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
<tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
<tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
<tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
</table>
<p>Audio from
master mode I2S may be used in the same project as ADC, DAC and
PWM signals, because all remain in sync to Teensy's timing</p>
<h3>Examples</h3>
<p>Nearly all the examples use this object. Here are some of the highlights:</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
</p>
<h3>Notes</h3>
<p>Normally, this object is used with the Audio Shield, which
is controlled separately by the "sgtl5000" object.</p>
<p>Only one I2S input and one I2S output object may be used. Master
and slave modes may not be mixed (both must be of the same type).
</p>
</script>
<script type="text/x-red" data-template-name="AudioOutputI2S_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioConvert_I16toF32 "> <script type="text/x-red" data-template-name="AudioConvert_I16toF32 ">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@ -405,59 +518,676 @@ span.mainfunction {color: #993300; font-weight: bolder}
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioFilterFIR_F32 "> <script type="text/x-red" data-help-name="AudioFilterFIR_F32">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Finite impulse response filter, useful for all sorts of filtering.
</p>
<p align=center><img src="img/fir_filter.png"></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 be filtered</td></tr>
<tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
</table>
<h3>Functions</h3>
<p class=func><span class=keyword>begin</span>(array, length);</p>
<p class=desc>Initialize the filter. The array must be 16 bit integers (the
filter's impulse response), and
length indicates the number of points in the array. Array may also be
FIR_PASSTHRU (length = 0), to directly pass the input to output without
filtering.
</p>
<p class=func><span class=keyword>end</span>();</p>
<p class=desc>Turn the filter off.
</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
</p>
<h3>Known Issues</h3>
<p>Your filter's impulse response array must have an even length. If you have
add odd number of taps, you must add an extra zero to increase the length
to an even number.
</p>
<p>The minimum number of taps is 4. If you use less, add extra zeros to increase
the length to 4.
</p>
<p>The impulse response must be given in reverse order. Many filters have
symetrical impluse response, making this a non-issue. If your filter has
a non-symetrical response, make sure the data is in reverse time order.
</p>
<h3>Notes</h3>
<p>FIR filters requires more CPU time than Biquad (IIR), but they can
implement filters with better phase response.
</p>
<p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
supported filter length is 200 points.
</p>
<p>The free
<a href="http://t-filter.engineerjs.com/" target="_blank"> TFilter Design Tool</a>
can be used to create the impulse response array. Be sure to set the sampling
frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
</p>
<p>
If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
and add "const" to avoid consuming extra RAM.
</p>
</script>
<script type="text/x-red" data-template-name="AudioFilterFIR_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioFilterIIR_F32 "> <script type="text/x-red" data-template-name="AudioFilterIIR_F32 ">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioMixer4_F32 "> <script type="text/x-red" data-help-name="AudioMixer4_F32">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Combine up to 4 audio signals together, each with adjustable gain.
All channels support signal attenuation or amplification.</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>Input signal #1</td></tr>
<tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
<tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
<tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
<tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
</table>
<h3>Functions</h3>
<p class=func><span class=keyword>gain</span>(channel, level);</p>
<p class=desc>Adjust the amplification or attenuation. "channel" must
be 0 to 3. "level" may be any floating point number from 0 to 32767.
1.0 passes the signal through directly. Level of 0 shuts the channel
off completely. Between 0 to 1.0 attenuates the signal, and above
1.0 amplifies it. All 4 channels have separate settings.
</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
</p>
<h3>Notes</h3>
<p>Signal clipping can occur when any channel has gain greater than 1.0,
or when multiple signals add together to greater than 1.0.</p>
<p>More than 4 channels may be combined by connecting multiple mixers
in tandem. For example, a 16 channel mixer may be built using 5
mixers, where the fifth mixer combines the outputs of the first 4.
</p>
</script>
<script type="text/x-red" data-template-name="AudioMixer4_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioMultiply_F32 "> <script type="text/x-red" data-template-name="AudioMultiply_F32 ">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioControlSGTL5000_Extended "> <script type="text/x-red" data-help-name="AudioControlSGTL5000">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Control the SGTL5000 chip on the
<a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
SGTL5000 is always used in slave mode, where Teensy controls
all I2S timing.
</p>
<p align=center><img src="img/sgtl5000closeup.jpg"></p>
</div>
<h3>Audio Connections</h3>
<p>This object has no audio inputs or outputs. Separate i2s objects
are used to send and receive audio data. I2S master mode objects
must be used, because this object configures the SGTL5000 in slave
mode, where it depends on Teensy to provide all I2S clocks.
This object controls
how the SGTL5000 will use those I2S audio streams.</p>
<h3>Functions</h3>
<p>These are the most commonly used SGTL5000 functions.</p>
<p class=func><span class=keyword>enable</span>();</p>
<p class=desc>Start the SGTL5000. This function should be called first.
</p>
<p class=func><span class=keyword>volume</span>(level);</p>
<p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
0.8 corresponds to the maximum undistorted output for a full scale
signal. Usually 0.5 is a comfortable listening level. The line
level outputs are <em>not</em> changed by this function.
</p>
<p class=func><span class=keyword>inputSelect</span>(input);</p>
<p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
</p>
<p class=func><span class=keyword>micGain</span>(dB);</p>
<p class=desc>When using the microphone input, set the amplifier gain.
The input number is in decibels, from 0 to 63.
</p>
<h3>Signal Levels</h3>
<p>The default signal levels should be used for most applications,
but these functions allow you to customize the analog signals.</p>
<p class=func><span class=keyword>muteHeadphone</span>();</p>
<p class=desc>Silence the headphone output.
</p>
<p class=func><span class=keyword>unmuteHeadphone</span>();</p>
<p class=desc>Turn the headphone output on.
</p>
<p class=func><span class=keyword>muteLineout</span>();</p>
<p class=desc>Silence the line level outputs.
</p>
<p class=func><span class=keyword>unmuteLineout</span>();</p>
<p class=desc>Turn the line level outputs on.
</p>
<p class=func><span class=keyword>lineInLevel</span>(both);</p>
<p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
Fifteen settings are possible:
</p>
<pre class="desc">
0: 3.12 Volts p-p
1: 2.63 Volts p-p
2: 2.22 Volts p-p
3: 1.87 Volts p-p
4: 1.58 Volts p-p
5: 1.33 Volts p-p (default)
6: 1.11 Volts p-p
7: 0.94 Volts p-p
8: 0.79 Volts p-p
9: 0.67 Volts p-p
10: 0.56 Volts p-p
11: 0.48 Volts p-p
12: 0.40 Volts p-p
13: 0.34 Volts p-p
14: 0.29 Volts p-p
15: 0.24 Volts p-p
</pre>
<p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
<p class=desc>Adjust the sensitivity of the line-level inputs, with different
settings for left and right. The same 15 settings are available.
</p>
<p class=func><span class=keyword>lineOutLevel</span>(both);</p>
<p class=desc style="padding-bottom:0.2em;">Adjust the line level output
voltage range. The following settings are possible:
</p>
<pre class="desc">
13: 3.16 Volts p-p
14: 2.98 Volts p-p
15: 2.83 Volts p-p
16: 2.67 Volts p-p
17: 2.53 Volts p-p
18: 2.39 Volts p-p
19: 2.26 Volts p-p
20: 2.14 Volts p-p
21: 2.02 Volts p-p
22: 1.91 Volts p-p
23: 1.80 Volts p-p
24: 1.71 Volts p-p
25: 1.62 Volts p-p
26: 1.53 Volts p-p
27: 1.44 Volts p-p
28: 1.37 Volts p-p
29: 1.29 Volts p-p (default)
30: 1.22 Volts p-p
31: 1.16 Volts p-p
</pre>
<p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
<p class=desc>Adjust the line level outout voltage range, with separate
settings for left and right. The same settings (13 to 31) are available.
</p>
<h3>Signal Conditioning</h3>
<p>Usually these digital signal conditioning features should be left at their
default settings.
</p>
<p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
<p class=desc>By default, the analog input (either line-level inputs or mic)
is high-pass filtered, to remove any DC component. This function
freezes the filter, so the current DC component is still substracted, but
the filter stops tracking any DC or low frequency changes.
</p>
<p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
<p class=desc>Completely disable the analog input filter. DC and sub-audible
low frequencies are allowed to enter the digital signal.
</p>
<p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
<p class=desc>Turn the DC-blocking filter back on, if disabled, or
allows it to resume tracking DC and low frequency changes, if
previously frozen. This is the default setting.
</p>
<p class=func><span class=keyword>dacVolume</span>(both);</p>
<p class=desc>Normally output volume should be used with volume(), which
changes the analog gain in the headphone amplifier. This function
on the other hand controls digital attenuation before conversion to analog, which
reduces resolution, but allows another fine control of output
signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
at 1.0.
</p>
<p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and graceful
ramping is handled by the chip so that a new volume may be set directly in
a single call.
</p>
<p class=func><span class=keyword>dacVolume</span>(left, right);</p>
<p class=desc>Adjust the digital output volume separately on left and
right channels.
</p>
<p class=func><span class=keyword>dacVolumeRamp</span>();</p>
<p class=desc>Enable graceful volume ramping. The dacVolume adjusts gradually using
an exponential curve. Pops or loud clicks are avoided when making large
changes in volume level.
</p>
<p class=func><span class=keyword>dacVolumeRampLinear</span>();</p>
<p class=desc>Enable faster volume ramping. A slight click may be heard during a
large volume change.
</p>
<p class=func><span class=keyword>dacVolumeRampDisable</span>();</p>
<p class=desc>Do not use any gradual ramping. The zero cross feature still helps
for small changes, but large volume changes may produce a pop or click.
</p>
<h3>Audio Processor</h3>
<p>The optional digital audio processor is capable of implementing
one or more of: automatic volume control, surround sound control,
bass enhancement, and tonal adjustments (either a
simple tone control, or a parametric equalizer, or a graphic equalizer),
in that order.
</p>
<p>These signal processing features are implemented in the SGTL5000 chip,
so they do not consume CPU time on Teensy. However, the order of
these processes is fixed in the hardware.
</p>
<p>It is good practice to mute the outputs before enabling or disabling
the Audio Processor, to avoid clicks or thumps.
</p>
<p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
<p class=desc>Enable the audio processor to pre-process the input
(from either line-level inputs or microphone) before it's sent
to Teensy by I2S.
</p>
<p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
<p class=desc>Enable the audio processor to post-process Teensy's
I2S output before it's turned into analog signals for the
headphones and/or line level outputs.
</p>
<p class=func><span class=keyword>audioProcessorDisable</span>();</p>
<p class=desc>Disable the audio processor.
</p>
<p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
<p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
as 2. <em>response</em> controls the integration time for the compressor and can take
four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
over a longer time, allowing short-term peaks through.
</p>
<p class=desc>If <em>hardLimit</em> is 0, a 'soft
knee' compressor is used to progressively compress louder values which are near to or above the
threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
<em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
drops below threashold, again in dB/s. It is typically set to a longer value than attack.
</p>
<p class=func><span class=keyword>autoVolumeEnable</span>();</p>
<p class=desc>Enables auto volume control, using the previously specified settings.
</p>
<p class=func><span class=keyword>autoVolumeDisable</span>();</p>
<p class=desc>Disables auto volume control.
</p>
<p class=func><span class=keyword>surroundSoundEnable</span>();</p>
<p class=desc>Enable virtual surround processing, to give a broader and
deeper stereo image (even with mono input).
</p>
<p class=func><span class=keyword>surroundSoundDisable</span>();</p>
<p class=desc>Disable virtual surround processing. Before disabling, ramp up
the width to maximum to avoid pops.
</p>
<p class=func><span class=keyword>surroundSound</span>(width);</p>
<p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
</p>
<p class=func><span class=keyword>surroundSound</span>(width, select);</p>
<p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
<em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
</p>
<p class=func><span class=keyword>enhanceBassEnable</span>();</p>
<p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
the original stereo signal has bass levels boosted and is then mixed back into
the stereo signal, which is then optionally high pass filtered (to remove
inaudible subsonic frequencies).
</p>
<p class=func><span class=keyword>enhanceBassDisable</span>();</p>
<p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
enhancement level to zero.
</p>
<p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
<p class=desc>Configures the bass enhancement by setting the levels of the
original stereo signal and the bass-enhanced mono level which will be mixed together.
There is no high-pass filter.
</p>
<p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
steps of 0.5dB, to avoid pops.
</p>
<p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
<p class=desc>Configures the bass enhancement by setting the levels of the
original stereo signal and the bass-enhanced mono level which will be mixed together.
The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
as follows:
</p>
<pre class="desc">
value frequency
0 80Hz
1 100Hz
2 125Hz
3 150Hz
4 175Hz
5 200Hz
6 225Hz
</pre>
<p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
steps of 0.5dB, to avoid pops.
</p>
<p class=func><span class=keyword>eqSelect</span>(n);</p>
<p class=desc>Selects the type of frequency control, where <em>n</em> is
one of</p>
<p class=desc><b>FLAT_FREQUENCY (0)</b><br>
Equalizers and tone controls disabled, flat frequency response.</p>
<p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
Enables the 7-band parametric equalizer, thus disabling the
tone controls and graphic equalizer.</p>
<p class=desc><b>TONE_CONTROLS (2)</b><br>
Enables bass and treble tone controls, disabling the parametric
equalization and graphic equalizer.</p>
<p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
Enables the five-band graphic equalizer, disabling the parametric
equalization and tone controls.</p>
<p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
<p class=desc>Configures bass and treble tone controls, which are
implemented as one second order low pass filter (bass) in parallel with
one second order high pass filter (treble).
</p>
<p class=desc>When changing bass or treble level, call this function repeatedly to ramp
up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
</p>
<p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
<p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
</p>
<p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
<p class=desc>Configures the gain or cut on one band in the graphic equalizer.
<em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
</p>
<p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
to avoid pops.
</p>
<p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
<p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
is specified along with a pointer to an array of filter coefficients.
The parametric equalizer is implemented using 7 cascaded, second order bi-quad
filters whose frequencies, gain, and Q may be freely configured, but each filter
can only be specified as a set of filter coefficients.
</p>
<p class=func><span class=keyword>eqFilterCount</span>(n);</p>
<p class=desc>Enables zero or more of the already enabled parametric filters.
</p>
<h3>Examples</h3>
<p>Nearly all of the library's examples use this object. These
examples demonstrate its special features.
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; VolumeRamp
</p>
<h3>Notes</h3>
<p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
and surround enhancement while speech uses bandpass filtering and auto volume control
compression.
</p>
<p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
</p>
</script>
<script type="text/x-red" data-template-name="AudioControlSGTL5000">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioInputUSB ">
<script type="text/x-red" data-help-name="AudioInputUSB">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Receive stereo audio from a PC or Mac. Teensy appears as a USB
sound device.</p>
<p align=center><img src="img/usbtype_audio_in.png"></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>Left Channel</td></tr>
<tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
</table>
<h3>Functions</h3>
<p>This object has no functions to call from the Arduino sketch. It
simply streams data from the USB to its 2 output ports.</p>
<!--
<h3>Hardware</h3>
-->
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughUSB</p>
</p>
<h3>Notes</h3>
<p>Arduino's <b>Tools &gt; USB Type</b> menu must be set to <b>Audio</b>.
</p>
<p align=center><img src="img/usbtype_audio.png"></p>
<p>USB input &amp; output does not cause the Teensy Audio Library to
update. At least one non-USB input or output object must be
present for the entire library to update properly.</p>
<p>A known problem exists with USB audio from Macintosh computers.
An imperfect <a href="https://forum.pjrc.com/threads/34855-Distorted-audio-when-using-USB-input-on-Teensy-3-1?p=110392&viewfull=1#post110392">workaround
can be enabled by editing usb_audio.cpp</a>.
Find and uncomment "#define MACOSX_ADAPTIVE_LIMIT".</p>
</script>
<script type="text/x-red" data-template-name="AudioInputUSB">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioOutputUSB ">
<script type="text/x-red" data-help-name="AudioOutputUSB">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Send stereo audio to a PC or Mac. Teensy appears as a USB
sound device.</p>
<p align=center><img src="img/usbtype_audio_out.png"></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>Left Channel</td></tr>
<tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
</table>
<h3>Functions</h3>
<p>This object has no functions to call from the Arduino sketch. It
simply streams from it's 2 input ports to the USB.</p>
<!--
<h3>Hardware</h3>
-->
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WavFilePlayerUSB</p>
</p>
<h3>Notes</h3>
<p>Arduino's <b>Tools &gt; USB Type</b> menu must be set to <b>Audio</b>.
</p>
<p align=center><img src="img/usbtype_audio.png"></p>
<p>USB input &amp; output does not cause the Teensy Audio Library to
update. At least one non-USB input or output object must be
present for the entire library to update properly.</p>
<p>A known problem exists with USB audio from Macintosh computers.
An imperfect <a href="https://forum.pjrc.com/threads/34855-Distorted-audio-when-using-USB-input-on-Teensy-3-1?p=110392&viewfull=1#post110392">workaround
can be enabled by editing usb_audio.cpp</a>.
Find and uncomment "#define MACOSX_ADAPTIVE_LIMIT".</p>
</script>
<script type="text/x-red" data-template-name="AudioOutputUSB">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioSynthWaveformSine_F32 ">
<script type="text/x-red" data-help-name="AudioSynthWaveformSine_F32">
<h3>Summary</h3>
<div class=tooltipinfo>
<p>Create a sine wave signal</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>Sine Wave Output</td></tr>
</table>
<h3>Functions</h3>
<p class=func><span class=keyword>amplitude</span>(level);</p>
<p class=desc>Set the amplitude, from 0 to 1.0.
</p>
<p class=func><span class=keyword>frequency</span>(freq);</p>
<p class=desc>Set the frequency, from 0 to 22000. Very low values may
be used to create a LFO (Low Frequency Oscillator) for objects
with modulation signal inputs.
</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>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
</p>
<h3>Notes</h3>
<p></p>
</script>
<script type="text/x-red" data-template-name="AudioSynthWaveformSine_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="AudioSynthWaveform_F32 ">
<script type="text/x-red" data-help-name="AudioSynthWaveform_F32">
<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 &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
</p>
<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; 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_F32">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
</div> </div>
</script> </script>
</body> </body>
</html> </html>

@ -1,6 +1,6 @@
{"type":"AudioInputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"inputI2S","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"outputI2S","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlTLV320AIC3206","data":{"defaults":{"name":{"value":"new"}},"shortName":"tlv320aic3206","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}}, {"type":"AudioControlTLV320AIC3206","data":{"defaults":{"name":{"value":"new"}},"shortName":"tlv320aic3206","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}},
{"type":"AudioInputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputI2S_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioConvert_I16toF32","data":{"defaults":{"name":{"value":"new"}},"shortName":"I16toF32","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioConvert_I16toF32","data":{"defaults":{"name":{"value":"new"}},"shortName":"I16toF32","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioConvert_F32toI16","data":{"defaults":{"name":{"value":"new"}},"shortName":"F32toI16","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioConvert_F32toI16","data":{"defaults":{"name":{"value":"new"}},"shortName":"F32toI16","inputs":"1","outputs":"1","category":"convert-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioEffectCompressor_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"compressor","inputs":"1","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioEffectCompressor_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"compressor","inputs":"1","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
@ -9,7 +9,7 @@
{"type":"AudioFilterIIR_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"iir","inputs":"1","outputs":"1","category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioFilterIIR_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"iir","inputs":"1","outputs":"1","category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioMixer4_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer4","inputs":"4","outputs":"1","category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioMixer4_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer4","inputs":"4","outputs":"1","category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioMultiply_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":"2","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioMultiply_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":"2","outputs":"1","category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlSGTL5000_Extended","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000ext","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}}, {"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":"0","outputs":"0","category":"control-function","color":"#E6E0F8","icon":"debug.png"}},
{"type":"AudioInputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioInputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioIn","inputs":"0","outputs":"2","category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioOutputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioOutputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usbAudioOut","inputs":"2","outputs":"0","category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioSynthWaveformSine_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":"0","outputs":"1","category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}}, {"type":"AudioSynthWaveformSine_F32","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":"0","outputs":"1","category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},

@ -0,0 +1,51 @@
function all_lines = findAndLoadMatchingDoc(node_name,dir_f32,dir_orig)
all_lines={};
%look first in the f32 directory
fnames = dir([dir_f32 node_name '.html']);
if isempty(fnames); fnames = dir([dir_orig node_name '.html']);end
%maybe this is an f32 version of an original module
modify_html_for_f32=0;
if isempty(fnames);
if (node_name(end-3:end) == '_F32')
fnames = dir([dir_orig node_name(1:end-4) '.html']);
modify_html_for_f32=1;
end
end
if isempty(fnames)
return;
end
if length(fnames) > 1
disp(['*** WARNING ***: findAndLoadMatchingDoc: more than one HTML file found for ' node_name]);
for I=1:length(fnames)
disp([' : ' fnames(I).name]);
end
disp([' : Using first one.']);
end
%load the file
all_lines = readAllLines([fnames(1).folder '\' fnames(1).name]);
%adjust as needed
if modify_html_for_f32
name_as_orig = node_name(1:end-4);
for Iline=1:length(all_lines)
line = all_lines{Iline};
I=strfind(line,name_as_orig);
if ~isempty(I)
new_line = [];
if (I(1) > 1)
new_line = [new_line line(1:I(1)-1)];
end
new_line = [new_line node_name];
new_line = [new_line line((I(1)+length(name_as_orig)):end)];
all_lines{Iline}=new_line;
end
end
end

@ -256,6 +256,12 @@ for Iname=1:length(class_names)
if strcmpi(name,'sgtl5000_extended') if strcmpi(name,'sgtl5000_extended')
name = 'sgtl5000ext'; name = 'sgtl5000ext';
end end
if strcmpi(name,'inputI2S')
name = 'i2sAudioIn';
end
if strcmpi(name,'outputI2S')
name = 'i2sAudioOut';
end
%strop off leading space or underscore %strop off leading space or underscore
while( (name(1) == ' ') | (name(1) == '_')); name=name(2:end); end while( (name(1) == ' ') | (name(1) == '_')); name=name(2:end); end

@ -19,7 +19,7 @@ addpath('functions\');
%% read existing node file and get the nodes %% read existing node file and get the nodes
orig_nodes = parseNodeFile(origNode_fname); orig_nodes = parseNodeFile(origNode_fname);
% keep just a subsete of the nodes % keep just a subset of the nodes
% nodes_keep = {'AudioInputI2S','AudioInputUSB',... % nodes_keep = {'AudioInputI2S','AudioInputUSB',...
% 'AudioOutputI2S','AudioOutputUSB',... % 'AudioOutputI2S','AudioOutputUSB',...
% 'AudioPlaySdWav',... % 'AudioPlaySdWav',...
@ -35,9 +35,11 @@ orig_nodes = parseNodeFile(origNode_fname);
% 'AudioPlayQueue','AudioRecordQueue',... % 'AudioPlayQueue','AudioRecordQueue',...
% 'AudioAnalyzePeak','AudioAnalyzeRMS'}; % 'AudioAnalyzePeak','AudioAnalyzeRMS'};
nodes_keep = {'AudioInputUSB',... nodes_keep = {
'AudioControlSGTL5000',...
'AudioInputUSB',...
'AudioOutputUSB',... 'AudioOutputUSB',...
}; };
%adjust node shortnames %adjust node shortnames
for Inode=1:length(orig_nodes) for Inode=1:length(orig_nodes)
@ -50,6 +52,14 @@ for Inode=1:length(orig_nodes)
orig_nodes(Inode)=node; orig_nodes(Inode)=node;
end end
%adjust node icons
for Inode=1:length(orig_nodes)
node = orig_nodes(Inode);
if strcmpi(node.type,'AudioControlSGTL5000')
node.icon = 'debug.png';
end
orig_nodes(Inode)=node;
end
%keep just these %keep just these
nodes=[]; nodes=[];
@ -96,28 +106,39 @@ for Inode = 1:size(new_node_data,1)
nodes(end+1) = node; nodes(end+1) = node;
end end
end end
clear new_node_data
%% sort the nodes
%remove some undesired nodes
%put tlv before sgtl remove_names = {'AudioControlSGTL5000_Extended'};
all_names = {nodes(:).shortName}; Ikeep = ones(size(nodes));
I = find(strcmpi(all_names,'tlv320aic3206'));tlv_node = nodes(I); for Irem=1:length(remove_names)
J = find(strcmpi(all_names,'sgtl5000ext')); sgtl_node = nodes(J); for Inode = 1:length(Ikeep)
nodes(min([I(1) J(1)])) = tlv_node; %this comes first if strcmpi(nodes(Inode).type,remove_names{Irem})
nodes(max([I(1) J(1)])) = sgtl_node; %this comes second Ikeep(Inode)=0;
end
% put i2s before USB end
all_names = {nodes(:).shortName}; end
I = find(strcmpi(all_names,'inputI2S'));first_node = nodes(I); Ikeep = find(Ikeep);
J = find(strcmpi(all_names,'usbAudioIn')); second_node = nodes(J); nodes = nodes(Ikeep);
nodes(min([I(1) J(1)])) = first_node; %this comes first
nodes(max([I(1) J(1)])) = second_node; %this comes second %% put some of the nodes into a particular desired order
first_second = {};
all_names = {nodes(:).shortName}; first_second(end+1,:) ={'tlv320aic3206' 'sgtl5000'};
I = find(strcmpi(all_names,'outputI2S'));first_node = nodes(I); first_second(end+1,:) ={'inputI2S' 'usbAudioIn'};
J = find(strcmpi(all_names,'usbAudioOut')); second_node = nodes(J); first_second(end+1,:) ={'outputI2S' 'usbAudioOut'};
nodes(min([I(1) J(1)])) = first_node; %this comes first first_second(end+1,:) ={'i2sAudioIn' 'usbAudioIn'};
nodes(max([I(1) J(1)])) = second_node; %this comes second first_second(end+1,:) ={'i2sAudioOut' 'usbAudioOut'};
for Iswap = 1:length(first_second);
all_names = {nodes(:).shortName};
I = find(strcmpi(all_names,first_second{Iswap,1}));
J = find(strcmpi(all_names,first_second{Iswap,2}));
if ~isempty(I) & ~isempty(J)
first_node = nodes(I); second_node = nodes(J);
nodes(min([I(1) J(1)])) = first_node; %this comes first
nodes(max([I(1) J(1)])) = second_node; %this comes second
end
end
%% write new nodes %% write new nodes
if ~isempty(outfname) if ~isempty(outfname)

@ -1,4 +1,4 @@
function all_docs = parseDocsFile(fname,outpname); function all_docs = parseAudioObjectHTML(fname,outpname);
if nargin < 2 if nargin < 2
outpname = 'NodeDocs\'; outpname = 'NodeDocs\';
@ -50,7 +50,7 @@ for Idoc = 1:length(row_inds)-1
name_str = name_str((I(1)+1):(I(2)-1)); name_str = name_str((I(1)+1):(I(2)-1));
%write doc %write doc
outfname = [outpname name_str '.txt']; outfname = [outpname name_str '.html'];
writeText(outfname,node_doc); writeText(outfname,node_doc);
%add to data structure %add to data structure

@ -88,7 +88,7 @@ outfname = 'ParsedInputs\node_docs.txt';
writeText(outfname,textToWrite); writeText(outfname,textToWrite);
%% parse the docs and write the invidiual docs %% parse the docs and write the invidiual docs
all_docs = parseDocsFile(outfname,'ParsedNodeDocs\'); all_docs = parseAudioObjectHTML(outfname,'..\audio_html\');
%% extract the end of the file %% extract the end of the file
outfname = 'ParsedInputs\end_of_file.txt'; outfname = 'ParsedInputs\end_of_file.txt';

@ -36,7 +36,13 @@ all_lines(end+[1:length(foo_lines)]) = foo_lines; %accumulate the lines
% assemble the docs % assemble the docs
for Inode = 1:length(nodes) for Inode = 1:length(nodes)
dir_f32 = '..\audio_f32_html\';
dir_orig = '..\audio_html\';
foo_lines = findAndLoadMatchingDoc(nodes(Inode).type,dir_f32,dir_orig);
if isempty(foo_lines)
foo_lines = createEmptyDoc(nodes(Inode).type); foo_lines = createEmptyDoc(nodes(Inode).type);
end
all_lines(end+[1:length(foo_lines)]) = foo_lines; all_lines(end+[1:length(foo_lines)]) = foo_lines;
end end

Loading…
Cancel
Save