選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

2582 行
97KB

  1. <!-- vim: set ts=4: -->
  2. <!-- TODO: generate some or all of this automatically from the C++ source -->
  3. <!-- TODO: add a field for maximum instance count -->
  4. <!-- TODO: add a field for exclusive to other objects (not allowed if they're used) -->
  5. <!-- TODO: add "parameters" fields, to replace the form html stuff -->
  6. <script type="text/javascript">
  7. RED.nodes.registerType('AudioInputI2S',{
  8. shortName: "i2s",
  9. inputs:0,
  10. outputs:2,
  11. category: 'input-function',
  12. color:"#E6E0F8",
  13. icon: "arrow-in.png"
  14. });
  15. </script>
  16. <script type="text/x-red" data-help-name="AudioInputI2S">
  17. <h3>Summary</h3>
  18. <p>Receive 16 bit stereo audio from the
  19. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  20. or another I2S device, using I2S master mode.</p>
  21. <p align=center><img src="audioshield_inputs.jpg"></p>
  22. <h3>Audio Connections</h3>
  23. <table class=doc align=center cellpadding=3>
  24. <tr class=top><th>Port</th><th>Purpose</th></tr>
  25. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  26. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  27. </table>
  28. <h3>Functions</h3>
  29. <p>This object has no functions to call from the Arduino sketch. It
  30. simply streams data from the I2S hardware to its 2 output ports.</p>
  31. <h3>Hardware</h3>
  32. <p align=center><img src="audioshield_backside.jpg"></p>
  33. <p>The I2S signals are used in "master" mode, where Teensy creates
  34. all 3 clock signals and controls all data timing.</p>
  35. <table class=doc align=center cellpadding=3>
  36. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  37. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  38. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  39. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  40. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  41. </table>
  42. <p>Audio from
  43. master mode I2S may be used in the same project as ADC, DAC and
  44. PWM signals, because all remain in sync to Teensy's timing</p>
  45. <h3>Examples</h3>
  46. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  47. </p>
  48. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  49. </p>
  50. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  51. </p>
  52. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  53. </p>
  54. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  55. </p>
  56. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  57. </p>
  58. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  59. </p>
  60. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  61. </p>
  62. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  63. </p>
  64. <h3>Notes</h3>
  65. <p>Normally, this object is used with the Audio Shield, which
  66. is controlled separately by the "sgtl5000" object.</p>
  67. <p>Only one I2S input and one I2S output object may be used. Master
  68. and slave modes may not be mixed (both must be of the same type).
  69. </p>
  70. <p>I2S master objects can be used together with non-I2S input and output
  71. objects, for simultaneous audio streaming on different hardware.</p>
  72. </script>
  73. <script type="text/x-red" data-template-name="AudioInputI2S">
  74. <div class="form-row">
  75. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  76. <input type="text" id="node-input-name" placeholder="Name">
  77. </div>
  78. </script>
  79. <script type="text/javascript">
  80. RED.nodes.registerType('AudioInputAnalog',{
  81. shortName: "adc",
  82. inputs:0,
  83. outputs:1,
  84. category: 'input-function',
  85. color:"#E6E0F8",
  86. icon: "arrow-in.png"
  87. });
  88. </script>
  89. <script type="text/x-red" data-help-name="AudioInputAnalog">
  90. <h3>Summary</h3>
  91. <p>Receive audio using the built-in analog to digital converter.</p>
  92. <h3>Audio Connections</h3>
  93. <table class=doc align=center cellpadding=3>
  94. <tr class=top><th>Port</th><th>Purpose</th></tr>
  95. <tr class=odd><td align=center>Out 0</td><td>Audio Channel</td></tr>
  96. </table>
  97. <h3>Functions</h3>
  98. <p>This object has no functions to call from the Arduino sketch. It
  99. simply streams data from the ADC to its output port.</p>
  100. <h3>Hardware</h3>
  101. <p>Pin A2 is used for audio input. This circuitry is recommended.</p>
  102. <p align=center><img src="adccircuit.png"></p>
  103. <p>Signal range is 0 to 1.2V</p>
  104. <h3>Examples</h3>
  105. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  106. </p>
  107. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  108. </p>
  109. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  110. </p>
  111. <h3>Notes</h3>
  112. <p>A different pin may be used, but adding it as an parameter
  113. to the AudioInputAnalog object definition.
  114. </p>
  115. <p>For example, to use pin A3:
  116. </p>
  117. <p class=desc><span class=keyword>AudioInputAnalog</span> adc1(<span class=literal>A3</span>);
  118. </p>
  119. <p>Noise due to high source impedance, which allows rapidly switching digital signals
  120. to capacitively couple... avoiding higher analog impedance is the solution.</p>
  121. <p>Power Supply rejection issue with simple DC bias (bigger capacitor may be needed if 3.3V has low frequency noise)</p>
  122. <p>Algorithm for automatic DC bias tracking</p>
  123. <p>TODO: actual noise measurements with different input circuitry
  124. (it's not as quiet as the audio shield)</p>
  125. </script>
  126. <script type="text/x-red" data-template-name="AudioInputAnalog">
  127. <div class="form-row">
  128. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  129. <input type="text" id="node-input-name" placeholder="Name">
  130. </div>
  131. </script>
  132. <script type="text/javascript">
  133. RED.nodes.registerType('AudioInputI2Sslave',{
  134. shortName: "i2ss",
  135. inputs:0,
  136. outputs:2,
  137. category: 'input-function',
  138. color:"#E6E0F8",
  139. icon: "arrow-in.png"
  140. });
  141. </script>
  142. <script type="text/x-red" data-help-name="AudioInputI2Sslave">
  143. <h3>Summary</h3>
  144. <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p>
  145. <h3>Audio Connections</h3>
  146. <table class=doc align=center cellpadding=3>
  147. <tr class=top><th>Port</th><th>Purpose</th></tr>
  148. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  149. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  150. </table>
  151. <h3>Functions</h3>
  152. <p>This object has no functions to call from the Arduino sketch. It
  153. simply streams data from the I2S hardware to its 2 output ports.</p>
  154. <h3>Hardware</h3>
  155. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  156. data timing.</p>
  157. <table class=doc align=center cellpadding=3>
  158. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  159. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  160. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  161. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  162. </table>
  163. <!--<h3>Examples</h3>
  164. <p class=exam>File &gt; Examples &gt; Audio &gt;
  165. </p>-->
  166. <h3>Notes</h3>
  167. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  168. PWM</b> signals. Differences in timing between the I2S device and
  169. Teensy's clock can cause occasional audio glitches when I2S slave mode
  170. is used together with other input or output objects based on Teensy's
  171. timing.</p>
  172. <p>Only one I2S input and one I2S output object may be used. Master
  173. and slave modes may not be mixed (both must be of the same type).
  174. </p>
  175. </script>
  176. <script type="text/x-red" data-template-name="AudioInputI2Sslave">
  177. <div class="form-row">
  178. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  179. <input type="text" id="node-input-name" placeholder="Name">
  180. </div>
  181. </script>
  182. <script type="text/javascript">
  183. RED.nodes.registerType('AudioOutputI2S',{
  184. shortName: "i2s",
  185. inputs:2,
  186. outputs:0,
  187. category: 'output-function',
  188. color:"#E6E0F8",
  189. icon: "arrow-in.png"
  190. });
  191. </script>
  192. <script type="text/x-red" data-help-name="AudioOutputI2S">
  193. <h3>Summary</h3>
  194. <p>Transmit 16 bit stereo audio to the
  195. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  196. or another I2S device, using I2S master mode.</p>
  197. <p align=center><img src="audioshield_outputs.jpg"></p>
  198. <h3>Audio Connections</h3>
  199. <table class=doc align=center cellpadding=3>
  200. <tr class=top><th>Port</th><th>Purpose</th></tr>
  201. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  202. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  203. </table>
  204. <h3>Functions</h3>
  205. <p>This object has no functions to call from the Arduino sketch. It
  206. simply streams data from its 2 input ports to the I2S hardware.</p>
  207. <h3>Hardware</h3>
  208. <p align=center><img src="audioshield_backside.jpg"></p>
  209. <p>The I2S signals are used in "master" mode, where Teensy creates
  210. all 3 clock signals and controls all data timing.</p>
  211. <table class=doc align=center cellpadding=3>
  212. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  213. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  214. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  215. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  216. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  217. </table>
  218. <p>Audio from
  219. master mode I2S may be used in the same project as ADC, DAC and
  220. PWM signals, because all remain in sync to Teensy's timing</p>
  221. <h3>Examples</h3>
  222. <p>Nearly all the examples use this object. Here are some of the highlights:</p>
  223. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  224. </p>
  225. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  226. </p>
  227. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  228. </p>
  229. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  230. </p>
  231. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  232. </p>
  233. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  234. </p>
  235. <h3>Notes</h3>
  236. <p>Normally, this object is used with the Audio Shield, which
  237. is controlled separately by the "sgtl5000" object.</p>
  238. <p>Only one I2S input and one I2S output object may be used. Master
  239. and slave modes may not be mixed (both must be of the same type).
  240. </p>
  241. </script>
  242. <script type="text/x-red" data-template-name="AudioOutputI2S">
  243. <div class="form-row">
  244. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  245. <input type="text" id="node-input-name" placeholder="Name">
  246. </div>
  247. </script>
  248. <script type="text/javascript">
  249. RED.nodes.registerType('AudioOutputSPDIF',{
  250. shortName: "spdif",
  251. inputs:2,
  252. outputs:0,
  253. category: 'output-function',
  254. color:"#E6E0F8",
  255. icon: "arrow-in.png"
  256. });
  257. </script>
  258. <script type="text/x-red" data-help-name="AudioOutputSPDIF">
  259. <h3>Summary</h3>
  260. <p>Transmit 16 bit stereo audio as Digital S/PDIF.</p>
  261. <p align=center><img src="spdif_proto.jpg"></p>
  262. <h3>Audio Connections</h3>
  263. <table class=doc align=center cellpadding=3>
  264. <tr class=top><th>Port</th><th>Purpose</th></tr>
  265. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  266. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  267. </table>
  268. <h3>Functions</h3>
  269. <p>This object has no functions to call from the Arduino sketch. It
  270. simply streams data from its 2 input ports S/PDIF encoded digital
  271. audio on pin 22.</p>
  272. <h3>Hardware</h3>
  273. <p>The S/PDIF output signal can be used to drive an optical TOSLINK
  274. cable, or a standard (usually orange) RCA jack.</p>
  275. <table class=doc align=center cellpadding=3>
  276. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  277. <tr class=odd><td align=center>22</td><td>S/PDIF</td><td>Output</td></tr>
  278. </table>
  279. <p>For optical TOSLINK output, this
  280. <a href="https://www.oshpark.com/shared_projects/KcDBKHta" target="_blank">OSH Park board</a>
  281. can be used with the inexpensive Everlight PLT133/T6A connector, available
  282. at Digikey, 1080-1434-ND.
  283. </p>
  284. <h3>Examples</h3>
  285. <p>The AudioOutputSPDIF object can be used in place of the AudioOutputI2S object,
  286. <p>used in nearly all the examples. The WavFilePlayer shows how to substitute
  287. output objects for different hardware types.
  288. </p>
  289. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  290. </p>
  291. <h3>Credits</h3>
  292. <p><a href="https://github.com/FrankBoesing" target="_blank">Frank Boesing</a>
  293. developed the AudioOutputSPDIF code. The original
  294. <a href="https://forum.pjrc.com/threads/28639-S-pdif" target="_blank">forum disussion</a>
  295. included valuable input and code from "kpc".
  296. <h3>Notes</h3>
  297. <p>S/PDIF output uses the I2S hardware. This object can not be used
  298. together with any of the I2S objects, because it requires the I2S
  299. hardware with different internal settings.</p>
  300. </p>
  301. </script>
  302. <script type="text/x-red" data-template-name="AudioOutputSPDIF">
  303. <div class="form-row">
  304. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  305. <input type="text" id="node-input-name" placeholder="Name">
  306. </div>
  307. </script>
  308. <script type="text/javascript">
  309. RED.nodes.registerType('AudioOutputAnalog',{
  310. shortName: "dac",
  311. inputs:1,
  312. outputs:0,
  313. category: 'output-function',
  314. color:"#E6E0F8",
  315. icon: "arrow-in.png"
  316. });
  317. </script>
  318. <script type="text/x-red" data-help-name="AudioOutputAnalog">
  319. <h3>Summary</h3>
  320. <p>Transmit 12 bit audio using Teensy 3.1's built-in digital to analog converter.</p>
  321. <h3>Audio Connections</h3>
  322. <table class=doc align=center cellpadding=3>
  323. <tr class=top><th>Port</th><th>Purpose</th></tr>
  324. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  325. </table>
  326. <h3>Functions</h3>
  327. <p>This object has no functions to call from the Arduino sketch. It
  328. simply streams data from the ADC to its output port.</p>
  329. <h3>Hardware</h3>
  330. <p align=center><img src="dacpin.jpg"></p>
  331. <p>Signal range is 0 to 1.2V</p>
  332. <p>Most applications require at least a 10&micro;F DC-blocking capacitor.</p>
  333. <p>TODO: photo of Teensy 3.1 with 10&micro;F capacitor and 3.5mm jack.</p>
  334. <h3>Examples</h3>
  335. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  336. </p>
  337. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  338. </p>
  339. <h3>Notes</h3>
  340. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  341. not filtered. This may not
  342. be an issue for many uses, but care should be used if amplified and driven
  343. to high power tweeters.</p>
  344. </script>
  345. <script type="text/x-red" data-template-name="AudioOutputAnalog">
  346. <div class="form-row">
  347. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  348. <input type="text" id="node-input-name" placeholder="Name">
  349. </div>
  350. </script>
  351. <script type="text/javascript">
  352. RED.nodes.registerType('AudioOutputPWM',{
  353. shortName: "pwm",
  354. inputs:1,
  355. outputs:0,
  356. category: 'output-function',
  357. color:"#E6E0F8",
  358. icon: "arrow-in.png"
  359. });
  360. </script>
  361. <script type="text/x-red" data-help-name="AudioOutputPWM">
  362. <h3>Summary</h3>
  363. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  364. used for coarse and fine pulses, to be combined by scaled
  365. resistors.</p>
  366. <h3>Audio Connections</h3>
  367. <table class=doc align=center cellpadding=3>
  368. <tr class=top><th>Port</th><th>Purpose</th></tr>
  369. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  370. </table>
  371. <h3>Functions</h3>
  372. <p>This object has no functions to call from the Arduino sketch. It
  373. simply streams data from the its input port to the PWM pins.</p>
  374. <h3>Hardware</h3>
  375. <p>The following circuit is recommended.</p>
  376. <p align=center><img src="pwmdualcircuit.jpg"></p>
  377. <p>Signal range is approx 1.55 Vp-p.</p>
  378. <p>These resistor values assume approx 20 ohms output impedance
  379. on the digital pins. The 127K resistor may be adjusted or
  380. trimmed for variation in output drive and tolerance on the
  381. 475 ohm resistor.</p>
  382. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  383. C0G/NPO ceramic capacitor should be used for filtering. Low
  384. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  385. <h3>Examples</h3>
  386. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  387. </p>
  388. <h3>Notes</h3>
  389. <p>This object only works properly when Tools > CPU_Speed is set to
  390. 48 or 96 MHz. Other speeds aren't supported and will likely fail
  391. in strange ways.</p>
  392. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  393. will only slightly filter the carrier. Extra filtering will be
  394. required for a clean signal without the ultrasonic PWM carrier.
  395. </p>
  396. <p>Analog signals created by filtering PWM waveforms use the digital
  397. power supply as their reference voltage. Any noise on the digital
  398. power line can directly couple to the output signal. The built-in DAC or
  399. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  400. should be used when higher quality signals are needed.</p>
  401. </script>
  402. <script type="text/x-red" data-template-name="AudioOutputPWM">
  403. <div class="form-row">
  404. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  405. <input type="text" id="node-input-name" placeholder="Name">
  406. </div>
  407. </script>
  408. <script type="text/javascript">
  409. RED.nodes.registerType('AudioOutputI2Sslave',{
  410. shortName: "i2ss",
  411. inputs:2,
  412. outputs:0,
  413. category: 'output-function',
  414. color:"#E6E0F8",
  415. icon: "arrow-in.png"
  416. });
  417. </script>
  418. <script type="text/x-red" data-help-name="AudioOutputI2Sslave">
  419. <h3>Summary</h3>
  420. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p>
  421. <h3>Audio Connections</h3>
  422. <table class=doc align=center cellpadding=3>
  423. <tr class=top><th>Port</th><th>Purpose</th></tr>
  424. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  425. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  426. </table>
  427. <h3>Functions</h3>
  428. <p>This object has no functions to call from the Arduino sketch. It
  429. simply streams data from its 2 input ports to the I2S hardware.</p>
  430. <h3>Hardware</h3>
  431. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  432. data timing.</p>
  433. <table class=doc align=center cellpadding=3>
  434. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  435. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  436. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  437. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  438. </table>
  439. <h3>Examples</h3>
  440. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  441. </p>
  442. <h3>Notes</h3>
  443. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  444. PWM</b> signals. Differences in timing between the I2S device and
  445. Teensy's clock can cause occasional audio glitches when I2S slave mode
  446. is used together with other input or output objects based on Teensy's
  447. timing.</p>
  448. <p>Only one I2S input and one I2S output object may be used. Master
  449. and slave modes may not be mixed (both must be of the same type).
  450. </p>
  451. </script>
  452. <script type="text/x-red" data-template-name="AudioOutputI2Sslave">
  453. <div class="form-row">
  454. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  455. <input type="text" id="node-input-name" placeholder="Name">
  456. </div>
  457. </script>
  458. <script type="text/javascript">
  459. RED.nodes.registerType('AudioMixer4',{
  460. shortName: "mixer",
  461. inputs:4,
  462. outputs:1,
  463. category: 'mixer-function',
  464. color:"#E6E0F8",
  465. icon: "arrow-in.png"
  466. });
  467. </script>
  468. <script type="text/x-red" data-help-name="AudioMixer4">
  469. <h3>Summary</h3>
  470. <p>Combine up to 4 audio signals together, each with adjustable gain.
  471. All channels support signal attenuation or amplification.</p>
  472. <h3>Audio Connections</h3>
  473. <table class=doc align=center cellpadding=3>
  474. <tr class=top><th>Port</th><th>Purpose</th></tr>
  475. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  476. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  477. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  478. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  479. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  480. </table>
  481. <h3>Functions</h3>
  482. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  483. <p class=desc>Adjust the amplification or attenuation. "channel" must
  484. be 0 to 3. "level" may be any floating point number from 0 to 32767.
  485. 1.0 passes the signal through directly. Level of 0 shuts the channel
  486. off completely. Between 0 to 1.0 attenuates the signal, and above
  487. 1.0 amplifies it. All 4 channels have separate settings.
  488. </p>
  489. <h3>Examples</h3>
  490. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  491. </p>
  492. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  493. </p>
  494. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  495. </p>
  496. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  497. </p>
  498. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  499. </p>
  500. <h3>Notes</h3>
  501. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  502. or when multiple signals add together to greater than 1.0.</p>
  503. <p>More than 4 channels may be combined by connecting multiple mixers
  504. in tandem. For example, a 16 channel mixer may be built using 5
  505. mixers, where the fifth mixer combines the outputs of the first 4.
  506. </p>
  507. </script>
  508. <script type="text/x-red" data-template-name="AudioMixer4">
  509. <div class="form-row">
  510. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  511. <input type="text" id="node-input-name" placeholder="Name">
  512. </div>
  513. </script>
  514. <script type="text/javascript">
  515. RED.nodes.registerType('AudioPlayMemory',{
  516. shortName: "playMem",
  517. inputs:0,
  518. outputs:1,
  519. category: 'play-function',
  520. color:"#E6E0F8",
  521. icon: "arrow-in.png"
  522. });
  523. </script>
  524. <script type="text/x-red" data-help-name="AudioPlayMemory">
  525. <h3>Summary</h3>
  526. <p>Play a short sound clip, stored directly in memory.
  527. Data files are created with the
  528. <a href="https://github.com/PaulStoffregen/Audio/tree/master/examples/PlayFromSketch/wav2sketch" target="_blank">wav2sketch program</a>,
  529. and copied to the sketch folder to become part of your sketch.</p>
  530. <h3>Audio Connections</h3>
  531. <table class=doc align=center cellpadding=3>
  532. <tr class=top><th>Port</th><th>Purpose</th></tr>
  533. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  534. </table>
  535. <h3>Functions</h3>
  536. <p class=func><span class=keyword>play</span>(data);</p>
  537. <p class=desc>Begin playing a sound clip. If already playing, the
  538. currently playing clip is stopped and this new data begins
  539. playing from the beginning.
  540. </p>
  541. <p class=func><span class=keyword>stop</span>();</p>
  542. <p class=desc>Stop playing. If not playing, this function has no effect.
  543. </p>
  544. <p class=func><span class=keyword>isPlaying</span>();</p>
  545. <p class=desc>Return true (non-zero) if playing, or false (zero)
  546. when not playing.
  547. </p>
  548. <p class=func><span class=keyword>positionMillis</span>();</p>
  549. <p class=desc>While playing, return the current time offset, in
  550. milliseconds. When not playing, the return from this function
  551. is undefined.
  552. </p>
  553. <p class=func><span class=keyword>lengthMillis</span>();</p>
  554. <p class=desc>Return the total length of the current sound clip,
  555. in milliseconds. When not playing, the return from this function
  556. is undefined.
  557. </p>
  558. <h3>Examples</h3>
  559. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  560. </p>
  561. <h3>Notes</h3>
  562. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  563. <p>TODO: ulaw vs uncompressed encoding</p>
  564. <p>Polyphonic playback can be built by creating multiple
  565. objects, with their output combined by mixers.</p>
  566. </script>
  567. <script type="text/x-red" data-template-name="AudioPlayMemory">
  568. <div class="form-row">
  569. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  570. <input type="text" id="node-input-name" placeholder="Name">
  571. </div>
  572. </script>
  573. <script type="text/javascript">
  574. RED.nodes.registerType('AudioPlaySdWav',{
  575. shortName: "playWav",
  576. inputs:0,
  577. outputs:2,
  578. category: 'play-function',
  579. color:"#E6E0F8",
  580. icon: "arrow-in.png"
  581. });
  582. </script>
  583. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  584. <h3>Summary</h3>
  585. <p>Play a WAV file, stored on a SD card.</p>
  586. <h3>Audio Connections</h3>
  587. <table class=doc align=center cellpadding=3>
  588. <tr class=top><th>Port</th><th>Purpose</th></tr>
  589. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  590. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  591. </table>
  592. <h3>Functions</h3>
  593. <p class=func><span class=keyword>play</span>(filename);</p>
  594. <p class=desc>Begin playing a WAV file. If a file is already playing,
  595. it is stopped and this file starts playing from the beginning.
  596. </p>
  597. <p class=func><span class=keyword>stop</span>();</p>
  598. <p class=desc>Stop playing. If not playing, this function has no effect.
  599. </p>
  600. <p class=func><span class=keyword>isPlaying</span>();</p>
  601. <p class=desc>Return true (non-zero) if playing, or false (zero)
  602. when not playing. See the note below about delayed start.
  603. </p>
  604. <p class=func><span class=keyword>positionMillis</span>();</p>
  605. <p class=desc>While playing, return the current time offset, in
  606. milliseconds. When not playing, the return from this function
  607. is undefined.
  608. </p>
  609. <p class=func><span class=keyword>lengthMillis</span>();</p>
  610. <p class=desc>Return the total length of the current sound clip,
  611. in milliseconds. When not playing, the return from this function
  612. is undefined.
  613. </p>
  614. <h3>Examples</h3>
  615. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  616. </p>
  617. <h3>Notes</h3>
  618. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  619. files are played, both output ports transmit a copy of the
  620. single sound. Of course, stereo WAV files play with the left
  621. channel on port 0 and the right channel on port 1.
  622. </p>
  623. <p>A brief delay after calling play() will usually occur before
  624. isPlaying() returns true and positionMillis() returns valid
  625. time offset. WAV files have a header at the beginning of the
  626. file, which the audio library must read and parse before
  627. playing can begin.
  628. </p>
  629. <p>While playing, the audio library accesses the SD card automatically.
  630. If card access is required, you must
  631. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  632. to prevent the library from accessing the SD card while you use it.
  633. Disabling the audio library interrupt for too long may cause audible
  634. dropouts or glitches.
  635. </p>
  636. </script>
  637. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  638. <div class="form-row">
  639. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  640. <input type="text" id="node-input-name" placeholder="Name">
  641. </div>
  642. </script>
  643. <script type="text/javascript">
  644. RED.nodes.registerType('AudioPlaySdRaw',{
  645. shortName: "playRaw",
  646. inputs:0,
  647. outputs:1,
  648. category: 'play-function',
  649. color:"#E6E0F8",
  650. icon: "arrow-in.png"
  651. });
  652. </script>
  653. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  654. <h3>Summary</h3>
  655. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  656. than WAV and begins playing immediately, without parsing WAV file
  657. header info.</p>
  658. <h3>Audio Connections</h3>
  659. <table class=doc align=center cellpadding=3>
  660. <tr class=top><th>Port</th><th>Purpose</th></tr>
  661. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  662. </table>
  663. <h3>Functions</h3>
  664. <p class=func><span class=keyword>play</span>(filename);</p>
  665. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  666. it is stopped and this file starts playing from the beginning.
  667. </p>
  668. <p class=func><span class=keyword>stop</span>();</p>
  669. <p class=desc>Stop playing. If not playing, this function has no effect.
  670. </p>
  671. <p class=func><span class=keyword>isPlaying</span>();</p>
  672. <p class=desc>Return true (non-zero) if playing, or false (zero)
  673. when not playing.
  674. </p>
  675. <p class=func><span class=keyword>positionMillis</span>();</p>
  676. <p class=desc>While playing, return the current time offset, in
  677. milliseconds. When not playing, the return from this function
  678. is undefined.
  679. </p>
  680. <p class=func><span class=keyword>lengthMillis</span>();</p>
  681. <p class=desc>Return the total length of the current sound clip,
  682. in milliseconds. When not playing, the return from this function
  683. is undefined.
  684. </p>
  685. <h3>Examples</h3>
  686. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  687. </p>
  688. <h3>Notes</h3>
  689. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  690. </p>
  691. <p>While playing, the audio library accesses the SD card automatically.
  692. If card access is required, you must
  693. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  694. to prevent the library from accessing the SD card while you use it.
  695. Disabling the audio library interrupt for too long may cause audible
  696. dropouts or glitches.
  697. </p>
  698. </script>
  699. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  700. <div class="form-row">
  701. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  702. <input type="text" id="node-input-name" placeholder="Name">
  703. </div>
  704. </script>
  705. <script type="text/javascript">
  706. RED.nodes.registerType('AudioPlayQueue',{
  707. shortName: "queue",
  708. inputs:0,
  709. outputs:1,
  710. category: 'play-function',
  711. color:"#E6E0F8",
  712. icon: "arrow-in.png"
  713. });
  714. </script>
  715. <script type="text/x-red" data-help-name="AudioPlayQueue">
  716. <h3>Summary</h3>
  717. <p>Play audio data provided by the Arduino sketch. This object provides
  718. functions to allow the sketch code to push data into the audio system.</p>
  719. <h3>Audio Connections</h3>
  720. <table class=doc align=center cellpadding=3>
  721. <tr class=top><th>Port</th><th>Purpose</th></tr>
  722. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  723. </table>
  724. <h3>Functions</h3>
  725. <p class=func><span class=keyword>play</span>(int16);</p>
  726. <p class=desc>not yet implemented
  727. </p>
  728. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  729. <p class=desc>not yet implemented
  730. </p>
  731. <p class=func><span class=keyword>getBuffer</span>();</p>
  732. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  733. is within the audio library memory pool, providing the most efficient
  734. way to input data to the audio system. The buffer is likely to be
  735. populated by previously used data, so the entire 128 words should be
  736. written before calling playBuffer(). Only a single buffer should be
  737. requested at a time. This function may return NULL if no memory is
  738. available.
  739. </p>
  740. <p class=func><span class=keyword>playBuffer</span>();</p>
  741. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  742. </p>
  743. <h3>Examples</h3>
  744. <p><a href="http://community.arm.com/groups/embedded/blog/2014/05/23/led-video-panel-at-maker-faire-2014" target="_blank">4320 LED Video+Sound Project</a>
  745. </p>
  746. <!--<p class=exam>File &gt; Examples &gt; Audio &gt;
  747. </p>-->
  748. <h3>Notes</h3>
  749. <p>TODO: many caveats....</p>
  750. <p>
  751. </p>
  752. </script>
  753. <script type="text/x-red" data-template-name="AudioPlayQueue">
  754. <div class="form-row">
  755. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  756. <input type="text" id="node-input-name" placeholder="Name">
  757. </div>
  758. </script>
  759. <script type="text/javascript">
  760. RED.nodes.registerType('AudioRecordQueue',{
  761. shortName: "queue",
  762. inputs:1,
  763. outputs:0,
  764. category: 'record-function',
  765. color:"#E6E0F8",
  766. icon: "arrow-in.png"
  767. });
  768. </script>
  769. <script type="text/x-red" data-help-name="AudioRecordQueue">
  770. <h3>Summary</h3>
  771. <p>Record audio data by sending to the Arduino sketch. This object allows
  772. sketch code to receive audio packets.</p>
  773. <h3>Audio Connections</h3>
  774. <table class=doc align=center cellpadding=3>
  775. <tr class=top><th>Port</th><th>Purpose</th></tr>
  776. <tr class=odd><td align=center>In 0</td><td>Sound To Access</td></tr>
  777. </table>
  778. <h3>Functions</h3>
  779. <p class=func><span class=keyword>begin</span>();</p>
  780. <p class=desc>Begin capturing incoming audio to the queue. After calling
  781. begin, readBuffer() and freeBuffer(), or clear() must be used frequently
  782. to prevent the queue from filling up.
  783. </p>
  784. <p class=func><span class=keyword>available</span>();</p>
  785. <p class=desc>Returns the number of audio packets available to read.
  786. </p>
  787. <p class=func><span class=keyword>readBuffer</span>();</p>
  788. <p class=desc>Read a single audio packet. A pointer to a 128 sample
  789. array of 16 bit integers is returned. NULL is returned if no packets
  790. are available.
  791. </p>
  792. <p class=func><span class=keyword>freeBuffer</span>();</p>
  793. <p class=desc>Release the memory from the previously read packet returned
  794. from readBuffer(). Only a single packet at a time may be read, and
  795. each packet must be freed with this function, to return the memory to
  796. the audio library.
  797. </p>
  798. <p class=func><span class=keyword>clear</span>();</p>
  799. <p class=desc>Discard all audio held in the queue.
  800. </p>
  801. <p class=func><span class=keyword>end</span>();</p>
  802. <p class=desc>Stop capturing incoming audio into the queue. Data already
  803. captured remains in the queue and may be read with readBuffer().
  804. </p>
  805. <h3>Examples</h3>
  806. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  807. </p>
  808. <h3>Notes</h3>
  809. <p>
  810. Up to 52 packets may be queued by this object, which allows approximately
  811. 150 ms of audio to be held in the queue, to allow time for the Arduino
  812. sketch to write data to media or do other high-latency tasks.
  813. The actual packets are taken
  814. from the pool created by AudioMemory().
  815. </p>
  816. </script>
  817. <script type="text/x-red" data-template-name="AudioRecordQueue">
  818. <div class="form-row">
  819. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  820. <input type="text" id="node-input-name" placeholder="Name">
  821. </div>
  822. </script>
  823. <script type="text/javascript">
  824. RED.nodes.registerType('AudioSynthWaveformSine',{
  825. shortName: "sine",
  826. inputs:0,
  827. outputs:1,
  828. category: 'synth-function',
  829. color:"#E6E0F8",
  830. icon: "arrow-in.png"
  831. });
  832. </script>
  833. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  834. <h3>Summary</h3>
  835. <p>Create a sine wave signal</p>
  836. <h3>Audio Connections</h3>
  837. <table class=doc align=center cellpadding=3>
  838. <tr class=top><th>Port</th><th>Purpose</th></tr>
  839. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  840. </table>
  841. <h3>Functions</h3>
  842. <p class=func><span class=keyword>amplitude</span>(level);</p>
  843. <p class=desc>Set the amplitude, from 0 to 1.0.
  844. </p>
  845. <p class=func><span class=keyword>frequency</span>(freq);</p>
  846. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  847. be used to create a LFO (Low Frequency Oscillator) for objects
  848. with modulation signal inputs.
  849. </p>
  850. <p class=func><span class=keyword>phase</span>(angle);</p>
  851. <p class=desc>
  852. Cause the generated waveform to jump to a specific point within
  853. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  854. are configured,
  855. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  856. should be used to guarantee all new settings take effect together.
  857. </p>
  858. <h3>Examples</h3>
  859. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  860. </p>
  861. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  862. </p>
  863. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  864. </p>
  865. <h3>Notes</h3>
  866. <p></p>
  867. </script>
  868. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  869. <div class="form-row">
  870. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  871. <input type="text" id="node-input-name" placeholder="Name">
  872. </div>
  873. </script>
  874. <script type="text/javascript">
  875. RED.nodes.registerType('AudioSynthWaveformSineModulated',{
  876. shortName: "sine_fm",
  877. inputs:1,
  878. outputs:1,
  879. category: 'synth-function',
  880. color:"#E6E0F8",
  881. icon: "arrow-in.png"
  882. });
  883. </script>
  884. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  885. <h3>Summary</h3>
  886. <p>Create a modulated sine wave, using any audio signal to continuously
  887. modulate the sine wave frequency.</p>
  888. <h3>Audio Connections</h3>
  889. <table class=doc align=center cellpadding=3>
  890. <tr class=top><th>Port</th><th>Purpose</th></tr>
  891. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  892. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  893. </table>
  894. <h3>Functions</h3>
  895. <p class=func><span class=keyword>amplitude</span>(level);</p>
  896. <p class=desc>Set the amplitude, from 0 to 1.0.
  897. </p>
  898. <p class=func><span class=keyword>frequency</span>(freq);</p>
  899. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  900. be this center frequency when the input modulation signal is zero.
  901. Modulation input 1.0 causes the frequency to double, and input -1.0
  902. causes zero Hz (DC) output. For less modulation, attenuate the input
  903. signal (perhaps with a mixer object) before it arrives here.
  904. </p>
  905. <p class=func><span class=keyword>phase</span>(angle);</p>
  906. <p class=desc>
  907. Cause the generated waveform to jump to a specific point within
  908. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  909. are configured,
  910. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  911. should be used to guarantee all new settings take effect together.
  912. </p>
  913. <!--<h3>Examples</h3>
  914. <p class=exam>File &gt; Examples &gt; Audio &gt;
  915. </p>-->
  916. <h3>Notes</h3>
  917. <p></p>
  918. </script>
  919. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  920. <div class="form-row">
  921. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  922. <input type="text" id="node-input-name" placeholder="Name">
  923. </div>
  924. </script>
  925. <script type="text/javascript">
  926. RED.nodes.registerType('AudioSynthWaveform',{
  927. shortName: "waveform",
  928. inputs:0,
  929. outputs:1,
  930. category: 'synth-function',
  931. color:"#E6E0F8",
  932. icon: "arrow-in.png"
  933. });
  934. </script>
  935. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  936. <h3>Summary</h3>
  937. <p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</p>
  938. <h3>Audio Connections</h3>
  939. <table class=doc align=center cellpadding=3>
  940. <tr class=top><th>Port</th><th>Purpose</th></tr>
  941. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  942. </table>
  943. <h3>Functions</h3>
  944. <p class=func><span class=keyword>begin</span>(waveform);</p>
  945. <p class=desc>Configure the waveform type to create.
  946. </p>
  947. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  948. <p class=desc>Output a waveform, and set the amplitude and frequency.
  949. </p>
  950. <p class=func><span class=keyword>frequency</span>(freq);</p>
  951. <p class=desc>Change the frequency.
  952. </p>
  953. <p class=func><span class=keyword>amplitude</span>(level);</p>
  954. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  955. </p>
  956. <p class=func><span class=keyword>phase</span>(angle);</p>
  957. <p class=desc>
  958. Cause the generated waveform to jump to a specific point within
  959. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  960. are configured,
  961. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  962. should be used to guarantee all new settings take effect together.
  963. </p>
  964. <p class=func><span class=keyword>pulseWidth</span>(amount);</p>
  965. <p class=desc>Change the width (duty cycle) of the pulse.</p>
  966. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  967. <p class=desc>
  968. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  969. must be an array of 256 samples. Currently, the data is used
  970. without any filtering, which can cause aliasing with frequencies
  971. above 172 Hz. For higher frequency output, you must bandwidth
  972. limit your waveform data. Someday, "maxFreq" will be used to
  973. do this automatically.
  974. </p>
  975. <h3>Examples</h3>
  976. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  977. </p>
  978. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  979. </p>
  980. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  981. </p>
  982. <h3>Notes</h3>
  983. <p>Supported Waveforms:<br>
  984. <ul>
  985. <li><span class=literal>WAVEFORM_SINE</span></li>
  986. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  987. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  988. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  989. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  990. <li><span class=literal>WAVEFORM_PULSE</span></li>
  991. </ul>
  992. </p>
  993. </script>
  994. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  995. <div class="form-row">
  996. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  997. <input type="text" id="node-input-name" placeholder="Name">
  998. </div>
  999. </script>
  1000. <script type="text/javascript">
  1001. RED.nodes.registerType('AudioSynthToneSweep',{
  1002. shortName: "tonesweep",
  1003. inputs:0,
  1004. outputs:1,
  1005. category: 'synth-function',
  1006. color:"#E6E0F8",
  1007. icon: "arrow-in.png"
  1008. });
  1009. </script>
  1010. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  1011. <h3>Summary</h3>
  1012. <p>Create a continuously varying (in frequency) sine wave</p>
  1013. <h3>Audio Connections</h3>
  1014. <table class=doc align=center cellpadding=3>
  1015. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1016. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  1017. </table>
  1018. <h3>Functions</h3>
  1019. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  1020. <p class=desc>Start generating frequency sweep output. The time is specified
  1021. in milliseconds. Level is 0 to 1.0.
  1022. </p>
  1023. <p class=func><span class=keyword>isPlaying</span>();</p>
  1024. <p class=desc>Returns true (non-zero) while the output is active.
  1025. </p>
  1026. <h3>Examples</h3>
  1027. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; ToneSweep
  1028. </p>
  1029. <h3>Notes</h3>
  1030. <p>Uses excessive CPU time</p>
  1031. </script>
  1032. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  1033. <div class="form-row">
  1034. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1035. <input type="text" id="node-input-name" placeholder="Name">
  1036. </div>
  1037. </script>
  1038. <script type="text/javascript">
  1039. RED.nodes.registerType('AudioSynthWaveformDc',{
  1040. shortName: "dc",
  1041. inputs:0,
  1042. outputs:1,
  1043. category: 'synth-function',
  1044. color:"#E6E0F8",
  1045. icon: "arrow-in.png"
  1046. });
  1047. </script>
  1048. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  1049. <h3>Summary</h3>
  1050. <p>Create constant (DC) signal, useful for control of objects that take
  1051. a modulation or control input signal. This constant level can be
  1052. used to modify other waveforms using mixer or multiplier objects</p>
  1053. <h3>Audio Connections</h3>
  1054. <table class=doc align=center cellpadding=3>
  1055. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1056. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  1057. </table>
  1058. <h3>Functions</h3>
  1059. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1060. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1061. changed immediately.
  1062. </p>
  1063. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  1064. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1065. gradually changed over a "milliseconds" time period. Any time may
  1066. be specified, but periods longer than 1 second may be automatically
  1067. shortened for small level changes, due to numerical precision limits.
  1068. </p>
  1069. <!--<h3>Examples</h3>
  1070. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1071. </p>-->
  1072. <h3>Notes</h3>
  1073. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  1074. to a pure digital stream of numerical values. But the term is widely
  1075. understood in audio applications, so hopefully it's not too confusing?</p>
  1076. </script>
  1077. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  1078. <div class="form-row">
  1079. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1080. <input type="text" id="node-input-name" placeholder="Name">
  1081. </div>
  1082. </script>
  1083. <script type="text/javascript">
  1084. RED.nodes.registerType('AudioSynthNoiseWhite',{
  1085. shortName: "noise",
  1086. inputs:0,
  1087. outputs:1,
  1088. category: 'synth-function',
  1089. color:"#E6E0F8",
  1090. icon: "arrow-in.png"
  1091. });
  1092. </script>
  1093. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  1094. <h3>Summary</h3>
  1095. <div>
  1096. <p>Create white noise.
  1097. </p>
  1098. <p align=center><img src="whitenoise.png"></p>
  1099. </div>
  1100. <h3>Audio Connections</h3>
  1101. <table class=doc align=center cellpadding=3>
  1102. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1103. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  1104. </table>
  1105. <h3>Functions</h3>
  1106. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1107. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1108. The default is off. Noise is generated only after setting
  1109. to a non-zero level.
  1110. </p>
  1111. <h3>Examples</h3>
  1112. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1113. </p>
  1114. <h3>Notes</h3>
  1115. <p>Setting the amplitude to zero causes this object to stop using
  1116. CPU time to generate random numbers.
  1117. </p>
  1118. </script>
  1119. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  1120. <div class="form-row">
  1121. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1122. <input type="text" id="node-input-name" placeholder="Name">
  1123. </div>
  1124. </script>
  1125. <script type="text/javascript">
  1126. RED.nodes.registerType('AudioSynthNoisePink',{
  1127. shortName: "pink",
  1128. inputs:0,
  1129. outputs:1,
  1130. category: 'synth-function',
  1131. color:"#E6E0F8",
  1132. icon: "arrow-in.png"
  1133. });
  1134. </script>
  1135. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  1136. <h3>Summary</h3>
  1137. <div>
  1138. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  1139. </p>
  1140. <!--<p align=center><img src="whitenoise.png"></p>-->
  1141. </div>
  1142. <h3>Audio Connections</h3>
  1143. <table class=doc align=center cellpadding=3>
  1144. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1145. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  1146. </table>
  1147. <h3>Functions</h3>
  1148. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1149. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1150. The default is off. Noise is generated only after setting
  1151. to a non-zero level.
  1152. </p>
  1153. <h3>Examples</h3>
  1154. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1155. </p>
  1156. <h3>Notes</h3>
  1157. <p>Setting the amplitude to zero causes this object to stop using
  1158. CPU time. CPU usage is approx 3% on Teensy 3.1.
  1159. </p>
  1160. <p>Stefan Stenzel's
  1161. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  1162. algorithm. Stefan's terms of use are "Use for any purpose. If used
  1163. in a commercial product, you should give me one."
  1164. </p>
  1165. </script>
  1166. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  1167. <div class="form-row">
  1168. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1169. <input type="text" id="node-input-name" placeholder="Name">
  1170. </div>
  1171. </script>
  1172. <script type="text/javascript">
  1173. RED.nodes.registerType('AudioEffectFade',{
  1174. shortName: "fade",
  1175. inputs:1,
  1176. outputs:1,
  1177. category: 'effect-function',
  1178. color:"#E6E0F8",
  1179. icon: "arrow-in.png"
  1180. });
  1181. </script>
  1182. <script type="text/x-red" data-help-name="AudioEffectFade">
  1183. <h3>Summary</h3>
  1184. <p>Gradually increase or decrease audio level.</p>
  1185. <h3>Audio Connections</h3>
  1186. <table class=doc align=center cellpadding=3>
  1187. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1188. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1189. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1190. </table>
  1191. <h3>Functions</h3>
  1192. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  1193. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  1194. directly to the output) after "milliseconds" time.
  1195. </p>
  1196. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  1197. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  1198. after "milliseconds" time.
  1199. </p>
  1200. <!--<h3>Examples</h3>
  1201. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1202. </p>-->
  1203. <h3>Notes</h3>
  1204. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  1205. When one fade object is off (fully faded out) and the other on
  1206. (fully faded in), if both are started at the same moment for the
  1207. same time duration, their signal gains always add to 1.0. This
  1208. allows 2 fade objects to work together for a smooth transition
  1209. between a pair of signals.
  1210. </p>
  1211. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1212. should be used when changing
  1213. settings on multiple objects, so all changes always take effect
  1214. at the same moment.
  1215. </p>
  1216. </script>
  1217. <script type="text/x-red" data-template-name="AudioEffectFade">
  1218. <div class="form-row">
  1219. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1220. <input type="text" id="node-input-name" placeholder="Name">
  1221. </div>
  1222. </script>
  1223. <script type="text/javascript">
  1224. RED.nodes.registerType('AudioEffectChorus',{
  1225. shortName: "chorus",
  1226. inputs:1,
  1227. outputs:1,
  1228. category: 'effect-function',
  1229. color:"#E6E0F8",
  1230. icon: "arrow-in.png"
  1231. });
  1232. </script>
  1233. <script type="text/x-red" data-help-name="AudioEffectChorus">
  1234. <h3>Summary</h3>
  1235. <p>The chorus effect simulates the richness of several nearly-identical
  1236. sound sources (like the way a choir sounds different to a single singer).
  1237. It does this by sampling from a delay line, so each voice is actually
  1238. the same but at a slightly different point in time. This is a type of
  1239. comb filtering.</p>
  1240. <p>Chorus combines one or more samples ranging from the most recent
  1241. sample back to about 50ms ago. The additional samples are evenly spread
  1242. through the supplied delay line, and there is no modulation.</p>
  1243. <p>If the number of voices is specified as 2, then the
  1244. effect combines the current sample and the oldest sample (the last one
  1245. in the delay line). If the number of voices is 3 then the effect combines
  1246. the most recent sample, the oldest sample and the sample in the middle of
  1247. the delay line.</p>
  1248. <p>For two voices the effect can be represented as:<br/>
  1249. result = (sample(0) + sample(dt))/2<br/>
  1250. where sample(0) represents the current sample and sample(dt)
  1251. is the sample in the delay line from dt milliseconds ago.</p>
  1252. <h3>Audio Connections</h3>
  1253. <table class=doc align=center cellpadding=3>
  1254. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1255. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1256. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  1257. </table>
  1258. <h3>Functions</h3>
  1259. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  1260. <p class=desc>Create a chorus by specifying the address of the delayline, the
  1261. total number of samples in the delay line (often done as an integer multiple of
  1262. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  1263. the original voice (so, 2 and up to get a chorus effect, although you can
  1264. specify 1 if you want).
  1265. </p>
  1266. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  1267. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  1268. </p>
  1269. <h3>Examples</h3>
  1270. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  1271. </p>
  1272. <h3>Notes</h3>
  1273. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  1274. </script>
  1275. <script type="text/x-red" data-template-name="AudioEffectChorus">
  1276. <div class="form-row">
  1277. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1278. <input type="text" id="node-input-name" placeholder="Name">
  1279. </div>
  1280. </script>
  1281. <script type="text/javascript">
  1282. RED.nodes.registerType('AudioEffectFlange',{
  1283. shortName: "flange",
  1284. inputs:1,
  1285. outputs:1,
  1286. category: 'effect-function',
  1287. color:"#E6E0F8",
  1288. icon: "arrow-in.png"
  1289. });
  1290. </script>
  1291. <script type="text/x-red" data-help-name="AudioEffectFlange">
  1292. <h3>Summary</h3>
  1293. <p>Originally, flanging was produced by playing the same signal on two synchronized
  1294. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  1295. pressing on the flange of the reel (hence the name). This is a type of
  1296. comb filtering, and produces a harmonically-related series of peaks and notches
  1297. in the audio spectrum.</p>
  1298. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  1299. line, but the position of that sample varies sinusoidally.</p>
  1300. <p>The effect can be represented as:<br>
  1301. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  1302. <p>The value of the sine function is always a number from -1 to +1 and
  1303. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  1304. Thus, the delayed sample will be selected from the range (dt-depth) to
  1305. (dt+depth). This selection will vary at whatever rate is specified as the
  1306. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  1307. <h3>Audio Connections</h3>
  1308. <table class=doc align=center cellpadding=3>
  1309. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1310. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1311. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  1312. </table>
  1313. <h3>Functions</h3>
  1314. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  1315. <p class=desc>Create a flanger by specifying the address of the delayline, the
  1316. total number of samples in the delay line (often done as an integer multiple of
  1317. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  1318. the modulation depth (larger values give a greater variation) and the modulation
  1319. frequency, in Hertz.
  1320. </p>
  1321. <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p>
  1322. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  1323. </p>
  1324. <h3>Examples</h3>
  1325. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  1326. </p>
  1327. <h3>Notes</h3>
  1328. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  1329. <p>Try these settings:<br>
  1330. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  1331. and<br>
  1332. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  1333. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  1334. double s_freq = 3;</p>
  1335. <p>The flange effect can also produce a chorus-like effect if a longer
  1336. delay line is used with a slower modulation rate, for example try:<br>
  1337. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  1338. and<br>
  1339. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  1340. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  1341. double s_freq = .0625;</p>
  1342. </script>
  1343. <script type="text/x-red" data-template-name="AudioEffectFlange">
  1344. <div class="form-row">
  1345. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1346. <input type="text" id="node-input-name" placeholder="Name">
  1347. </div>
  1348. </script>
  1349. <script type="text/javascript">
  1350. RED.nodes.registerType('AudioEffectEnvelope',{
  1351. shortName: "envelope",
  1352. inputs:1,
  1353. outputs:1,
  1354. category: 'effect-function',
  1355. color:"#E6E0F8",
  1356. icon: "arrow-in.png"
  1357. });
  1358. </script>
  1359. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  1360. <h3>Summary</h3>
  1361. <div>
  1362. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  1363. Release) envelope.
  1364. </p>
  1365. <p align=center><img src="dahdsr.png"></p>
  1366. </div>
  1367. <h3>Audio Connections</h3>
  1368. <table class=doc align=center cellpadding=3>
  1369. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1370. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1371. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1372. </table>
  1373. <h3>Functions</h3>
  1374. <p class=func><span class=keyword>noteOn</span>();</p>
  1375. <p class=desc>Begin the delay to attack, or the attack phase is
  1376. delay is zero.
  1377. </p>
  1378. <p class=func><span class=keyword>noteOff</span>();</p>
  1379. <p class=desc>Begin the release phase.
  1380. </p>
  1381. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  1382. <p class=desc>Set the delay from noteOn to the attach phase. The
  1383. default is zero, for no delay.
  1384. </p>
  1385. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  1386. <p class=desc>Set the attack time. The default is 1.5 milliseconds.
  1387. </p>
  1388. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  1389. <p class=desc>Set the hold time. The default is 0.5 milliseconds.
  1390. </p>
  1391. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  1392. <p class=desc>Set the decay time. The default is 15 milliseconds.
  1393. </p>
  1394. <p class=func><span class=keyword>sustain</span>(level);</p>
  1395. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  1396. gain will be maintained at this level after the decay phase,
  1397. until noteOff() is called.
  1398. </p>
  1399. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  1400. <p class=desc>Set the release time. The default is 30 millisecond.
  1401. </p>
  1402. <h3>Examples</h3>
  1403. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1404. </p>
  1405. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1406. </p>
  1407. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1408. </p>
  1409. <h3>Notes</h3>
  1410. <p>To achieve the more common ADSR shape, simply
  1411. set delay and hold to zero.</p>
  1412. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  1413. milliseconds. Up to 200 ms can be used, with somewhat reduced
  1414. accuracy</p>
  1415. </script>
  1416. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  1417. <div class="form-row">
  1418. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1419. <input type="text" id="node-input-name" placeholder="Name">
  1420. </div>
  1421. </script>
  1422. <script type="text/javascript">
  1423. RED.nodes.registerType('AudioEffectMultiply',{
  1424. shortName: "multiply",
  1425. inputs:2,
  1426. outputs:1,
  1427. category: 'effect-function',
  1428. color:"#E6E0F8",
  1429. icon: "arrow-in.png"
  1430. });
  1431. </script>
  1432. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  1433. <h3>Summary</h3>
  1434. <div>
  1435. <p>Multiply two signals together, useful for amplitude modulation
  1436. or "voltage controlled amplification".
  1437. </p>
  1438. <p align=center><img src="multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  1439. </div>
  1440. <h3>Audio Connections</h3>
  1441. <table class=doc align=center cellpadding=3>
  1442. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1443. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1444. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  1445. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1446. </table>
  1447. <h3>Functions</h3>
  1448. <p>There are no functions to call from the Arduino sketch.
  1449. This object simply multiplies the 2 signals to create
  1450. a continuous output
  1451. </p>
  1452. <!--<h3>Examples</h3>
  1453. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1454. </p>-->
  1455. <h3>Notes</h3>
  1456. <p>
  1457. </p>
  1458. </script>
  1459. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  1460. <div class="form-row">
  1461. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1462. <input type="text" id="node-input-name" placeholder="Name">
  1463. </div>
  1464. </script>
  1465. <script type="text/javascript">
  1466. RED.nodes.registerType('AudioEffectDelay',{
  1467. shortName: "delay",
  1468. inputs:1,
  1469. outputs:8,
  1470. category: 'effect-function',
  1471. color:"#E6E0F8",
  1472. icon: "arrow-in.png"
  1473. });
  1474. </script>
  1475. <script type="text/x-red" data-help-name="AudioEffectDelay">
  1476. <h3>Summary</h3>
  1477. <div>
  1478. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  1479. <p align=center><img src="delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1480. </div>
  1481. <h3>Audio Connections</h3>
  1482. <table class=doc align=center cellpadding=3>
  1483. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1484. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1485. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1486. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1487. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1488. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1489. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1490. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1491. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1492. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1493. </table>
  1494. <h3>Functions</h3>
  1495. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1496. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1497. milliseconds. The maximum delay is approx 333 ms. The actual delay
  1498. is rounded to the nearest sample. Each channel can be configured for
  1499. any delay. There is no requirement to configure the "taps" in increasing
  1500. delay order.
  1501. </p>
  1502. <p class=func><span class=keyword>disable</span>(channel);</p>
  1503. <p class=desc>Disable a channel. The output of this channel becomes
  1504. silent. If this channel is the longest delay, memory usage is
  1505. automatically reduced to accomodate only the remaining channels used.
  1506. </p>
  1507. <h3>Examples</h3>
  1508. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  1509. </p>
  1510. <h3>Notes</h3>
  1511. <p>Memory for the delayed signal is take from the memory pool allocated by
  1512. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  1513. Each block allows about 3 milliseconds of delay, so AudioMemory
  1514. should be increased to allow for the longest delay tap.
  1515. </p>
  1516. </script>
  1517. <script type="text/x-red" data-template-name="AudioEffectDelay">
  1518. <div class="form-row">
  1519. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1520. <input type="text" id="node-input-name" placeholder="Name">
  1521. </div>
  1522. </script>
  1523. <script type="text/javascript">
  1524. RED.nodes.registerType('AudioFilterBiquad',{
  1525. shortName: "biquad",
  1526. inputs:1,
  1527. outputs:1,
  1528. category: 'filter-function',
  1529. color:"#E6E0F8",
  1530. icon: "arrow-in.png"
  1531. });
  1532. </script>
  1533. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  1534. <h3>Summary</h3>
  1535. <div>
  1536. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  1537. Up to 4 stages may be cascaded.
  1538. </p>
  1539. <p align=center><img src="biquad.png"></p>
  1540. </div>
  1541. <h3>Audio Connections</h3>
  1542. <table class=doc align=center cellpadding=3>
  1543. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1544. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1545. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1546. </table>
  1547. <h3>Functions</h3>
  1548. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  1549. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  1550. response, with the specified corner frequency and Q shape. If Q is
  1551. higher that 0.7071, be careful of filter gain (see below).
  1552. </p>
  1553. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  1554. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  1555. response, with the specified corner frequency and Q shape. If Q is
  1556. higher that 0.7071, be careful of filter gain (see below).
  1557. </p>
  1558. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  1559. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  1560. response. The filter has unity gain at the specified frequency. Q
  1561. controls the width of frequencies allowed to pass.
  1562. </p>
  1563. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  1564. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  1565. response. Q controls the width of rejected frequencies.
  1566. </p>
  1567. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  1568. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  1569. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  1570. Each coefficient must be less than 2.0 and greater than -2.0. The array
  1571. should be type double. Alternately, it may be type int, where 1.0 is
  1572. represented with 1073741824 (2<sup>30</sup>).
  1573. </p>
  1574. <h3>Examples</h3>
  1575. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  1576. </p>
  1577. <h3>Notes</h3>
  1578. <p>Filters can with gain must have their input signals attenuated, so the
  1579. signal does not exceed 1.0.
  1580. </p>
  1581. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  1582. not pass any signal.
  1583. </p>
  1584. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  1585. trouble with limited numerical precision, causing the filter to perform
  1586. poorly. For very low corner frequency, the State Variable (Chamberlin)
  1587. filter should be used.
  1588. </p>
  1589. </script>
  1590. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  1591. <div class="form-row">
  1592. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1593. <input type="text" id="node-input-name" placeholder="Name">
  1594. </div>
  1595. </script>
  1596. <script type="text/javascript">
  1597. RED.nodes.registerType('AudioFilterFIR',{
  1598. shortName: "fir",
  1599. inputs:1,
  1600. outputs:1,
  1601. category: 'filter-function',
  1602. color:"#E6E0F8",
  1603. icon: "arrow-in.png"
  1604. });
  1605. </script>
  1606. <script type="text/x-red" data-help-name="AudioFilterFIR">
  1607. <h3>Summary</h3>
  1608. <div>
  1609. <p>Finite impulse response filter, useful for all sorts of filtering.
  1610. </p>
  1611. <p align=center><img src="fir_filter.png"></p>
  1612. </div>
  1613. <h3>Audio Connections</h3>
  1614. <table class=doc align=center cellpadding=3>
  1615. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1616. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1617. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1618. </table>
  1619. <h3>Functions</h3>
  1620. <p class=func><span class=keyword>begin</span>(array, length);</p>
  1621. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  1622. filter's impulse response), and
  1623. length indicates the number of points in the array. Array may also be
  1624. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  1625. filtering.
  1626. </p>
  1627. <p class=func><span class=keyword>end</span>();</p>
  1628. <p class=desc>Turn the filter off.
  1629. </p>
  1630. <h3>Examples</h3>
  1631. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  1632. </p>
  1633. <h3>Notes</h3>
  1634. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  1635. implement filters with better phase response.
  1636. </p>
  1637. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  1638. supported filter length is 200 points.
  1639. </p>
  1640. <p>The free
  1641. <a href="http://t-filter.appspot.com/fir/index.html" target="_blank"> TFilter Design Tool</a>
  1642. can be used to create the impulse response array. Be sure to set the sampling
  1643. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  1644. </p>
  1645. <p>
  1646. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  1647. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  1648. and add "const" to avoid consuming extra RAM.
  1649. </p>
  1650. </script>
  1651. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1652. <div class="form-row">
  1653. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1654. <input type="text" id="node-input-name" placeholder="Name">
  1655. </div>
  1656. </script>
  1657. <script type="text/javascript">
  1658. RED.nodes.registerType('AudioFilterStateVariable',{
  1659. shortName: "filter",
  1660. inputs:2,
  1661. outputs:3,
  1662. category: 'filter-function',
  1663. color:"#E6E0F8",
  1664. icon: "arrow-in.png"
  1665. });
  1666. </script>
  1667. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  1668. <h3>Summary</h3>
  1669. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  1670. adjustable resonance, and optional signal control of corner
  1671. frequency.</p>
  1672. <h3>Audio Connections</h3>
  1673. <table class=doc align=center cellpadding=3>
  1674. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1675. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  1676. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  1677. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  1678. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  1679. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  1680. </table>
  1681. <h3>Functions</h3>
  1682. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1683. <p class=desc>Set the filter's corner frequency. When a signal is
  1684. connected to the control input, the filter will implement this
  1685. frequency when the signal is zero.
  1686. </p>
  1687. <p class=func><span class=keyword>resonance</span>(Q);</p>
  1688. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  1689. Resonance greater than 0.707 will amplify the signal near the
  1690. corner frequency. You must attenuate the signal before input
  1691. to this filter, to prevent clipping.
  1692. </p>
  1693. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  1694. <p class=desc>Set how much (in octaves) the control signal can alter
  1695. the filter's corner freqency. Range is 0 to 7 octaves. For
  1696. example, when set to 2.5, a full scale positive signal (1.0) will
  1697. shift the filter frequency up 2.5 octaves, and a full scale negative
  1698. signal will shift it down 2.5 octaves.
  1699. </p>
  1700. <!--<h3>Examples</h3>
  1701. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1702. </p>-->
  1703. <h3>Notes</h3>
  1704. <p>
  1705. When controlled by a signal, the equation for the filter
  1706. frequency is:
  1707. </p>
  1708. <p>
  1709. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  1710. <br><small>If anyone knows how to do HTML equations, please
  1711. help me improve this.....</small>
  1712. </p>
  1713. <p>When operating with signal control of corner frequency, this
  1714. object uses approximately 4% of the CPU time on Teensy 3.1.
  1715. </p>
  1716. </script>
  1717. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1718. <div class="form-row">
  1719. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1720. <input type="text" id="node-input-name" placeholder="Name">
  1721. </div>
  1722. </script>
  1723. <script type="text/javascript">
  1724. RED.nodes.registerType('AudioAnalyzePeak',{
  1725. shortName: "peak",
  1726. inputs:1,
  1727. outputs:0,
  1728. category: 'analyze-function',
  1729. color:"#E6E0F8",
  1730. icon: "arrow-in.png"
  1731. });
  1732. </script>
  1733. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  1734. <h3>Summary</h3>
  1735. <p>Track the signal peak amplitude. Very useful for simple
  1736. audio level response projects, and general troubleshooting.</p>
  1737. <h3>Audio Connections</h3>
  1738. <table class=doc align=center cellpadding=3>
  1739. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1740. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1741. </table>
  1742. <h3>Functions</h3>
  1743. <p class=func><span class=keyword>available</span>();</p>
  1744. <p class=desc>Returns true each time new peak data is available.
  1745. </p>
  1746. <p class=func><span class=keyword>read</span>();</p>
  1747. <p class=desc>Read the highest peak value since the last read.
  1748. Return is from 0.0 to 1.0.
  1749. </p>
  1750. <h3>Examples</h3>
  1751. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  1752. </p>
  1753. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  1754. </p>
  1755. <h3>Notes</h3>
  1756. <p></p>
  1757. </script>
  1758. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  1759. <div class="form-row">
  1760. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1761. <input type="text" id="node-input-name" placeholder="Name">
  1762. </div>
  1763. </script>
  1764. <script type="text/javascript">
  1765. RED.nodes.registerType('AudioAnalyzeFFT256',{
  1766. shortName: "fft256",
  1767. inputs:1,
  1768. outputs:0,
  1769. category: 'analyze-function',
  1770. color:"#E6E0F8",
  1771. icon: "arrow-in.png"
  1772. });
  1773. </script>
  1774. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  1775. <h3>Summary</h3>
  1776. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  1777. with real value (magnitude) output. The frequency resolution is
  1778. 172 Hz, useful for simple audio visualization.</p>
  1779. <h3>Audio Connections</h3>
  1780. <table class=doc align=center cellpadding=3>
  1781. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1782. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1783. </table>
  1784. <h3>Functions</h3>
  1785. <p class=func><span class=keyword>available</span>();</p>
  1786. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1787. </p>
  1788. <p class=func><span class=keyword>read</span>(binNumber);</p>
  1789. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  1790. so 1.0 represents a full scale sine wave.
  1791. </p>
  1792. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  1793. <p class=desc>Read several frequency bins, returning their sum. The higher
  1794. audio octaves are represented by many bins, which are typically read
  1795. as a group for audio visualization.
  1796. </p>
  1797. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  1798. <p class=desc>New data is produced very radidly, approximately 344 times
  1799. per second. Multiple outputs can be averaged together, so available()
  1800. returns true at a slower rate.
  1801. </p>
  1802. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  1803. <p class=desc>Set the window function to be used. AudioWindowHanning256
  1804. is the default. Windowing may be disabled by NULL, but windowing
  1805. should be used for all non-periodic (music) signals, and all periodic
  1806. signals that are not exact integer division of the sample rate.
  1807. </p>
  1808. <h3>Examples</h3>
  1809. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1810. </p>
  1811. <h3>Notes</h3>
  1812. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1813. num is 0 to 127.</p>
  1814. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1815. <p>Window Types:
  1816. <ul>
  1817. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  1818. <li><span class=literal>AudioWindowBartlett256</span></li>
  1819. <li><span class=literal>AudioWindowBlackman256</span></li>
  1820. <li><span class=literal>AudioWindowFlattop256</span></li>
  1821. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  1822. <li><span class=literal>AudioWindowNuttall256</span></li>
  1823. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  1824. <li><span class=literal>AudioWindowWelch256</span></li>
  1825. <li><span class=literal>AudioWindowHamming256</span></li>
  1826. <li><span class=literal>AudioWindowCosine256</span></li>
  1827. <li><span class=literal>AudioWindowTukey256</span></li>
  1828. </ul>
  1829. </p>
  1830. </script>
  1831. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  1832. <div class="form-row">
  1833. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1834. <input type="text" id="node-input-name" placeholder="Name">
  1835. </div>
  1836. </script>
  1837. <script type="text/javascript">
  1838. RED.nodes.registerType('AudioAnalyzeFFT1024',{
  1839. shortName: "fft1024",
  1840. inputs:1,
  1841. outputs:0,
  1842. category: 'analyze-function',
  1843. color:"#E6E0F8",
  1844. icon: "arrow-in.png"
  1845. });
  1846. </script>
  1847. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  1848. <h3>Summary</h3>
  1849. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  1850. with real value (magnitude) output. The frequency resolution is
  1851. 43 Hz, useful detailed for audio visualization.</p>
  1852. <h3>Audio Connections</h3>
  1853. <table class=doc align=center cellpadding=3>
  1854. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1855. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1856. </table>
  1857. <h3>Functions</h3>
  1858. <p class=func><span class=keyword>available</span>();</p>
  1859. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1860. </p>
  1861. <p class=func><span class=keyword>read</span>(binNumber);</p>
  1862. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  1863. so 1.0 represents a full scale sine wave.
  1864. </p>
  1865. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  1866. <p class=desc>Read several frequency bins, returning their sum. The higher
  1867. audio octaves are represented by many bins, which are typically read
  1868. as a group for audio visualization.
  1869. </p>
  1870. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  1871. <p class=desc>This function does nothing. The 1024 point FFT always
  1872. updates at approximately 86 times per second.
  1873. </p>
  1874. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  1875. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  1876. is the default. Windowing may be disabled by NULL, but windowing
  1877. should be used for all non-periodic (music) signals, and all periodic
  1878. signals that are not exact integer division of the sample rate.
  1879. </p>
  1880. <h3>Examples</h3>
  1881. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  1882. </p>
  1883. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  1884. </p>
  1885. <h3>Notes</h3>
  1886. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1887. num is 0 to 511.</p>
  1888. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1889. <p>Window Types:
  1890. <ul>
  1891. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  1892. <li><span class=literal>AudioWindowBartlett1024</span></li>
  1893. <li><span class=literal>AudioWindowBlackman1024</span></li>
  1894. <li><span class=literal>AudioWindowFlattop1024</span></li>
  1895. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  1896. <li><span class=literal>AudioWindowNuttall1024</span></li>
  1897. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  1898. <li><span class=literal>AudioWindowWelch1024</span></li>
  1899. <li><span class=literal>AudioWindowHamming1024</span></li>
  1900. <li><span class=literal>AudioWindowCosine1024</span></li>
  1901. <li><span class=literal>AudioWindowTukey1024</span></li>
  1902. </ul>
  1903. </p>
  1904. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  1905. Average usage is much lower. Future versions might distribute the
  1906. load more evenly over time....
  1907. </p>
  1908. </script>
  1909. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  1910. <div class="form-row">
  1911. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1912. <input type="text" id="node-input-name" placeholder="Name">
  1913. </div>
  1914. </script>
  1915. <script type="text/javascript">
  1916. RED.nodes.registerType('AudioAnalyzeToneDetect',{
  1917. shortName: "tone",
  1918. inputs:1,
  1919. outputs:0,
  1920. category: 'analyze-function',
  1921. color:"#E6E0F8",
  1922. icon: "arrow-in.png"
  1923. });
  1924. </script>
  1925. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  1926. <h3>Summary</h3>
  1927. <p>Detect the level of a single tone</p>
  1928. <h3>Audio Connections</h3>
  1929. <table class=doc align=center cellpadding=3>
  1930. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1931. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1932. </table>
  1933. <h3>Functions</h3>
  1934. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1935. <p class=desc>Set the frequency to detect. The default detection time
  1936. will be 10 cycles of this frequency.
  1937. </p>
  1938. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  1939. <p class=desc>Set the frequency to detect, and the number of cycles.
  1940. Longer detection time (more cycles) will give higher precision,
  1941. but of course slower response.
  1942. </p>
  1943. <p class=func><span class=keyword>available</span>();</p>
  1944. <p class=desc>Returns true (non-zero) each time a detection interval
  1945. (number of cycles) completed and a new level is detected.
  1946. </p>
  1947. <p class=func><span class=keyword>read</span>();</p>
  1948. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  1949. </p>
  1950. <p class=func><span class=keyword>threshold</span>(level);</p>
  1951. <p class=desc>Set a detection threshold, where the bool test operation
  1952. will return true if at or above this level, or false when below.
  1953. </p>
  1954. <p class=func>(bool)</p>
  1955. <p class=desc>By testing the object as a boolean value, you can respond
  1956. to detection of a tone.
  1957. </p>
  1958. <h3>Examples</h3>
  1959. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  1960. </p>
  1961. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  1962. </p>
  1963. <h3>Notes</h3>
  1964. <p>Low frequency detection has trouble with numerical precision.
  1965. Works really well for all 8 DTMF frequencies, but fails for
  1966. detecting "sub audible tones" used in some control applications.</p>
  1967. <p>The (bool) test continues to return true until the next detection
  1968. interval (the configured number of cycles). This behavior may
  1969. change in future versions, for a single true each time the signal
  1970. is detected, and then false for the remainder of that interval.</p>
  1971. </script>
  1972. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  1973. <div class="form-row">
  1974. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1975. <input type="text" id="node-input-name" placeholder="Name">
  1976. </div>
  1977. </script>
  1978. <script type="text/javascript">
  1979. RED.nodes.registerType('AudioAnalyzePrint',{
  1980. shortName: "print",
  1981. inputs:1,
  1982. outputs:0,
  1983. category: 'analyze-function',
  1984. color:"#E6E0F8",
  1985. icon: "arrow-in.png"
  1986. });
  1987. </script>
  1988. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  1989. <h3>Summary</h3>
  1990. <p>Print raw audio data to the Arduino Serial Monitor. This
  1991. object creates massive output quickly, and should not normally be used.</p>
  1992. <h3>Audio Connections</h3>
  1993. <table class=doc align=center cellpadding=3>
  1994. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1995. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  1996. </table>
  1997. <h3>Functions</h3>
  1998. <p class=func><span class=keyword>name</span>(string);</p>
  1999. <p class=desc>blah blah blah blah
  2000. </p>
  2001. <p class=func><span class=keyword>trigger</span>();</p>
  2002. <p class=desc>blah blah blah blah
  2003. </p>
  2004. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  2005. <p class=desc>blah blah blah blah
  2006. </p>
  2007. <p class=func><span class=keyword>delay</span>(samples);</p>
  2008. <p class=desc>blah blah blah blah
  2009. </p>
  2010. <p class=func><span class=keyword>length</span>(samples);</p>
  2011. <p class=desc>blah blah blah blah
  2012. </p>
  2013. <!--<h3>Examples</h3>
  2014. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2015. </p>-->
  2016. <h3>Notes</h3>
  2017. <p>This object doesn't work very well and probably should not be used.</p>
  2018. </script>
  2019. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  2020. <div class="form-row">
  2021. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2022. <input type="text" id="node-input-name" placeholder="Name">
  2023. </div>
  2024. </script>
  2025. <script type="text/javascript">
  2026. RED.nodes.registerType('AudioControlSGTL5000',{
  2027. shortName: "sgtl5000",
  2028. inputs:0,
  2029. outputs:0,
  2030. category: 'control-function',
  2031. color:"#E6E0F8",
  2032. icon: "arrow-in.png"
  2033. });
  2034. </script>
  2035. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  2036. <h3>Summary</h3>
  2037. <p>Control the SGTL5000 chip on the
  2038. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  2039. SGTL5000 is always used in slave mode, where Teensy controls
  2040. all I2S timing.
  2041. </p>
  2042. <p align=center><img src="sgtl5000closeup.jpg"></p>
  2043. <h3>Audio Connections</h3>
  2044. <p>This object has no audio inputs or outputs. Separate i2s objects
  2045. are used to send and receive audio data. I2S master mode objects
  2046. must be used, because this object configures the SGTL5000 in slave
  2047. mode, where it depends on Teensy to provide all I2S clocks.
  2048. This object controls
  2049. how the SGTL5000 will use those I2S audio streams.</p>
  2050. <h3>Functions</h3>
  2051. <p>These are the most commonly used SGTL5000 functions.</p>
  2052. <p class=func><span class=keyword>enable</span>();</p>
  2053. <p class=desc>Start the SGTL5000. This function should be called first.
  2054. </p>
  2055. <p class=func><span class=keyword>volume</span>(level);</p>
  2056. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  2057. 0.8 corresponds to the maximum undistorted output for a full scale
  2058. signal. Usually 0.5 is a comfortable listening level. The line
  2059. level outputs are <em>not</em> changed by this function.
  2060. </p>
  2061. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2062. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  2063. </p>
  2064. <p class=func><span class=keyword>micGain</span>(dB);</p>
  2065. <p class=desc>When using the microphone input, set the amplifier gain.
  2066. The input number is in decibels, from 0 to 63.
  2067. </p>
  2068. <h3>Signal Levels</h3>
  2069. <p>The default signal levels should be used for most applications,
  2070. but these functions allow you to customize the analog signals.</p>
  2071. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  2072. <p class=desc>Silence the headphone output.
  2073. </p>
  2074. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  2075. <p class=desc>Turn the headphone output on.
  2076. </p>
  2077. <p class=func><span class=keyword>muteLineout</span>();</p>
  2078. <p class=desc>Silence the line level outputs.
  2079. </p>
  2080. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  2081. <p class=desc>Turn the line level outputs on.
  2082. </p>
  2083. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  2084. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  2085. Fifteen settings are possible:
  2086. </p>
  2087. <pre class="desc">
  2088. 0: 3.12 Volts p-p
  2089. 1: 2.63 Volts p-p
  2090. 2: 2.22 Volts p-p
  2091. 3: 1.87 Volts p-p
  2092. 4: 1.58 Volts p-p
  2093. 5: 1.33 Volts p-p (default)
  2094. 6: 1.11 Volts p-p
  2095. 7: 0.94 Volts p-p
  2096. 8: 0.79 Volts p-p
  2097. 9: 0.67 Volts p-p
  2098. 10: 0.56 Volts p-p
  2099. 11: 0.48 Volts p-p
  2100. 12: 0.40 Volts p-p
  2101. 13: 0.34 Volts p-p
  2102. 14: 0.29 Volts p-p
  2103. 15: 0.24 Volts p-p
  2104. </pre>
  2105. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  2106. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  2107. settings for left and right. The same 15 settings are available.
  2108. </p>
  2109. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  2110. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  2111. voltage range. The following settings are possible:
  2112. </p>
  2113. <pre class="desc">
  2114. 13: 3.16 Volts p-p
  2115. 14: 2.98 Volts p-p
  2116. 15: 2.83 Volts p-p
  2117. 16: 2.67 Volts p-p
  2118. 17: 2.53 Volts p-p
  2119. 18: 2.39 Volts p-p
  2120. 19: 2.26 Volts p-p
  2121. 20: 2.14 Volts p-p
  2122. 21: 2.02 Volts p-p
  2123. 22: 1.91 Volts p-p
  2124. 23: 1.80 Volts p-p
  2125. 24: 1.71 Volts p-p
  2126. 25: 1.62 Volts p-p
  2127. 26: 1.53 Volts p-p
  2128. 27: 1.44 Volts p-p
  2129. 28: 1.37 Volts p-p
  2130. 29: 1.29 Volts p-p (default)
  2131. 30: 1.22 Volts p-p
  2132. 31: 1.16 Volts p-p
  2133. </pre>
  2134. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  2135. <p class=desc>Adjust the line level outout voltage range, with separate
  2136. settings for left and right. The same settings (13 to 31) are available.
  2137. </p>
  2138. <h3>Signal Conditioning</h3>
  2139. <p>Usually these digital signal conditioning features should be left at their
  2140. default settings.
  2141. </p>
  2142. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  2143. <p class=desc>By default, the analog input (either line-level inputs or mic)
  2144. is high-pass filtered, to remove any DC component. This function
  2145. freezes the filter, so the current DC component is still substracted, but
  2146. the filter stops tracking any DC or low frequency changes.
  2147. </p>
  2148. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  2149. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  2150. low frequencies are allowed to enter the digital signal.
  2151. </p>
  2152. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  2153. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  2154. allows it to resume tracking DC and low frequency changes, if
  2155. previously frozen. This is the default setting.
  2156. </p>
  2157. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  2158. <p class=desc>Normally output volume should be used with volume(), which
  2159. changes the analog gain in the headphone amplifier. This function
  2160. on the other hand controls digital attenuation before conversion to analog, which
  2161. reduces resolution, but allows another fine control of output
  2162. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  2163. at 1.0.
  2164. </p>
  2165. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and ramping is handled by
  2166. the chip so that a new volume may be set directly in a single call.
  2167. </p>
  2168. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  2169. <p class=desc>Adjust the digital output volume separately on left and
  2170. right channels.
  2171. </p>
  2172. <h3>Audio Processor</h3>
  2173. <p>The optional digital audio processor is capable of implementing
  2174. one or more of: automatic volume control, surround sound control,
  2175. bass enhancement, and tonal adjustments (either a
  2176. simple tone control, or a parametric equalizer, or a graphic equalizer),
  2177. in that order.
  2178. </p>
  2179. <p>These signal processing features are implemented in the SGTL5000 chip,
  2180. so they do not consume CPU time on Teensy. However, the order of
  2181. these processes is fixed in the hardware.
  2182. </p>
  2183. <p>It is good practice to mute the outputs before enabling or disabling
  2184. the Audio Processor, to avoid clicks or thumps.
  2185. </p>
  2186. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  2187. <p class=desc>Enable the audio processor to pre-process the input
  2188. (from either line-level inputs or microphone) before it's sent
  2189. to Teensy by I2S.
  2190. </p>
  2191. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  2192. <p class=desc>Enable the audio processor to post-process Teensy's
  2193. I2S output before it's turned into analog signals for the
  2194. headphones and/or line level outputs.
  2195. </p>
  2196. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  2197. <p class=desc>Disable the audio processor.
  2198. </p>
  2199. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  2200. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  2201. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  2202. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  2203. as 2. <em>response</em> controls the integration time for the compressor and can take
  2204. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  2205. over a longer time, allowing short-term peaks through.
  2206. </p>
  2207. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  2208. knee' compressor is used to progressively compress louder values which are near to or above the
  2209. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  2210. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  2211. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  2212. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  2213. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  2214. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  2215. </p>
  2216. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  2217. <p class=desc>Enables auto volume control, using the previously specified settings.
  2218. </p>
  2219. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  2220. <p class=desc>Disables auto volume control.
  2221. </p>
  2222. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  2223. <p class=desc>Enable virtual surround processing, to give a broader and
  2224. deeper stereo image (even with mono input).
  2225. </p>
  2226. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  2227. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  2228. the width to maximum to avoid pops.
  2229. </p>
  2230. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  2231. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2232. </p>
  2233. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  2234. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2235. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  2236. </p>
  2237. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  2238. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  2239. the original stereo signal has bass levels boosted and is then mixed back into
  2240. the stereo signal, which is then optionally high pass filtered (to remove
  2241. inaudible subsonic frequencies).
  2242. </p>
  2243. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  2244. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  2245. enhancement level to zero.
  2246. </p>
  2247. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  2248. <p class=desc>Configures the bass enhancement by setting the levels of the
  2249. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2250. There is no high-pass filter.
  2251. </p>
  2252. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2253. steps of 0.5dB, to avoid pops.
  2254. </p>
  2255. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  2256. <p class=desc>Configures the bass enhancement by setting the levels of the
  2257. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2258. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  2259. as follows:
  2260. </p>
  2261. <pre class="desc">
  2262. value frequency
  2263. 0 80Hz
  2264. 1 100Hz
  2265. 2 125Hz
  2266. 3 150Hz
  2267. 4 175Hz
  2268. 5 200Hz
  2269. 6 225Hz
  2270. </pre>
  2271. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2272. steps of 0.5dB, to avoid pops.
  2273. </p>
  2274. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  2275. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  2276. one of</p>
  2277. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  2278. Equalizers and tone controls disabled, flat frequency response.</p>
  2279. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  2280. Enables the 7-band parametric equalizer, thus disabling the
  2281. tone controls and graphic equalizer.</p>
  2282. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  2283. Enables bass and treble tone controls, disabling the parametric
  2284. equalization and graphic equalizer.</p>
  2285. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  2286. Enables the five-band graphic equalizer, disabling the parametric
  2287. equalization and tone controls.</p>
  2288. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  2289. <p class=desc>Configures bass and treble tone controls, which are
  2290. implemented as one second order low pass filter (bass) in parallel with
  2291. one second order high pass filter (treble).
  2292. </p>
  2293. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  2294. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  2295. </p>
  2296. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  2297. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  2298. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  2299. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  2300. </p>
  2301. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  2302. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  2303. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  2304. </p>
  2305. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  2306. to avoid pops.
  2307. </p>
  2308. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  2309. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  2310. is specified along with a pointer to an array of filter coefficients.
  2311. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  2312. filters whose frequencies, gain, and Q may be freely configured, but each filter
  2313. can only be specified as a set of filter coefficients.
  2314. </p>
  2315. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  2316. <p class=desc>Enables zero or more of the already enabled parametric filters.
  2317. </p>
  2318. <h3>Examples</h3>
  2319. <p>Nearly all of the library's examples use this object. These
  2320. examples demonstrate its special features.
  2321. </p>
  2322. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  2323. </p>
  2324. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  2325. </p>
  2326. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  2327. </p>
  2328. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  2329. </p>
  2330. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  2331. </p>
  2332. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  2333. </p>
  2334. <h3>Notes</h3>
  2335. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  2336. and surround enhancement while speech uses bandpass filtering and auto volume control
  2337. compression.
  2338. </p>
  2339. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  2340. </p>
  2341. </script>
  2342. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  2343. <div class="form-row">
  2344. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2345. <input type="text" id="node-input-name" placeholder="Name">
  2346. </div>
  2347. </script>
  2348. <script type="text/javascript">
  2349. RED.nodes.registerType('AudioControlWM8731',{
  2350. shortName: "wm8731",
  2351. inputs:0,
  2352. outputs:0,
  2353. category: 'control-function',
  2354. color:"#E6E0F8",
  2355. icon: "arrow-in.png"
  2356. });
  2357. </script>
  2358. <script type="text/x-red" data-help-name="AudioControlWM8731">
  2359. <h3>Summary</h3>
  2360. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  2361. <h3>Audio Connections</h3>
  2362. <p>This object has no audio inputs or outputs. Separate i2s objects
  2363. are used to send and receive audio data. I2S master mode objects
  2364. must be used, since this control object configures the WM8731 into
  2365. slave mode.
  2366. </p>
  2367. <h3>Functions</h3>
  2368. <p class=func><span class=keyword>enable</span>();</p>
  2369. <p class=desc>blah blah blah blah
  2370. </p>
  2371. <p class=func><span class=keyword>disable</span>();</p>
  2372. <p class=desc>not implemented
  2373. </p>
  2374. <p class=func><span class=keyword>volume</span>(level);</p>
  2375. <p class=desc>blah blah blah blah
  2376. </p>
  2377. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2378. <p class=desc>not implemented
  2379. </p>
  2380. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2381. <p class=desc>not implemented
  2382. </p>
  2383. <!--<h3>Examples</h3>
  2384. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2385. </p>-->
  2386. <h3>Notes</h3>
  2387. <p></p>
  2388. </script>
  2389. <script type="text/x-red" data-template-name="AudioControlWM8731">
  2390. <div class="form-row">
  2391. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2392. <input type="text" id="node-input-name" placeholder="Name">
  2393. </div>
  2394. </script>
  2395. <script type="text/javascript">
  2396. RED.nodes.registerType('AudioControlWM8731master',{
  2397. shortName: "wm8731m",
  2398. inputs:0,
  2399. outputs:0,
  2400. category: 'control-function',
  2401. color:"#E6E0F8",
  2402. icon: "arrow-in.png"
  2403. });
  2404. </script>
  2405. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  2406. <h3>Summary</h3>
  2407. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  2408. <h3>Audio Connections</h3>
  2409. <p>This object has no audio inputs or outputs. Separate i2s objects
  2410. are used to send and receive audio data. I2S slave mode objects
  2411. must be used, since this control object configures the WM8731 into
  2412. master mode.
  2413. </p>
  2414. <h3>Functions</h3>
  2415. <p class=func><span class=keyword>enable</span>();</p>
  2416. <p class=desc>blah blah blah blah
  2417. </p>
  2418. <p class=func><span class=keyword>disable</span>();</p>
  2419. <p class=desc>not implemented
  2420. </p>
  2421. <p class=func><span class=keyword>volume</span>(level);</p>
  2422. <p class=desc>blah blah blah blah
  2423. </p>
  2424. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2425. <p class=desc>not implemented
  2426. </p>
  2427. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2428. <p class=desc>not implemented
  2429. </p>
  2430. <h3>Examples</h3>
  2431. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  2432. </p>
  2433. <h3>Notes</h3>
  2434. <p></p>
  2435. </script>
  2436. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  2437. <div class="form-row">
  2438. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2439. <input type="text" id="node-input-name" placeholder="Name">
  2440. </div>
  2441. </script>