You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3253 lines
143KB

  1. <!DOCTYPE html>
  2. <!-- vim: set ts=4: -->
  3. <html>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="mobile-web-app-capable" content="yes">
  8. <!--
  9. Modified from original Node-Red source, for audio system visualization
  10. Copyright 2013 IBM Corp.
  11. Licensed under the Apache License, Version 2.0 (the "License");
  12. you may not use this file except in compliance with the License.
  13. You may obtain a copy of the License at
  14. http://www.apache.org/licenses/LICENSE-2.0
  15. Unless required by applicable law or agreed to in writing, software
  16. distributed under the License is distributed on an "AS IS" BASIS,
  17. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. See the License for the specific language governing permissions and
  19. limitations under the License.
  20. -->
  21. <head>
  22. <title>Audio System Design Tool for Teensy Audio Library</title>
  23. <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
  24. <link href="jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" media="screen">
  25. <link rel="stylesheet" type="text/css" href="orion/built-editor.css"/>
  26. <link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css"/>
  27. <link rel="stylesheet" href="style.css">
  28. <style>
  29. table.doc {border-spacing:3px; border-collapse:separate; font-size: 80%}
  30. tr.top {background-color:#C0C0C0}
  31. tr.odd {background-color:#F0F0F0}
  32. tr.even {background-color:#E0E0E0}
  33. p.func {padding-bottom:0; margin:0px}
  34. p.desc {padding-left:2em; margin:0px; padding-top:0.2em; padding-bottom:0.8em; font-size:0.75em}
  35. p.exam {padding-left:2em; text-indent:-1.2em; margin:0px; padding-top:0; padding-bottom:0.5em; font-size:0.75em; font-weight:bold}
  36. pre.desc {padding-left:3em; margin:0px; padding-top:0em; padding-bottom:0.8em; font-size:0.75em;
  37. background-color:#FFFFFF; border:0px; line-height:100%;
  38. }
  39. span.indent {padding-left:2em}
  40. span.literal {color: #006699}
  41. span.comment {color: #777755}
  42. span.keyword {color: #cc6600}
  43. span.function {color: #996600}
  44. span.mainfunction {color: #993300; font-weight: bolder}
  45. </style>
  46. </head>
  47. <body spellcheck="false">
  48. <div class="navbar navbar-inverse navbar-fixed-top">
  49. <div class="navbar-inner">
  50. <div class="container-fluid">
  51. <span class="brand">Audio System Design Tool for <a href="http://www.pjrc.com/teensy/td_libs_Audio.html" target="_blank">Teensy Audio Library</a></span>
  52. <div class="btn-group pull-right">
  53. <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-align-justify"></i> <span class="caret"></span></a>
  54. <ul class="dropdown-menu">
  55. <li><a id="btn-sidebar" tabindex="-1" href="#"><i class="icon-ok pull-right"></i><i class="icon-list-alt"></i> Sidebar</a></li>
  56. <li class="divider"></li>
  57. <!-- <li><a id="btn-node-status" tabindex="-1" href="#"><i class="icon-ok pull-right"></i><i class="icon-info-sign"></i> Node Status</a></li>
  58. <li class="divider"></li>
  59. -->
  60. <!--
  61. <li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-edit"></i> Import from...</a>
  62. <ul class="dropdown-menu">
  63. <li><a id="btn-import" tabindex="-1" href="#"><i class="icon-edit"></i> Clipboard...</a></li>
  64. <li id="flow-menu-parent" class="dropdown-submenu pull-left">
  65. <a tabindex="-1" href="#"><i class="icon-book"></i> Library</a>
  66. <ul class="dropdown-menu"></ul>
  67. </li>
  68. </ul>
  69. </li>
  70. <li id="li-menu-export" class="dropdown-submenu disabled pull-left"><a tabindex="-1" href="#"><i class="icon-share"></i> Export to...</a>
  71. <ul class="dropdown-menu">
  72. <li id="li-menu-export-clipboard" class="disabled"><a id="btn-export-clipboard" tabindex="-1" href="#"><i class="icon-share"></i> Clipboard...</a></li>
  73. <li id="li-menu-export-library" class="disabled"><a id="btn-export-library" tabindex="-1" href="#"><i class="icon-book"></i> Library...</a></li>
  74. </ul>
  75. </li>
  76. <li class="divider"></li>
  77. -->
  78. <!--
  79. <li><a id="btn-config-nodes" tabindex="-1" href="#"><i class="icon-th-list"></i> Configuration nodes...</a></li>
  80. <li class="divider"></li>
  81. -->
  82. <!--
  83. <li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-th-large"></i> Workspaces</a>
  84. <ul id="workspace-menu-list" class="dropdown-menu">
  85. <li><a id="btn-workspace-add" tabindex="-1" href="#"><i class="icon-plus"></i> Add</a></li>
  86. <li><a id="btn-workspace-edit" tabindex="-1" href="#"><i class="icon-edit"></i> Rename</a></li>
  87. <li><a id="btn-workspace-delete" tabindex="-1" href="#"><i class="icon-minus"></i> Delete</a></li>
  88. <li class="divider"></li>
  89. </ul>
  90. </li>
  91. <li class="divider"></li>-->
  92. <li><a id="btn-keyboard-shortcuts" tabindex="-1" href="#"><i class="icon-question-sign"></i> Keyboard Shortcuts</a></li>
  93. <li><a id="btn-help" tabindex="-1" href="http://node-red.github.io/docs" target="_blank"><i class="icon-question-sign"></i> Help...</a></li>
  94. </ul>
  95. </div>
  96. <div class="btn-group pull-left">
  97. <a id="btn-deploy" class="btn action-deploy disabled" href="#"><i id="btn-icn-deploy" class="icon-upload"></i>Export</a>
  98. <a id="btn-import" class="btn action-import disabled" href="#"><i id="btn-icn-download" class="icon-download"></i>Import</a>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div id="main-container" class="sidebar-closed">
  104. <div id="palette">
  105. <img src="img/spin.svg" class="palette-spinner"/>
  106. <div id="palette-container" class="palette-scroll">
  107. </div>
  108. <div id="palette-search">
  109. <i class="icon-search"></i><input id="palette-search-input" type="text" placeholder="filter"><a href="#" id="palette-search-clear"><i class="icon-remove"></i></a></input>
  110. </div>
  111. </div><!-- /palette -->
  112. <div id="workspace">
  113. <ul id="workspace-tabs"></ul>
  114. <!--<div id="workspace-add-tab"><a id="btn-workspace-add-tab" href="#"><i class="icon-plus"></i></a></div>-->
  115. <div id="chart"></div>
  116. <div id="workspace-toolbar">
  117. <div class="btn-group">
  118. <a class="btn btn-small" href="#"><i class="icon-zoom-out"></i></a>
  119. <a class="btn btn-small" href="#"><i class="icon-th"></i></a>
  120. <a class="btn btn-small" href="#"><i class="icon-zoom-in"></i></a>
  121. </div>
  122. </div>
  123. </div>
  124. <div id="chart-zoom-controls">
  125. <div class="btn-group">
  126. <a class="btn btn-mini" id="btn-zoom-out" href="#"><i class="icon-zoom-out"></i></a>
  127. <a class="btn btn-mini" id="btn-zoom-zero" href="#"><i class="icon-th"></i></a>
  128. <a class="btn btn-mini" id="btn-zoom-in" href="#"><i class="icon-zoom-in"></i></a>
  129. </div>
  130. </div>
  131. <div id="sidebar">
  132. <ul id="sidebar-tabs"></ul>
  133. <div id="sidebar-content"></div>
  134. </div>
  135. <div id="sidebar-separator"></div>
  136. </div>
  137. <div id="notifications"></div>
  138. <div id="dropTarget"><div>Drop the flow here</div></div>
  139. <div id="dialog" class="hide"><form id="dialog-form" class="form-horizontal"></form></div>
  140. <div id="node-config-dialog" class="hide"><form id="dialog-config-form" class="form-horizontal"></form><div class="form-tips" id="node-config-dialog-user-count"></div></div>
  141. <div id="node-dialog-confirm-deploy" class="hide">
  142. <form class="form-horizontal">
  143. <div id="node-dialog-confirm-deploy-config" style="text-align: center; padding-top: 30px;">
  144. Some of the nodes are not properly configured. Are you sure you want to deploy?
  145. </div>
  146. <div id="node-dialog-confirm-deploy-unknown" style="text-align: center; padding-top: 10px;">
  147. The workspace contains some unknown node types:
  148. <ul style="width: 300px; margin: auto; text-align: left;" id="node-dialog-confirm-deploy-unknown-list"></ul>
  149. Are you sure you want to deploy?
  150. </div>
  151. </form>
  152. </div>
  153. <div id="node-dialog-error-deploy" class="hide">
  154. <form class="form-horizontal">
  155. <div id="node-dialog-error-deploy-noio" style="text-align: center; padding-top: 10px;">
  156. <p>The workspace contains no input/output nodes!</p>
  157. <p>You need an input or an output to export the data!</p>
  158. <p>Without such a input/output function the exported
  159. code will not run properly!</p>
  160. </div>
  161. </form>
  162. </div>
  163. <div id="node-help" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="node-help-label" aria-hidden="true">
  164. <div class="modal-header">
  165. <h5 id="node-help-label">Keyboard Shortcuts <span style="float: right;"><a href="http://node-red.github.io/docs" target="_blank">Open help in new window &raquo;</a></span></h5>
  166. </div>
  167. <div class="modal-body">
  168. <table>
  169. <tr>
  170. <td><span class="help-key">?</span></td><td>Help</td>
  171. <td><span class="help-key">Ctrl</span> <span class="help-key">a</span></td><td>Select all nodes</td>
  172. </tr>
  173. <tr>
  174. <td><span class="help-key">Ctrl</span> <span class="help-key">Space</span></td><td>Toggle sidebar</td>
  175. <td><span class="help-key">Shift</span> <span class="help-key">Click</span></td><td>Select all connected nodes</td>
  176. </tr>
  177. <tr>
  178. <td><span class="help-key">Ctrl</span> <span class="help-key">z</span></td><td>Undo</td>
  179. <td><span class="help-key">Ctrl</span> <span class="help-key">Click</span></td><td>Add/remove node from selection</td>
  180. </tr>
  181. <tr>
  182. <td></td><td></td>
  183. <td><span class="help-key">Delete</span></td><td>Delete selected nodes or link</td>
  184. </tr>
  185. <tr>
  186. <td><span class="help-key">Ctrl</span> <span class="help-key">x</span></td><td>Cut selected nodes</td>
  187. <td></td><td></td>
  188. </tr>
  189. <tr>
  190. <td><span class="help-key">Ctrl</span> <span class="help-key">c</span></td><td>Copy selected nodes</td>
  191. <td><span class="help-key">Ctrl</span> <span class="help-key">v</span></td><td>Paste nodes</td>
  192. </tr>
  193. <tr>
  194. <td><span class="help-key">Ctrl</span> <span class="help-key">i</span></td><td>Import nodes</td>
  195. <td><span class="help-key">Ctrl</span> <span class="help-key">e</span></td><td>Export selected nodes</td>
  196. </tr>
  197. <tr>
  198. <td colspan="2"></td>
  199. </tr>
  200. <tr>
  201. <td><span class="help-key">Ctrl</span> <span class="help-key">+</span></td><td>Zoom in</td>
  202. <td><span class="help-key">Ctrl</span> <span class="help-key">-</span></td><td>Zoom out</td>
  203. </tr>
  204. </table>
  205. </div>
  206. <div class="modal-footer">
  207. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  208. </div>
  209. </div>
  210. <div id="node-dialog-library-save-confirm" class="hide">
  211. <form class="form-horizontal">
  212. <div style="text-align: center; padding-top: 30px;">
  213. A <span id="node-dialog-library-save-type"></span> called <span id="node-dialog-library-save-name"></span> already exists. Overwrite?
  214. </div>
  215. </form>
  216. </div>
  217. <div id="node-dialog-library-save" class="hide">
  218. <form class="form-horizontal">
  219. <div class="form-row">
  220. <label for="node-dialog-library-save-folder"><i class="icon-folder-open"></i> Folder</label>
  221. <input type="text" id="node-dialog-library-save-folder" placeholder="Folder">
  222. </div>
  223. <div class="form-row">
  224. <label for="node-dialog-library-save-filename"><i class="icon-file"></i> Filename</label>
  225. <input type="text" id="node-dialog-library-save-filename" placeholder="Filename">
  226. </div>
  227. </form>
  228. </div>
  229. <div id="node-dialog-library-lookup" class="hide">
  230. <form class="form-horizontal">
  231. <div class="form-row">
  232. <ul id="node-dialog-library-breadcrumbs" class="breadcrumb">
  233. <li class="active"><a href="#">Library</a></li>
  234. </ul>
  235. </div>
  236. <div class="form-row">
  237. <div style="vertical-align: top; display: inline-block; height: 100%; width: 30%; padding-right: 20px;">
  238. <div id="node-select-library" style="border: 1px solid #999; width: 100%; height: 100%; overflow:scroll;"><ul></ul></div>
  239. </div>
  240. <div style="vertical-align: top; display: inline-block;width: 65%; height: 100%;">
  241. <div style="height: 100%; width: 95%;" class="node-text-editor" id="node-select-library-text" ></div>
  242. </div>
  243. </div>
  244. </form>
  245. </div>
  246. <div id="node-dialog-rename-workspace" class="hide">
  247. <form class="form-horizontal">
  248. <div class="form-row">
  249. <label for="node-input-workspace-name" ><i class="icon-tag"></i> Name:</label>
  250. <input type="text" id="node-input-workspace-name">
  251. </div>
  252. </form>
  253. </div>
  254. <div id="node-dialog-delete-workspace" class="hide">
  255. <form class="form-horizontal">
  256. <div style="text-align: center; padding-top: 30px;">
  257. Are you sure you want to delete '<span id="node-dialog-delete-workspace-name"></span>'?
  258. </div>
  259. </form>
  260. </div>
  261. <script type="text/x-red" data-template-name="export-clipboard-dialog">
  262. <div class="form-row">
  263. <label for="node-input-export" style="display: block; width:100%;"><i class="icon-share"></i> Source Code:</label>
  264. <textarea readonly style="font-family: monospace; font-size: 12px; background:rgb(226, 229, 255); padding-left: 0.5em;" class="input-block-level" id="node-input-export" rows="12"></textarea>
  265. </div>
  266. <div class="form-tips">
  267. Select the text above and copy to the clipboard with Ctrl-A Ctrl-C.
  268. </div>
  269. </script>
  270. <script type="text/x-red" data-template-name="export-library-dialog">
  271. <div class="form-row">
  272. <label for="node-input-filename" ><i class="icon-tag"></i> Filename:</label>
  273. <input type="text" id="node-input-filename" placeholder="Filename">
  274. </div>
  275. </script>
  276. <script type="text/x-red" data-template-name="import-dialog">
  277. <div class="form-row">
  278. <label for="node-input-import"><i class="icon-share"></i>Nodes:</label>
  279. <textarea style="font-family: monospace; font-size: 12px; background:rgb(226, 229, 255); padding-left: 0.5em;" class="input-block-level" id="node-input-import" rows="5" placeholder="Paste nodes here, or lookup in the library. When importing Arduino code, the whole flow will be replaced."></textarea>
  280. </div>
  281. <div class="form-tips">
  282. <label for="node-input-arduino" style="font-size: 13px; padding: 2px 0px 0px 4px;">
  283. <input style="margin-bottom: 4px; margin-right: 4px;" type="checkbox" id="node-input-arduino" checked="checked" class="input-block-level" />
  284. &nbsp;Import copied code from the Arduino IDE
  285. </label>
  286. </div>
  287. </script>
  288. <script src="jquery/js/jquery-1.9.1.js"></script>
  289. <script src="bootstrap/js/bootstrap.min.js"></script>
  290. <script src="jquery/js/jquery-ui-1.10.3.custom.min.js"></script>
  291. <script src="jquery/js/jquery.ui.touch-punch.min.js"></script>
  292. <script src="orion/built-editor.min.js"></script>
  293. <script src="red/d3/d3.v3.min.js"></script>
  294. <script src="red/main.js"></script>
  295. <script src="red/ui/state.js"></script>
  296. <script src="red/nodes.js"></script>
  297. <script src="red/storage.js"></script>
  298. <script src="red/history.js"></script>
  299. <script src="red/ui/keyboard.js"></script>
  300. <script src="red/ui/tabs.js"></script>
  301. <script src="red/ui/view.js"></script>
  302. <script src="red/ui/sidebar.js"></script>
  303. <script src="red/ui/palette.js"></script>
  304. <script src="red/ui/tab-info.js"></script>
  305. <script src="red/ui/tab-config.js"></script>
  306. <script src="red/ui/editor.js"></script>
  307. <script src="red/ui/library.js"></script>
  308. <script src="red/ui/notifications.js"></script>
  309. <script src="red/ui/touch/radialMenu.js"></script>
  310. <!--
  311. TODO: generate some or all of this automatically from the C++ source
  312. -->
  313. <!--
  314. TODO: add a field for maximum instance count
  315. -->
  316. <!--
  317. TODO: add a field for exclusive to other objects (not allowed if they're used)
  318. -->
  319. <!--
  320. TODO: add "parameters" fields, to replace the form html stuff
  321. -->
  322. <script type="text/x-red" data-container-name="NodeDefinitions">
  323. {"nodes":[
  324. {"type":"AudioInputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  325. {"type":"AudioInputI2SQuad","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s_quad","inputs":0,"outputs":4,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  326. {"type":"AudioInputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"adc","inputs":0,"outputs":1,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  327. {"type":"AudioInputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2ss","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  328. {"type":"AudioOutputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  329. {"type":"AudioOutputI2SQuad","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s_quad","inputs":4,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  330. {"type":"AudioOutputSPDIF","data":{"defaults":{"name":{"value":"new"}},"shortName":"spdif","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  331. {"type":"AudioOutputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"dac","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  332. {"type":"AudioOutputPWM","data":{"defaults":{"name":{"value":"new"}},"shortName":"pwm","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  333. {"type":"AudioOutputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2ss","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  334. {"type":"AudioMixer4","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer","inputs":4,"outputs":1,"category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  335. {"type":"AudioPlayMemory","data":{"defaults":{"name":{"value":"new"}},"shortName":"playMem","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  336. {"type":"AudioPlaySdWav","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdWav","inputs":0,"outputs":2,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  337. {"type":"AudioPlaySdRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  338. {"type":"AudioPlaySerialflashRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playFlashRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  339. {"type":"AudioPlayQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  340. {"type":"AudioRecordQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":1,"outputs":0,"category":"record-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  341. {"type":"AudioSynthWaveformSine","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  342. {"type":"AudioSynthWaveformSineHires","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine_hires","inputs":0,"outputs":2,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  343. {"type":"AudioSynthWaveformSineModulated","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine_fm","inputs":1,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  344. {"type":"AudioSynthWaveform","data":{"defaults":{"name":{"value":"new"}},"shortName":"waveform","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  345. {"type":"AudioSynthToneSweep","data":{"defaults":{"name":{"value":"new"}},"shortName":"tonesweep","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  346. {"type":"AudioSynthWaveformDc","data":{"defaults":{"name":{"value":"new"}},"shortName":"dc","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  347. {"type":"AudioSynthNoiseWhite","data":{"defaults":{"name":{"value":"new"}},"shortName":"noise","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  348. {"type":"AudioSynthNoisePink","data":{"defaults":{"name":{"value":"new"}},"shortName":"pink","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  349. {"type":"AudioEffectFade","data":{"defaults":{"name":{"value":"new"}},"shortName":"fade","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  350. {"type":"AudioEffectChorus","data":{"defaults":{"name":{"value":"new"}},"shortName":"chorus","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  351. {"type":"AudioEffectFlange","data":{"defaults":{"name":{"value":"new"}},"shortName":"flange","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  352. {"type":"AudioEffectEnvelope","data":{"defaults":{"name":{"value":"new"}},"shortName":"envelope","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  353. {"type":"AudioEffectMultiply","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":2,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  354. {"type":"AudioEffectDelay","data":{"defaults":{"name":{"value":"new"}},"shortName":"delay","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  355. {"type":"AudioEffectDelayExternal","data":{"defaults":{"name":{"value":"new"}},"shortName":"delayExt","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  356. {"type":"AudioEffectBitcrusher","data":{"shortName":"bitcrusher","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  357. {"type":"AudioEffectMidSide","data":{"shortName":"midside","inputs":2,"outputs":2,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  358. {"type":"AudioFilterBiquad","data":{"defaults":{"name":{"value":"new"}},"shortName":"biquad","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  359. {"type":"AudioFilterFIR","data":{"defaults":{"name":{"value":"new"}},"shortName":"fir","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  360. {"type":"AudioFilterStateVariable","data":{"defaults":{"name":{"value":"new"}},"shortName":"filter","inputs":2,"outputs":3,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  361. {"type":"AudioAnalyzePeak","data":{"defaults":{"name":{"value":"new"}},"shortName":"peak","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  362. {"type":"AudioAnalyzeRMS","data":{"defaults":{"name":{"value":"new"}},"shortName":"rms","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  363. {"type":"AudioAnalyzeFFT256","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft256","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  364. {"type":"AudioAnalyzeFFT1024","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft1024","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  365. {"type":"AudioAnalyzeToneDetect","data":{"defaults":{"name":{"value":"new"}},"shortName":"tone","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  366. {"type":"AudioAnalyzeNoteFrequency","data":{"defaults":{"name":{"value":"new"}},"shortName":"notefreq","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  367. {"type":"AudioAnalyzePrint","data":{"defaults":{"name":{"value":"new"}},"shortName":"print","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  368. {"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  369. {"type":"AudioControlAK4558","data":{"defaults":{"name":{"value":"new"}},"shortName":"ak4558","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  370. {"type":"AudioControlCS4272","data":{"defaults":{"name":{"value":"new"}},"shortName":"cs4272","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  371. {"type":"AudioControlWM8731","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  372. {"type":"AudioControlWM8731master","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731m","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}}
  373. ]}
  374. </script>
  375. <script type="text/x-red" data-help-name="AudioInputI2S">
  376. <h3>Summary</h3>
  377. <div class=tooltipinfo>
  378. <p>Receive 16 bit stereo audio from the
  379. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  380. or another I2S device, using I2S master mode.</p>
  381. <p align=center><img src="img/audioshield_inputs.jpg"></p>
  382. </div>
  383. <h3>Audio Connections</h3>
  384. <table class=doc align=center cellpadding=3>
  385. <tr class=top><th>Port</th><th>Purpose</th></tr>
  386. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  387. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  388. </table>
  389. <h3>Functions</h3>
  390. <p>This object has no functions to call from the Arduino sketch. It
  391. simply streams data from the I2S hardware to its 2 output ports.</p>
  392. <h3>Hardware</h3>
  393. <p align=center><img src="img/audioshield_backside.jpg"></p>
  394. <p>The I2S signals are used in "master" mode, where Teensy creates
  395. all 3 clock signals and controls all data timing.</p>
  396. <table class=doc align=center cellpadding=3>
  397. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  398. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  399. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  400. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  401. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  402. </table>
  403. <p>Audio from
  404. master mode I2S may be used in the same project as ADC, DAC and
  405. PWM signals, because all remain in sync to Teensy's timing</p>
  406. <h3>Examples</h3>
  407. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  408. </p>
  409. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  410. </p>
  411. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  412. </p>
  413. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  414. </p>
  415. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  416. </p>
  417. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  418. </p>
  419. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  420. </p>
  421. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  422. </p>
  423. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  424. </p>
  425. <h3>Notes</h3>
  426. <p>Normally, this object is used with the Audio Shield, which
  427. is controlled separately by the "sgtl5000" object.</p>
  428. <p>Only one I2S input and one I2S output object may be used. Master
  429. and slave modes may not be mixed (both must be of the same type).
  430. </p>
  431. <p>I2S master objects can be used together with non-I2S input and output
  432. objects, for simultaneous audio streaming on different hardware.</p>
  433. </script>
  434. <script type="text/x-red" data-template-name="AudioInputI2S">
  435. <div class="form-row">
  436. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  437. <input type="text" id="node-input-name" placeholder="Name">
  438. </div>
  439. </script>
  440. <script type="text/x-red" data-help-name="AudioInputI2SQuad">
  441. <h3>Summary</h3>
  442. <div class=tooltipinfo>
  443. <p>Receive 16 bit quad (4) channel audio from two
  444. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shields</a>
  445. or another I2S devices, using I2S master mode.</p>
  446. <p align=center><img src="img/audioshield_quad_in.jpg"></p>
  447. </div>
  448. <h3>Audio Connections</h3>
  449. <table class=doc align=center cellpadding=3>
  450. <tr class=top><th>Port</th><th>Purpose</th></tr>
  451. <tr class=odd><td align=center>Out 0</td><td>Channel #1</td></tr>
  452. <tr class=odd><td align=center>Out 1</td><td>Channel #2</td></tr>
  453. <tr class=odd><td align=center>Out 2</td><td>Channel #3</td></tr>
  454. <tr class=odd><td align=center>Out 3</td><td>Channel #4</td></tr>
  455. </table>
  456. <h3>Functions</h3>
  457. <p>This object has no functions to call from the Arduino sketch. It
  458. simply streams data from the I2S hardware to its 4 output ports.</p>
  459. <h3>Hardware</h3>
  460. <p>See this Sparkfun blog for <a href="https://www.sparkfun.com/news/2055" target="_blank">how
  461. to connect two audio adaptors for 4 channel audio</a>.
  462. <p>The I2S signals are used in "master" mode, where Teensy creates
  463. all 3 clock signals and controls all data timing.</p>
  464. <table class=doc align=center cellpadding=3>
  465. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  466. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  467. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  468. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  469. <tr class=odd><td align=center>30</td><td>RX</td><td>Input</td></tr>
  470. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  471. </table>
  472. <p>Audio from
  473. master mode I2S may be used in the same project as ADC, DAC and
  474. PWM signals, because all remain in sync to Teensy's timing</p>
  475. <h3>Examples</h3>
  476. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughQuad
  477. </p>
  478. <h3>Notes</h3>
  479. <p>Normally, this object is used with two Audio Shield, which
  480. are controlled separately by a pair "sgtl5000" object.</p>
  481. </script>
  482. <script type="text/x-red" data-template-name="AudioInputI2SQuad">
  483. <div class="form-row">
  484. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  485. <input type="text" id="node-input-name" placeholder="Name">
  486. </div>
  487. </script>
  488. <script type="text/x-red" data-help-name="AudioInputAnalog">
  489. <h3>Summary</h3>
  490. <div class=tooltipinfo>
  491. <p>Receive audio using the built-in analog to digital converter.</p>
  492. </div>
  493. <h3>Audio Connections</h3>
  494. <table class=doc align=center cellpadding=3>
  495. <tr class=top><th>Port</th><th>Purpose</th></tr>
  496. <tr class=odd><td align=center>Out 0</td><td>Audio Channel</td></tr>
  497. </table>
  498. <h3>Functions</h3>
  499. <p>This object has no functions to call from the Arduino sketch. It
  500. simply streams data from the ADC to its output port.</p>
  501. <h3>Hardware</h3>
  502. <p>Pin A2 is used for audio input. This circuitry is recommended.</p>
  503. <p align=center><img src="img/adccircuit.png"></p>
  504. <p>Signal range is 0 to 1.2V</p>
  505. <h3>Examples</h3>
  506. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  507. </p>
  508. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  509. </p>
  510. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  511. </p>
  512. <h3>Notes</h3>
  513. <p>A different pin may be used, but adding it as an parameter
  514. to the AudioInputAnalog object definition.
  515. </p>
  516. <p>For example, to use pin A3:
  517. </p>
  518. <p class=desc><span class=keyword>AudioInputAnalog</span> adc1(<span class=literal>A3</span>);
  519. </p>
  520. <p>Noise due to high source impedance, which allows rapidly switching digital signals
  521. to capacitively couple... avoiding higher analog impedance is the solution.</p>
  522. <p>Power Supply rejection issue with simple DC bias (bigger capacitor may be needed if 3.3V has low frequency noise)</p>
  523. <p>Algorithm for automatic DC bias tracking</p>
  524. <p>TODO: actual noise measurements with different input circuitry
  525. (it's not as quiet as the audio shield)</p>
  526. </script>
  527. <script type="text/x-red" data-template-name="AudioInputAnalog">
  528. <div class="form-row">
  529. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  530. <input type="text" id="node-input-name" placeholder="Name">
  531. </div>
  532. </script>
  533. <script type="text/x-red" data-help-name="AudioInputI2Sslave">
  534. <h3>Summary</h3>
  535. <div class=tooltipinfo>
  536. <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p>
  537. </div>
  538. <h3>Audio Connections</h3>
  539. <table class=doc align=center cellpadding=3>
  540. <tr class=top><th>Port</th><th>Purpose</th></tr>
  541. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  542. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  543. </table>
  544. <h3>Functions</h3>
  545. <p>This object has no functions to call from the Arduino sketch. It
  546. simply streams data from the I2S hardware to its 2 output ports.</p>
  547. <h3>Hardware</h3>
  548. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  549. data timing.</p>
  550. <table class=doc align=center cellpadding=3>
  551. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  552. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  553. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  554. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  555. </table>
  556. <!--
  557. <h3>Examples</h3>
  558. <p class=exam>File &gt; Examples &gt; Audio &gt;
  559. </p>
  560. -->
  561. <h3>Notes</h3>
  562. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  563. PWM</b> signals. Differences in timing between the I2S device and
  564. Teensy's clock can cause occasional audio glitches when I2S slave mode
  565. is used together with other input or output objects based on Teensy's
  566. timing.</p>
  567. <p>Only one I2S input and one I2S output object may be used. Master
  568. and slave modes may not be mixed (both must be of the same type).
  569. </p>
  570. </script>
  571. <script type="text/x-red" data-template-name="AudioInputI2Sslave">
  572. <div class="form-row">
  573. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  574. <input type="text" id="node-input-name" placeholder="Name">
  575. </div>
  576. </script>
  577. <script type="text/x-red" data-help-name="AudioOutputI2S">
  578. <h3>Summary</h3>
  579. <div class=tooltipinfo>
  580. <p>Transmit 16 bit stereo audio to the
  581. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  582. or another I2S device, using I2S master mode.</p>
  583. <p align=center><img src="img/audioshield_outputs.jpg"></p>
  584. </div>
  585. <h3>Audio Connections</h3>
  586. <table class=doc align=center cellpadding=3>
  587. <tr class=top><th>Port</th><th>Purpose</th></tr>
  588. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  589. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  590. </table>
  591. <h3>Functions</h3>
  592. <p>This object has no functions to call from the Arduino sketch. It
  593. simply streams data from its 2 input ports to the I2S hardware.</p>
  594. <h3>Hardware</h3>
  595. <p align=center><img src="img/audioshield_backside.jpg"></p>
  596. <p>The I2S signals are used in "master" mode, where Teensy creates
  597. all 3 clock signals and controls all data timing.</p>
  598. <table class=doc align=center cellpadding=3>
  599. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  600. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  601. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  602. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  603. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  604. </table>
  605. <p>Audio from
  606. master mode I2S may be used in the same project as ADC, DAC and
  607. PWM signals, because all remain in sync to Teensy's timing</p>
  608. <h3>Examples</h3>
  609. <p>Nearly all the examples use this object. Here are some of the highlights:</p>
  610. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  611. </p>
  612. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  613. </p>
  614. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  615. </p>
  616. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  617. </p>
  618. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  619. </p>
  620. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  621. </p>
  622. <h3>Notes</h3>
  623. <p>Normally, this object is used with the Audio Shield, which
  624. is controlled separately by the "sgtl5000" object.</p>
  625. <p>Only one I2S input and one I2S output object may be used. Master
  626. and slave modes may not be mixed (both must be of the same type).
  627. </p>
  628. </script>
  629. <script type="text/x-red" data-template-name="AudioOutputI2S">
  630. <div class="form-row">
  631. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  632. <input type="text" id="node-input-name" placeholder="Name">
  633. </div>
  634. </script>
  635. <script type="text/x-red" data-help-name="AudioOutputI2SQuad">
  636. <h3>Summary</h3>
  637. <div class=tooltipinfo>
  638. <p>Transmit quad (4) channel 16 bit audio, using I2S master mode.</p>
  639. <p align=center><img src="img/audioshield_quad_out.jpg"></p>
  640. </div>
  641. <h3>Audio Connections</h3>
  642. <table class=doc align=center cellpadding=3>
  643. <tr class=top><th>Port</th><th>Purpose</th></tr>
  644. <tr class=odd><td align=center>In 0</td><td>Channel #1</td></tr>
  645. <tr class=odd><td align=center>In 1</td><td>Channel #2</td></tr>
  646. <tr class=odd><td align=center>In 2</td><td>Channel #3</td></tr>
  647. <tr class=odd><td align=center>In 3</td><td>Channel #4</td></tr>
  648. </table>
  649. <h3>Functions</h3>
  650. <p>This object has no functions to call from the Arduino sketch. It
  651. simply streams data from its 4 input ports to the I2S hardware.</p>
  652. <h3>Hardware</h3>
  653. <p>See this Sparkfun blog for <a href="https://www.sparkfun.com/news/2055" target="_blank">how
  654. to connect two audio adaptors for 4 channel audio</a>. More
  655. <a href="https://forum.pjrc.com/threads/29373-Bit-bang-multiple-I2S-inputs-simultaneously?p=79606#post79606" target="_blank">details</a> are also available.
  656. <p>The I2S signals are used in "master" mode, where Teensy creates
  657. all 3 clock signals and controls all data timing.</p>
  658. <table class=doc align=center cellpadding=3>
  659. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  660. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  661. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  662. <tr class=odd><td align=center>22</td><td>TX (ch 1+2)</td><td>Output</td></tr>
  663. <tr class=odd><td align=center>15</td><td>TX (ch 3+4)</td><td>Output</td></tr>
  664. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  665. </table>
  666. <p>Audio from
  667. master mode I2S may be used in the same project as ADC, DAC and
  668. PWM signals, because all remain in sync to Teensy's timing</p>
  669. <h3>Examples</h3>
  670. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughQuad
  671. </p>
  672. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; QuadChannelOutput
  673. </p>
  674. <h3>Notes</h3>
  675. <p>Normally, this object is used with two Audio Shields, which
  676. are controlled separately by a pair of "sgtl5000" objects.</p>
  677. </script>
  678. <script type="text/x-red" data-template-name="AudioOutputI2SQuad">
  679. <div class="form-row">
  680. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  681. <input type="text" id="node-input-name" placeholder="Name">
  682. </div>
  683. </script>
  684. <script type="text/x-red" data-help-name="AudioOutputSPDIF">
  685. <h3>Summary</h3>
  686. <div class=tooltipinfo>
  687. <p>Transmit 16 bit stereo audio as Digital S/PDIF.</p>
  688. <p align=center><img src="img/spdif_proto.jpg"></p>
  689. </div>
  690. <h3>Audio Connections</h3>
  691. <table class=doc align=center cellpadding=3>
  692. <tr class=top><th>Port</th><th>Purpose</th></tr>
  693. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  694. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  695. </table>
  696. <h3>Functions</h3>
  697. <p>This object has no functions to call from the Arduino sketch. It
  698. simply streams data from its 2 input ports S/PDIF encoded digital
  699. audio on pin 22.</p>
  700. <h3>Hardware</h3>
  701. <p>The S/PDIF output signal can be used to drive an optical TOSLINK
  702. cable, or a standard (usually orange) RCA jack.</p>
  703. <table class=doc align=center cellpadding=3>
  704. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  705. <tr class=odd><td align=center>22</td><td>S/PDIF</td><td>Output</td></tr>
  706. </table>
  707. <p>For optical TOSLINK output, this
  708. <a href="https://www.oshpark.com/shared_projects/KcDBKHta" target="_blank">OSH Park board</a>
  709. can be used with the inexpensive Everlight PLT133/T6A connector, available
  710. at Digikey, 1080-1434-ND.
  711. </p>
  712. <h3>Examples</h3>
  713. <p>The AudioOutputSPDIF object can be used in place of the AudioOutputI2S object,
  714. <p>used in nearly all the examples. The WavFilePlayer shows how to substitute
  715. output objects for different hardware types.
  716. </p>
  717. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  718. </p>
  719. <h3>Credits</h3>
  720. <p><a href="https://github.com/FrankBoesing" target="_blank">Frank Boesing</a>
  721. developed the AudioOutputSPDIF code. The original
  722. <a href="https://forum.pjrc.com/threads/28639-S-pdif" target="_blank">forum disussion</a>
  723. included valuable input and code from "kpc".
  724. <h3>Notes</h3>
  725. <p>S/PDIF output uses the I2S hardware. This object can not be used
  726. together with any of the I2S objects, because it requires the I2S
  727. hardware with different internal settings.</p>
  728. </p>
  729. </script>
  730. <script type="text/x-red" data-template-name="AudioOutputSPDIF">
  731. <div class="form-row">
  732. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  733. <input type="text" id="node-input-name" placeholder="Name">
  734. </div>
  735. </script>
  736. <script type="text/x-red" data-help-name="AudioOutputAnalog">
  737. <h3>Summary</h3>
  738. <div class=tooltipinfo>
  739. <p>Transmit 12 bit audio using Teensy 3.1's built-in digital to analog converter.</p>
  740. </div>
  741. <h3>Audio Connections</h3>
  742. <table class=doc align=center cellpadding=3>
  743. <tr class=top><th>Port</th><th>Purpose</th></tr>
  744. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  745. </table>
  746. <h3>Functions</h3>
  747. <p>This object has no functions to call from the Arduino sketch. It
  748. simply streams data from the ADC to its output port.</p>
  749. <h3>Hardware</h3>
  750. <p align=center><img src="img/dacpin.jpg"></p>
  751. <p>Signal range is 0 to 1.2V</p>
  752. <p>Most applications require at least a 10&micro;F DC-blocking capacitor.</p>
  753. <p>TODO: photo of Teensy 3.1 with 10&micro;F capacitor and 3.5mm jack.</p>
  754. <h3>Examples</h3>
  755. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  756. </p>
  757. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  758. </p>
  759. <h3>Notes</h3>
  760. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  761. not filtered. This may not
  762. be an issue for many uses, but care should be used if amplified and driven
  763. to high power tweeters.</p>
  764. </script>
  765. <script type="text/x-red" data-template-name="AudioOutputAnalog">
  766. <div class="form-row">
  767. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  768. <input type="text" id="node-input-name" placeholder="Name">
  769. </div>
  770. </script>
  771. <script type="text/x-red" data-help-name="AudioOutputPWM">
  772. <h3>Summary</h3>
  773. <div class=tooltipinfo>
  774. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  775. used for coarse and fine pulses, to be combined by scaled
  776. resistors.</p>
  777. </div>
  778. <h3>Audio Connections</h3>
  779. <table class=doc align=center cellpadding=3>
  780. <tr class=top><th>Port</th><th>Purpose</th></tr>
  781. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  782. </table>
  783. <h3>Functions</h3>
  784. <p>This object has no functions to call from the Arduino sketch. It
  785. simply streams data from the its input port to the PWM pins.</p>
  786. <h3>Hardware</h3>
  787. <p>The following circuit is recommended.</p>
  788. <p align=center><img src="img/pwmdualcircuit.jpg"></p>
  789. <p>Signal range is approx 1.55 Vp-p.</p>
  790. <p>These resistor values assume approx 20 ohms output impedance
  791. on the digital pins. The 127K resistor may be adjusted or
  792. trimmed for variation in output drive and tolerance on the
  793. 475 ohm resistor.</p>
  794. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  795. C0G/NPO ceramic capacitor should be used for filtering. Low
  796. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  797. <h3>Examples</h3>
  798. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  799. </p>
  800. <h3>Notes</h3>
  801. <p>This object only works properly when Tools > CPU_Speed is set to
  802. 48 or 96 MHz. Other speeds aren't supported and will likely fail
  803. in strange ways.</p>
  804. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  805. will only slightly filter the carrier. Extra filtering will be
  806. required for a clean signal without the ultrasonic PWM carrier.
  807. </p>
  808. <p>Analog signals created by filtering PWM waveforms use the digital
  809. power supply as their reference voltage. Any noise on the digital
  810. power line can directly couple to the output signal. The built-in DAC or
  811. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  812. should be used when higher quality signals are needed.</p>
  813. </script>
  814. <script type="text/x-red" data-template-name="AudioOutputPWM">
  815. <div class="form-row">
  816. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  817. <input type="text" id="node-input-name" placeholder="Name">
  818. </div>
  819. </script>
  820. <script type="text/x-red" data-help-name="AudioOutputI2Sslave">
  821. <h3>Summary</h3>
  822. <div class=tooltipinfo>
  823. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p>
  824. </div>
  825. <h3>Audio Connections</h3>
  826. <table class=doc align=center cellpadding=3>
  827. <tr class=top><th>Port</th><th>Purpose</th></tr>
  828. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  829. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  830. </table>
  831. <h3>Functions</h3>
  832. <p>This object has no functions to call from the Arduino sketch. It
  833. simply streams data from its 2 input ports to the I2S hardware.</p>
  834. <h3>Hardware</h3>
  835. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  836. data timing.</p>
  837. <table class=doc align=center cellpadding=3>
  838. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  839. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  840. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  841. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  842. </table>
  843. <h3>Examples</h3>
  844. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  845. </p>
  846. <h3>Notes</h3>
  847. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  848. PWM</b> signals. Differences in timing between the I2S device and
  849. Teensy's clock can cause occasional audio glitches when I2S slave mode
  850. is used together with other input or output objects based on Teensy's
  851. timing.</p>
  852. <p>Only one I2S input and one I2S output object may be used. Master
  853. and slave modes may not be mixed (both must be of the same type).
  854. </p>
  855. </script>
  856. <script type="text/x-red" data-template-name="AudioOutputI2Sslave">
  857. <div class="form-row">
  858. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  859. <input type="text" id="node-input-name" placeholder="Name">
  860. </div>
  861. </script>
  862. <script type="text/x-red" data-help-name="AudioMixer4">
  863. <h3>Summary</h3>
  864. <div class=tooltipinfo>
  865. <p>Combine up to 4 audio signals together, each with adjustable gain.
  866. All channels support signal attenuation or amplification.</p>
  867. </div>
  868. <h3>Audio Connections</h3>
  869. <table class=doc align=center cellpadding=3>
  870. <tr class=top><th>Port</th><th>Purpose</th></tr>
  871. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  872. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  873. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  874. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  875. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  876. </table>
  877. <h3>Functions</h3>
  878. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  879. <p class=desc>Adjust the amplification or attenuation. "channel" must
  880. be 0 to 3. "level" may be any floating point number from 0 to 32767.
  881. 1.0 passes the signal through directly. Level of 0 shuts the channel
  882. off completely. Between 0 to 1.0 attenuates the signal, and above
  883. 1.0 amplifies it. All 4 channels have separate settings.
  884. </p>
  885. <h3>Examples</h3>
  886. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  887. </p>
  888. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  889. </p>
  890. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  891. </p>
  892. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  893. </p>
  894. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  895. </p>
  896. <h3>Notes</h3>
  897. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  898. or when multiple signals add together to greater than 1.0.</p>
  899. <p>More than 4 channels may be combined by connecting multiple mixers
  900. in tandem. For example, a 16 channel mixer may be built using 5
  901. mixers, where the fifth mixer combines the outputs of the first 4.
  902. </p>
  903. </script>
  904. <script type="text/x-red" data-template-name="AudioMixer4">
  905. <div class="form-row">
  906. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  907. <input type="text" id="node-input-name" placeholder="Name">
  908. </div>
  909. </script>
  910. <script type="text/x-red" data-help-name="AudioPlayMemory">
  911. <h3>Summary</h3>
  912. <div class=tooltipinfo>
  913. <p>Play a short sound clip, stored directly in memory.
  914. Data files are created with the
  915. <a href="https://github.com/PaulStoffregen/Audio/tree/master/examples/SamplePlayer/wav2sketch" target="_blank">wav2sketch program</a>,
  916. and copied to the sketch folder to become part of your sketch.</p>
  917. </div>
  918. <h3>Audio Connections</h3>
  919. <table class=doc align=center cellpadding=3>
  920. <tr class=top><th>Port</th><th>Purpose</th></tr>
  921. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  922. </table>
  923. <h3>Functions</h3>
  924. <p class=func><span class=keyword>play</span>(data);</p>
  925. <p class=desc>Begin playing a sound clip. If already playing, the
  926. currently playing clip is stopped and this new data begins
  927. playing from the beginning.
  928. </p>
  929. <p class=func><span class=keyword>stop</span>();</p>
  930. <p class=desc>Stop playing. If not playing, this function has no effect.
  931. </p>
  932. <p class=func><span class=keyword>isPlaying</span>();</p>
  933. <p class=desc>Return true (non-zero) if playing, or false (zero)
  934. when not playing.
  935. </p>
  936. <p class=func><span class=keyword>positionMillis</span>();</p>
  937. <p class=desc>While playing, return the current time offset, in
  938. milliseconds. When not playing, the return from this function
  939. is undefined.
  940. </p>
  941. <p class=func><span class=keyword>lengthMillis</span>();</p>
  942. <p class=desc>Return the total length of the current sound clip,
  943. in milliseconds. When not playing, the return from this function
  944. is undefined.
  945. </p>
  946. <h3>Examples</h3>
  947. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  948. </p>
  949. <h3>Notes</h3>
  950. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  951. <p>TODO: ulaw vs uncompressed encoding</p>
  952. <p>Polyphonic playback can be built by creating multiple
  953. objects, with their output combined by mixers.</p>
  954. </script>
  955. <script type="text/x-red" data-template-name="AudioPlayMemory">
  956. <div class="form-row">
  957. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  958. <input type="text" id="node-input-name" placeholder="Name">
  959. </div>
  960. </script>
  961. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  962. <h3>Summary</h3>
  963. <div class=tooltipinfo>
  964. <p>Play a WAV file, stored on a SD card.</p>
  965. </div>
  966. <h3>Audio Connections</h3>
  967. <table class=doc align=center cellpadding=3>
  968. <tr class=top><th>Port</th><th>Purpose</th></tr>
  969. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  970. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  971. </table>
  972. <h3>Functions</h3>
  973. <p class=func><span class=keyword>play</span>(filename);</p>
  974. <p class=desc>Begin playing a WAV file. If a file is already playing,
  975. it is stopped and this file starts playing from the beginning.
  976. </p>
  977. <p class=func><span class=keyword>stop</span>();</p>
  978. <p class=desc>Stop playing. If not playing, this function has no effect.
  979. </p>
  980. <p class=func><span class=keyword>isPlaying</span>();</p>
  981. <p class=desc>Return true (non-zero) if playing, or false (zero)
  982. when not playing. See the note below about delayed start.
  983. </p>
  984. <p class=func><span class=keyword>positionMillis</span>();</p>
  985. <p class=desc>While playing, return the current time offset, in
  986. milliseconds. When not playing, the return from this function
  987. is undefined.
  988. </p>
  989. <p class=func><span class=keyword>lengthMillis</span>();</p>
  990. <p class=desc>Return the total length of the current sound clip,
  991. in milliseconds. When not playing, the return from this function
  992. is undefined.
  993. </p>
  994. <h3>Examples</h3>
  995. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  996. </p>
  997. <h3>Notes</h3>
  998. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  999. files are played, both output ports transmit a copy of the
  1000. single sound. Of course, stereo WAV files play with the left
  1001. channel on port 0 and the right channel on port 1.
  1002. </p>
  1003. <p>A brief delay after calling play() will usually occur before
  1004. isPlaying() returns true and positionMillis() returns valid
  1005. time offset. WAV files have a header at the beginning of the
  1006. file, which the audio library must read and parse before
  1007. playing can begin.
  1008. </p>
  1009. <p>While playing, the audio library accesses the SD card automatically.
  1010. If card access is required, you must
  1011. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  1012. to prevent the library from accessing the SD card while you use it.
  1013. Disabling the audio library interrupt for too long may cause audible
  1014. dropouts or glitches.
  1015. </p>
  1016. <p>An experimental SD library optimization exists, which can remove these
  1017. SD library restrictions. It also allows reliable playback of more
  1018. files at the same time. To enable this special code, find and edit
  1019. the SD_t3.h file within your Arduino folder. See the comments within
  1020. that file for details.
  1021. </p>
  1022. </script>
  1023. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  1024. <div class="form-row">
  1025. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1026. <input type="text" id="node-input-name" placeholder="Name">
  1027. </div>
  1028. </script>
  1029. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  1030. <h3>Summary</h3>
  1031. <div class=tooltipinfo>
  1032. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  1033. than WAV and begins playing immediately, without parsing WAV file
  1034. header info.</p>
  1035. </div>
  1036. <h3>Audio Connections</h3>
  1037. <table class=doc align=center cellpadding=3>
  1038. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1039. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1040. </table>
  1041. <h3>Functions</h3>
  1042. <p class=func><span class=keyword>play</span>(filename);</p>
  1043. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  1044. it is stopped and this file starts playing from the beginning.
  1045. </p>
  1046. <p class=func><span class=keyword>stop</span>();</p>
  1047. <p class=desc>Stop playing. If not playing, this function has no effect.
  1048. </p>
  1049. <p class=func><span class=keyword>isPlaying</span>();</p>
  1050. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1051. when not playing.
  1052. </p>
  1053. <p class=func><span class=keyword>positionMillis</span>();</p>
  1054. <p class=desc>While playing, return the current time offset, in
  1055. milliseconds. When not playing, the return from this function
  1056. is undefined.
  1057. </p>
  1058. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1059. <p class=desc>Return the total length of the current sound clip,
  1060. in milliseconds. When not playing, the return from this function
  1061. is undefined.
  1062. </p>
  1063. <h3>Examples</h3>
  1064. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1065. </p>
  1066. <h3>Notes</h3>
  1067. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  1068. </p>
  1069. <p>While playing, the audio library accesses the SD card automatically.
  1070. If card access is required, you must
  1071. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1072. to prevent the library from accessing the SD card while you use it.
  1073. Disabling the audio library interrupt for too long may cause audible
  1074. dropouts or glitches.
  1075. </p>
  1076. </script>
  1077. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  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/x-red" data-help-name="AudioPlaySerialflashRaw">
  1084. <h3>Summary</h3>
  1085. <div class=tooltipinfo>
  1086. <p>Play a RAW data file, stored on a Serial Flash chip. These chips
  1087. are far more efficient than SD cards, allowing many files to be
  1088. played simultaneously by copies of this object.
  1089. </p>
  1090. <p align=center><img src="img/w25q128fv.jpg"><br><small>W25Q128FV Serial Flash</small></p>
  1091. </div>
  1092. <h3>Audio Connections</h3>
  1093. <table class=doc align=center cellpadding=3>
  1094. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1095. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1096. </table>
  1097. <h3>Functions</h3>
  1098. <p class=func><span class=keyword>play</span>(filename);</p>
  1099. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  1100. it is stopped and this file starts playing from the beginning.
  1101. </p>
  1102. <p class=func><span class=keyword>stop</span>();</p>
  1103. <p class=desc>Stop playing. If not playing, this function has no effect.
  1104. </p>
  1105. <p class=func><span class=keyword>isPlaying</span>();</p>
  1106. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1107. when not playing.
  1108. </p>
  1109. <p class=func><span class=keyword>positionMillis</span>();</p>
  1110. <p class=desc>While playing, return the current time offset, in
  1111. milliseconds. When not playing, the return from this function
  1112. is undefined.
  1113. </p>
  1114. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1115. <p class=desc>Return the total length of the current sound clip,
  1116. in milliseconds. When not playing, the return from this function
  1117. is undefined.
  1118. </p>
  1119. <h3>Examples</h3>
  1120. <!--
  1121. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1122. -->
  1123. <p class=exam>TODO: play example needed....
  1124. </p>
  1125. <p class=exam>File &gt; Examples &gt; SerialFlash &gt; CopyFromSD
  1126. </p>
  1127. <h3>Notes</h3>
  1128. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  1129. </p>
  1130. <p>The <a href="https://github.com/PaulStoffregen/SerialFlash" target="_blank">SerialFlash library</a>
  1131. is used to access the flash chip. You can also use SerialFlash's functions
  1132. to access the stored files, or add data to the flash chip.
  1133. </p>
  1134. <p>File names are case sensitive with SerialFlash. If your sound does
  1135. not play, use <b>File &gt; Examples &gt; SerialFlash &gt; ListFiles</b> to
  1136. check the exact file names stored in the flash memory chip.
  1137. </script>
  1138. <script type="text/x-red" data-template-name="AudioPlaySerialflashRaw">
  1139. <div class="form-row">
  1140. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1141. <input type="text" id="node-input-name" placeholder="Name">
  1142. </div>
  1143. </script>
  1144. <script type="text/x-red" data-help-name="AudioPlayQueue">
  1145. <h3>Summary</h3>
  1146. <div class=tooltipinfo>
  1147. <p>Play audio data provided by the Arduino sketch. This object provides
  1148. functions to allow the sketch code to push data into the audio system.</p>
  1149. </div>
  1150. <h3>Audio Connections</h3>
  1151. <table class=doc align=center cellpadding=3>
  1152. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1153. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1154. </table>
  1155. <h3>Functions</h3>
  1156. <p class=func><span class=keyword>play</span>(int16);</p>
  1157. <p class=desc>not yet implemented
  1158. </p>
  1159. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  1160. <p class=desc>not yet implemented
  1161. </p>
  1162. <p class=func><span class=keyword>getBuffer</span>();</p>
  1163. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  1164. is within the audio library memory pool, providing the most efficient
  1165. way to input data to the audio system. The buffer is likely to be
  1166. populated by previously used data, so the entire 128 words should be
  1167. written before calling playBuffer(). Only a single buffer should be
  1168. requested at a time. This function may return NULL if no memory is
  1169. available.
  1170. </p>
  1171. <p class=func><span class=keyword>playBuffer</span>();</p>
  1172. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  1173. </p>
  1174. <h3>Examples</h3>
  1175. <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>
  1176. </p>
  1177. <!--
  1178. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1179. </p>
  1180. -->
  1181. <h3>Notes</h3>
  1182. <p>TODO: many caveats....</p>
  1183. <p>
  1184. </p>
  1185. </script>
  1186. <script type="text/x-red" data-template-name="AudioPlayQueue">
  1187. <div class="form-row">
  1188. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1189. <input type="text" id="node-input-name" placeholder="Name">
  1190. </div>
  1191. </script>
  1192. <script type="text/x-red" data-help-name="AudioRecordQueue">
  1193. <h3>Summary</h3>
  1194. <div class=tooltipinfo>
  1195. <p>Record audio data by sending to the Arduino sketch. This object allows
  1196. sketch code to receive audio packets.</p>
  1197. </div>
  1198. <h3>Audio Connections</h3>
  1199. <table class=doc align=center cellpadding=3>
  1200. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1201. <tr class=odd><td align=center>In 0</td><td>Sound To Access</td></tr>
  1202. </table>
  1203. <h3>Functions</h3>
  1204. <p class=func><span class=keyword>begin</span>();</p>
  1205. <p class=desc>Begin capturing incoming audio to the queue. After calling
  1206. begin, readBuffer() and freeBuffer(), or clear() must be used frequently
  1207. to prevent the queue from filling up.
  1208. </p>
  1209. <p class=func><span class=keyword>available</span>();</p>
  1210. <p class=desc>Returns the number of audio packets available to read.
  1211. </p>
  1212. <p class=func><span class=keyword>readBuffer</span>();</p>
  1213. <p class=desc>Read a single audio packet. A pointer to a 128 sample
  1214. array of 16 bit integers is returned. NULL is returned if no packets
  1215. are available.
  1216. </p>
  1217. <p class=func><span class=keyword>freeBuffer</span>();</p>
  1218. <p class=desc>Release the memory from the previously read packet returned
  1219. from readBuffer(). Only a single packet at a time may be read, and
  1220. each packet must be freed with this function, to return the memory to
  1221. the audio library.
  1222. </p>
  1223. <p class=func><span class=keyword>clear</span>();</p>
  1224. <p class=desc>Discard all audio held in the queue.
  1225. </p>
  1226. <p class=func><span class=keyword>end</span>();</p>
  1227. <p class=desc>Stop capturing incoming audio into the queue. Data already
  1228. captured remains in the queue and may be read with readBuffer().
  1229. </p>
  1230. <h3>Examples</h3>
  1231. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1232. </p>
  1233. <h3>Notes</h3>
  1234. <p>
  1235. Up to 52 packets may be queued by this object, which allows approximately
  1236. 150 ms of audio to be held in the queue, to allow time for the Arduino
  1237. sketch to write data to media or do other high-latency tasks.
  1238. The actual packets are taken
  1239. from the pool created by AudioMemory().
  1240. </p>
  1241. </script>
  1242. <script type="text/x-red" data-template-name="AudioRecordQueue">
  1243. <div class="form-row">
  1244. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1245. <input type="text" id="node-input-name" placeholder="Name">
  1246. </div>
  1247. </script>
  1248. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  1249. <h3>Summary</h3>
  1250. <div class=tooltipinfo>
  1251. <p>Create a sine wave signal</p>
  1252. </div>
  1253. <h3>Audio Connections</h3>
  1254. <table class=doc align=center cellpadding=3>
  1255. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1256. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  1257. </table>
  1258. <h3>Functions</h3>
  1259. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1260. <p class=desc>Set the amplitude, from 0 to 1.0.
  1261. </p>
  1262. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1263. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  1264. be used to create a LFO (Low Frequency Oscillator) for objects
  1265. with modulation signal inputs.
  1266. </p>
  1267. <p class=func><span class=keyword>phase</span>(angle);</p>
  1268. <p class=desc>
  1269. Cause the generated waveform to jump to a specific point within
  1270. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1271. are configured,
  1272. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1273. should be used to guarantee all new settings take effect together.
  1274. </p>
  1275. <h3>Examples</h3>
  1276. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1277. </p>
  1278. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  1279. </p>
  1280. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  1281. </p>
  1282. <h3>Notes</h3>
  1283. <p></p>
  1284. </script>
  1285. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  1286. <div class="form-row">
  1287. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1288. <input type="text" id="node-input-name" placeholder="Name">
  1289. </div>
  1290. </script>
  1291. <script type="text/x-red" data-help-name="AudioSynthWaveformSineHires">
  1292. <h3>Summary</h3>
  1293. <div class=tooltipinfo>
  1294. <p>Create a highly precise, low distortion sine wave signal.
  1295. Mainly useful for codec &amp; analog circuitry testing.</p>
  1296. </div>
  1297. <h3>Audio Connections</h3>
  1298. <table class=doc align=center cellpadding=3>
  1299. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1300. <tr class=odd><td align=center>Out 0</td><td>Sine Wave, upper bits</td></tr>
  1301. <tr class=odd><td align=center>Out 1</td><td>Sine Wave, lower bits</td></tr>
  1302. </table>
  1303. <h3>Functions</h3>
  1304. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1305. <p class=desc>Set the amplitude, from 0 to 1.0.
  1306. </p>
  1307. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1308. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  1309. be used to create a LFO (Low Frequency Oscillator) for objects
  1310. with modulation signal inputs.
  1311. </p>
  1312. <p class=func><span class=keyword>phase</span>(angle);</p>
  1313. <p class=desc>
  1314. Cause the generated waveform to jump to a specific point within
  1315. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1316. are configured,
  1317. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1318. should be used to guarantee all new settings take effect together.
  1319. </p>
  1320. <h3>Notes</h3>
  1321. <p>An 11th order Taylor series approximation is used to generate
  1322. a very accurate sine wave. At least the upper 25 bits are believe
  1323. to be perfect. This is mainly intended for testing 24 bit codec chips!</p>
  1324. </script>
  1325. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  1326. <div class="form-row">
  1327. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1328. <input type="text" id="node-input-name" placeholder="Name">
  1329. </div>
  1330. </script>
  1331. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  1332. <h3>Summary</h3>
  1333. <div class=tooltipinfo>
  1334. <p>Create a modulated sine wave, using any audio signal to continuously
  1335. modulate the sine wave frequency.</p>
  1336. </div>
  1337. <h3>Audio Connections</h3>
  1338. <table class=doc align=center cellpadding=3>
  1339. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1340. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  1341. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  1342. </table>
  1343. <h3>Functions</h3>
  1344. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1345. <p class=desc>Set the amplitude, from 0 to 1.0.
  1346. </p>
  1347. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1348. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  1349. be this center frequency when the input modulation signal is zero.
  1350. Modulation input 1.0 causes the frequency to double, and input -1.0
  1351. causes zero Hz (DC) output. For less modulation, attenuate the input
  1352. signal (perhaps with a mixer object) before it arrives here.
  1353. </p>
  1354. <p class=func><span class=keyword>phase</span>(angle);</p>
  1355. <p class=desc>
  1356. Cause the generated waveform to jump to a specific point within
  1357. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1358. are configured,
  1359. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1360. should be used to guarantee all new settings take effect together.
  1361. </p>
  1362. <!--
  1363. <h3>Examples</h3>
  1364. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1365. </p>
  1366. -->
  1367. <h3>Notes</h3>
  1368. <p></p>
  1369. </script>
  1370. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  1371. <div class="form-row">
  1372. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1373. <input type="text" id="node-input-name" placeholder="Name">
  1374. </div>
  1375. </script>
  1376. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  1377. <h3>Summary</h3>
  1378. <div class=tooltipinfo>
  1379. <p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</p>
  1380. </div>
  1381. <h3>Audio Connections</h3>
  1382. <table class=doc align=center cellpadding=3>
  1383. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1384. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  1385. </table>
  1386. <h3>Functions</h3>
  1387. <p class=func><span class=keyword>begin</span>(waveform);</p>
  1388. <p class=desc>Configure the waveform type to create.
  1389. </p>
  1390. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  1391. <p class=desc>Output a waveform, and set the amplitude and frequency.
  1392. </p>
  1393. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1394. <p class=desc>Change the frequency.
  1395. </p>
  1396. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1397. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  1398. </p>
  1399. <p class=func><span class=keyword>phase</span>(angle);</p>
  1400. <p class=desc>
  1401. Cause the generated waveform to jump to a specific point within
  1402. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1403. are configured,
  1404. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1405. should be used to guarantee all new settings take effect together.
  1406. </p>
  1407. <p class=func><span class=keyword>pulseWidth</span>(amount);</p>
  1408. <p class=desc>Change the width (duty cycle) of the pulse.</p>
  1409. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  1410. <p class=desc>
  1411. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  1412. must be an array of 256 samples. Currently, the data is used
  1413. without any filtering, which can cause aliasing with frequencies
  1414. above 172 Hz. For higher frequency output, you must bandwidth
  1415. limit your waveform data. Someday, "maxFreq" will be used to
  1416. do this automatically.
  1417. </p>
  1418. <h3>Examples</h3>
  1419. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1420. </p>
  1421. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1422. </p>
  1423. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  1424. </p>
  1425. <h3>Notes</h3>
  1426. <p>Supported Waveforms:<br>
  1427. <ul>
  1428. <li><span class=literal>WAVEFORM_SINE</span></li>
  1429. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  1430. <li><span class=literal>WAVEFORM_SAWTOOTH_REVERSE</span></li>
  1431. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  1432. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  1433. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  1434. <li><span class=literal>WAVEFORM_PULSE</span></li>
  1435. <li><span class=literal>WAVEFORM_SAMPLE_HOLD</span></li>
  1436. </ul>
  1437. </p>
  1438. </script>
  1439. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  1440. <div class="form-row">
  1441. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1442. <input type="text" id="node-input-name" placeholder="Name">
  1443. </div>
  1444. </script>
  1445. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  1446. <h3>Summary</h3>
  1447. <div class=tooltipinfo>
  1448. <p>Create a continuously varying (in frequency) sine wave</p>
  1449. </div>
  1450. <h3>Audio Connections</h3>
  1451. <table class=doc align=center cellpadding=3>
  1452. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1453. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  1454. </table>
  1455. <h3>Functions</h3>
  1456. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  1457. <p class=desc>Start generating frequency sweep output. The time is specified
  1458. in milliseconds. Level is 0 to 1.0.
  1459. </p>
  1460. <p class=func><span class=keyword>isPlaying</span>();</p>
  1461. <p class=desc>Returns true (non-zero) while the output is active.
  1462. </p>
  1463. <h3>Examples</h3>
  1464. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; ToneSweep
  1465. </p>
  1466. <h3>Notes</h3>
  1467. <p>Uses excessive CPU time</p>
  1468. </script>
  1469. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  1470. <div class="form-row">
  1471. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1472. <input type="text" id="node-input-name" placeholder="Name">
  1473. </div>
  1474. </script>
  1475. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  1476. <h3>Summary</h3>
  1477. <div class=tooltipinfo>
  1478. <p>Create constant (DC) signal, useful for control of objects that take
  1479. a modulation or control input signal. This constant level can be
  1480. used to modify other waveforms using mixer or multiplier objects</p>
  1481. </div>
  1482. <h3>Audio Connections</h3>
  1483. <table class=doc align=center cellpadding=3>
  1484. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1485. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  1486. </table>
  1487. <h3>Functions</h3>
  1488. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1489. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1490. changed immediately.
  1491. </p>
  1492. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  1493. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1494. gradually changed over a "milliseconds" time period. Any time may
  1495. be specified, but periods longer than 1 second may be automatically
  1496. shortened for small level changes, due to numerical precision limits.
  1497. </p>
  1498. <!--
  1499. <h3>Examples</h3>
  1500. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1501. </p>
  1502. -->
  1503. <h3>Notes</h3>
  1504. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  1505. to a pure digital stream of numerical values. But the term is widely
  1506. understood in audio applications, so hopefully it's not too confusing?</p>
  1507. </script>
  1508. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  1509. <div class="form-row">
  1510. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1511. <input type="text" id="node-input-name" placeholder="Name">
  1512. </div>
  1513. </script>
  1514. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  1515. <h3>Summary</h3>
  1516. <div class=tooltipinfo>
  1517. <p>Create white noise.
  1518. </p>
  1519. <p align=center><img src="img/whitenoise.png"></p>
  1520. </div>
  1521. <h3>Audio Connections</h3>
  1522. <table class=doc align=center cellpadding=3>
  1523. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1524. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  1525. </table>
  1526. <h3>Functions</h3>
  1527. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1528. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1529. The default is off. Noise is generated only after setting
  1530. to a non-zero level.
  1531. </p>
  1532. <h3>Examples</h3>
  1533. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1534. </p>
  1535. <h3>Notes</h3>
  1536. <p>Setting the amplitude to zero causes this object to stop using
  1537. CPU time to generate random numbers.
  1538. </p>
  1539. </script>
  1540. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  1541. <div class="form-row">
  1542. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1543. <input type="text" id="node-input-name" placeholder="Name">
  1544. </div>
  1545. </script>
  1546. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  1547. <h3>Summary</h3>
  1548. <div class=tooltipinfo>
  1549. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  1550. </p>
  1551. <!--
  1552. <p align=center><img src="img/whitenoise.png"></p>
  1553. -->
  1554. </div>
  1555. <h3>Audio Connections</h3>
  1556. <table class=doc align=center cellpadding=3>
  1557. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1558. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  1559. </table>
  1560. <h3>Functions</h3>
  1561. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1562. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1563. The default is off. Noise is generated only after setting
  1564. to a non-zero level.
  1565. </p>
  1566. <h3>Examples</h3>
  1567. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1568. </p>
  1569. <h3>Notes</h3>
  1570. <p>Setting the amplitude to zero causes this object to stop using
  1571. CPU time. CPU usage is approx 3% on Teensy 3.1.
  1572. </p>
  1573. <p>Stefan Stenzel's
  1574. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  1575. algorithm. Stefan's terms of use are "Use for any purpose. If used
  1576. in a commercial product, you should give me one."
  1577. </p>
  1578. </script>
  1579. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  1580. <div class="form-row">
  1581. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1582. <input type="text" id="node-input-name" placeholder="Name">
  1583. </div>
  1584. </script>
  1585. <script type="text/x-red" data-help-name="AudioEffectFade">
  1586. <h3>Summary</h3>
  1587. <div class=tooltipinfo>
  1588. <p>Gradually increase or decrease audio level.</p>
  1589. </div>
  1590. <h3>Audio Connections</h3>
  1591. <table class=doc align=center cellpadding=3>
  1592. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1593. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1594. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1595. </table>
  1596. <h3>Functions</h3>
  1597. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  1598. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  1599. directly to the output) after "milliseconds" time.
  1600. </p>
  1601. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  1602. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  1603. after "milliseconds" time.
  1604. </p>
  1605. <!--
  1606. <h3>Examples</h3>
  1607. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1608. </p>
  1609. -->
  1610. <h3>Notes</h3>
  1611. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  1612. When one fade object is off (fully faded out) and the other on
  1613. (fully faded in), if both are started at the same moment for the
  1614. same time duration, their signal gains always add to 1.0. This
  1615. allows 2 fade objects to work together for a smooth transition
  1616. between a pair of signals.
  1617. </p>
  1618. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1619. should be used when changing
  1620. settings on multiple objects, so all changes always take effect
  1621. at the same moment.
  1622. </p>
  1623. </script>
  1624. <script type="text/x-red" data-template-name="AudioEffectFade">
  1625. <div class="form-row">
  1626. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1627. <input type="text" id="node-input-name" placeholder="Name">
  1628. </div>
  1629. </script>
  1630. <script type="text/x-red" data-help-name="AudioEffectChorus">
  1631. <h3>Summary</h3>
  1632. <div class=tooltipinfo>
  1633. <p>The chorus effect simulates the richness of several nearly-identical
  1634. sound sources (like the way a choir sounds different to a single singer).
  1635. It does this by sampling from a delay line, so each voice is actually
  1636. the same but at a slightly different point in time. This is a type of
  1637. comb filtering.</p>
  1638. </div>
  1639. <p>Chorus combines one or more samples ranging from the most recent
  1640. sample back to about 50ms ago. The additional samples are evenly spread
  1641. through the supplied delay line, and there is no modulation.</p>
  1642. <p>If the number of voices is specified as 2, then the
  1643. effect combines the current sample and the oldest sample (the last one
  1644. in the delay line). If the number of voices is 3 then the effect combines
  1645. the most recent sample, the oldest sample and the sample in the middle of
  1646. the delay line.</p>
  1647. <p>For two voices the effect can be represented as:<br/>
  1648. result = (sample(0) + sample(dt))/2<br/>
  1649. where sample(0) represents the current sample and sample(dt)
  1650. is the sample in the delay line from dt milliseconds ago.</p>
  1651. <h3>Audio Connections</h3>
  1652. <table class=doc align=center cellpadding=3>
  1653. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1654. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1655. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  1656. </table>
  1657. <h3>Functions</h3>
  1658. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  1659. <p class=desc>Create a chorus by specifying the address of the delayline, the
  1660. total number of samples in the delay line (often done as an integer multiple of
  1661. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  1662. the original voice (so, 2 and up to get a chorus effect, although you can
  1663. specify 1 if you want).
  1664. </p>
  1665. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  1666. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  1667. </p>
  1668. <h3>Examples</h3>
  1669. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  1670. </p>
  1671. <h3>Notes</h3>
  1672. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  1673. </script>
  1674. <script type="text/x-red" data-template-name="AudioEffectChorus">
  1675. <div class="form-row">
  1676. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1677. <input type="text" id="node-input-name" placeholder="Name">
  1678. </div>
  1679. </script>
  1680. <script type="text/x-red" data-help-name="AudioEffectFlange">
  1681. <h3>Summary</h3>
  1682. <div class=tooltipinfo>
  1683. <p>Originally, flanging was produced by playing the same signal on two synchronized
  1684. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  1685. pressing on the flange of the reel (hence the name). This is a type of
  1686. comb filtering, and produces a harmonically-related series of peaks and notches
  1687. in the audio spectrum.</p>
  1688. </div>
  1689. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  1690. line, but the position of that sample varies sinusoidally.</p>
  1691. <p>The effect can be represented as:<br>
  1692. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  1693. <p>The value of the sine function is always a number from -1 to +1 and
  1694. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  1695. Thus, the delayed sample will be selected from the range (dt-depth) to
  1696. (dt+depth). This selection will vary at whatever rate is specified as the
  1697. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  1698. <h3>Audio Connections</h3>
  1699. <table class=doc align=center cellpadding=3>
  1700. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1701. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1702. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  1703. </table>
  1704. <h3>Functions</h3>
  1705. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  1706. <p class=desc>Create a flanger by specifying the address of the delayline, the
  1707. total number of samples in the delay line (often done as an integer multiple of
  1708. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  1709. the modulation depth (larger values give a greater variation) and the modulation
  1710. frequency, in Hertz.
  1711. </p>
  1712. <p class=func><span class=keyword>voices</span>(offset, depth, delayRate);</p>
  1713. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  1714. </p>
  1715. <h3>Examples</h3>
  1716. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  1717. </p>
  1718. <h3>Notes</h3>
  1719. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  1720. <p>Try these settings:<br>
  1721. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  1722. and<br>
  1723. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  1724. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  1725. double s_freq = 3;</p>
  1726. <p>The flange effect can also produce a chorus-like effect if a longer
  1727. delay line is used with a slower modulation rate, for example try:<br>
  1728. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  1729. and<br>
  1730. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  1731. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  1732. double s_freq = .0625;</p>
  1733. </script>
  1734. <script type="text/x-red" data-template-name="AudioEffectFlange">
  1735. <div class="form-row">
  1736. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1737. <input type="text" id="node-input-name" placeholder="Name">
  1738. </div>
  1739. </script>
  1740. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  1741. <h3>Summary</h3>
  1742. <div class=tooltipinfo>
  1743. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  1744. Release) envelope.
  1745. </p>
  1746. <p align=center><img src="img/dahdsr.png"></p>
  1747. </div>
  1748. <h3>Audio Connections</h3>
  1749. <table class=doc align=center cellpadding=3>
  1750. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1751. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1752. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1753. </table>
  1754. <h3>Functions</h3>
  1755. <p class=func><span class=keyword>noteOn</span>();</p>
  1756. <p class=desc>Begin the delay to attack, or the attack phase is
  1757. delay is zero.
  1758. </p>
  1759. <p class=func><span class=keyword>noteOff</span>();</p>
  1760. <p class=desc>Begin the release phase.
  1761. </p>
  1762. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  1763. <p class=desc>Set the delay from noteOn to the attach phase. The
  1764. default is zero, for no delay.
  1765. </p>
  1766. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  1767. <p class=desc>Set the attack time. The default is 1.5 milliseconds.
  1768. </p>
  1769. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  1770. <p class=desc>Set the hold time. The default is 0.5 milliseconds.
  1771. </p>
  1772. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  1773. <p class=desc>Set the decay time. The default is 15 milliseconds.
  1774. </p>
  1775. <p class=func><span class=keyword>sustain</span>(level);</p>
  1776. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  1777. gain will be maintained at this level after the decay phase,
  1778. until noteOff() is called.
  1779. </p>
  1780. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  1781. <p class=desc>Set the release time. The default is 30 millisecond.
  1782. </p>
  1783. <h3>Examples</h3>
  1784. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1785. </p>
  1786. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1787. </p>
  1788. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1789. </p>
  1790. <h3>Notes</h3>
  1791. <p>To achieve the more common ADSR shape, simply
  1792. set delay and hold to zero.</p>
  1793. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  1794. milliseconds. Up to 200 ms can be used, with somewhat reduced
  1795. accuracy</p>
  1796. </script>
  1797. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  1798. <div class="form-row">
  1799. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1800. <input type="text" id="node-input-name" placeholder="Name">
  1801. </div>
  1802. </script>
  1803. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  1804. <h3>Summary</h3>
  1805. <div class=tooltipinfo>
  1806. <p>Multiply two signals together, useful for amplitude modulation
  1807. or "voltage controlled amplification".
  1808. </p>
  1809. <p align=center><img src="img/multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  1810. </div>
  1811. <h3>Audio Connections</h3>
  1812. <table class=doc align=center cellpadding=3>
  1813. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1814. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1815. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  1816. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1817. </table>
  1818. <h3>Functions</h3>
  1819. <p>There are no functions to call from the Arduino sketch.
  1820. This object simply multiplies the 2 signals to create
  1821. a continuous output
  1822. </p>
  1823. <!--
  1824. <h3>Examples</h3>
  1825. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1826. </p>
  1827. -->
  1828. <h3>Notes</h3>
  1829. <p>
  1830. </p>
  1831. </script>
  1832. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  1833. <div class="form-row">
  1834. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1835. <input type="text" id="node-input-name" placeholder="Name">
  1836. </div>
  1837. </script>
  1838. <script type="text/x-red" data-help-name="AudioEffectDelay">
  1839. <h3>Summary</h3>
  1840. <div class=tooltipinfo>
  1841. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  1842. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1843. </div>
  1844. <h3>Audio Connections</h3>
  1845. <table class=doc align=center cellpadding=3>
  1846. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1847. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1848. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1849. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1850. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1851. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1852. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1853. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1854. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1855. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1856. </table>
  1857. <h3>Functions</h3>
  1858. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1859. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1860. milliseconds. The maximum delay is approx 425 ms. The actual delay
  1861. is rounded to the nearest sample. Each channel can be configured for
  1862. any delay. There is no requirement to configure the "taps" in increasing
  1863. delay order.
  1864. </p>
  1865. <p class=func><span class=keyword>disable</span>(channel);</p>
  1866. <p class=desc>Disable a channel. The output of this channel becomes
  1867. silent. If this channel is the longest delay, memory usage is
  1868. automatically reduced to accomodate only the remaining channels used.
  1869. </p>
  1870. <h3>Examples</h3>
  1871. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  1872. </p>
  1873. <h3>Notes</h3>
  1874. <p>Memory for the delayed signal is take from the memory pool allocated by
  1875. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  1876. Each block allows about 3 milliseconds of delay, so AudioMemory
  1877. should be increased to allow for the longest delay tap.
  1878. </p>
  1879. </script>
  1880. <script type="text/x-red" data-template-name="AudioEffectDelay">
  1881. <div class="form-row">
  1882. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1883. <input type="text" id="node-input-name" placeholder="Name">
  1884. </div>
  1885. </script>
  1886. <script type="text/x-red" data-help-name="AudioEffectDelayExternal">
  1887. <h3>Summary</h3>
  1888. <div class=tooltipinfo>
  1889. <p>Delay a signal, using external memory for longer delay times! Up to 8 separate delay taps can be used.</p>
  1890. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1891. </div>
  1892. <h3>Audio Connections</h3>
  1893. <table class=doc align=center cellpadding=3>
  1894. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1895. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1896. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1897. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1898. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1899. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1900. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1901. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1902. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1903. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1904. </table>
  1905. <h3>Functions</h3>
  1906. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1907. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1908. milliseconds. The maximum delay is approx 1.5 seconds for each 23LC1024 chip.
  1909. The actual delay
  1910. is rounded to the nearest sample. Each channel can be configured for
  1911. any delay. There is no requirement to configure the "taps" in increasing
  1912. delay order.
  1913. </p>
  1914. <p class=func><span class=keyword>disable</span>(channel);</p>
  1915. <p class=desc>Disable a channel. The output of this channel becomes
  1916. silent. If this channel is the longest delay, memory usage is
  1917. automatically reduced to accomodate only the remaining channels used.
  1918. </p>
  1919. <h3>Hardware</h3>
  1920. <p>By default, or when <span class=literal>AUDIO_MEMORY_23LC1024</span> is used (see below),
  1921. a single 23LC1024 RAM chip is used, with these pins:
  1922. <table class=doc align=center cellpadding=3>
  1923. <tr class=top><th>Pin</th><th>Signal</th></tr>
  1924. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  1925. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  1926. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  1927. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  1928. </table>
  1929. </p>
  1930. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  1931. 23LC1024 chips are used.
  1932. </p>
  1933. <p align=center><img src="img/memoryboard.jpg"><br><small><a href="https://oshpark.com/shared_projects/KZt5PaU7" target="_blank">Memoryboard 4</a></small></p>
  1934. <p>
  1935. <table class=doc align=center cellpadding=3>
  1936. <tr class=top><th>Pin</th><th>Signal</th></tr>
  1937. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  1938. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  1939. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  1940. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  1941. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  1942. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  1943. </table>
  1944. </p>
  1945. <p>
  1946. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  1947. must be used. See below for details. Each chip provides 1485 ms of delay
  1948. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  1949. exceed the amount of memory physically present.
  1950. </p>
  1951. <h3>Examples</h3>
  1952. <p>
  1953. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  1954. </p>
  1955. <!--
  1956. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  1957. </p>
  1958. -->
  1959. <p>
  1960. <a href="https://forum.pjrc.com/threads/29276-Limits-of-delay-effect-in-audio-library?p=79436&viewfull=1#post79436" target="_blank">Forum Conversaton</a> (with sample code)
  1961. </p>
  1962. <h3>Notes</h3>
  1963. <p>External RAM allows for longer delays without consuming
  1964. limited internal RAM. However, SPI communication is required,
  1965. which consumes much more CPU time. The
  1966. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  1967. function may be used to monitor how much CPU time is consumed.
  1968. </p>
  1969. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  1970. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  1971. chips.
  1972. </p>
  1973. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  1974. </p>
  1975. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  1976. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  1977. channels of a stereo signal.
  1978. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>, 700);<br><span class=keyword>AudioEffectDelayExternal</span> delayExt2(<span class=literal>AUDIO_MEMORY_23LC1024</span>, 700);
  1979. </p>
  1980. </script>
  1981. <script type="text/x-red" data-template-name="AudioEffectDelayExternal">
  1982. <div class="form-row">
  1983. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1984. <input type="text" id="node-input-name" placeholder="Name">
  1985. </div>
  1986. </script>
  1987. <script type="text/x-red" data-help-name="AudioEffectBitcrusher">
  1988. <h3>Summary</h3>
  1989. <div class=tooltipinfo>
  1990. <p>Reduce the samplerate and/or bitdepth of a source signal, resulting in
  1991. a distorted sound.</p>
  1992. </div>
  1993. <h3>Audio Connections</h3>
  1994. <table class=doc align=center cellpadding=3>
  1995. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1996. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1997. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1998. </table>
  1999. <h3>Functions</h3>
  2000. <p class=func><span class=keyword>bits</span>(xcrushBits);</p>
  2001. <p class=desc>xcrushBits sets the bitdepth, from 1 to 16. A Value of 16
  2002. does not crush the bitdepth, and is effectively a passthru for this part
  2003. of the function.</p>
  2004. <p class=func><span class=keyword>sampleRate</span>(xsampleRate);</p>
  2005. <p class=desc>xsampleRate sets the frequency, from 1 to 44100Hz, however it
  2006. works in integer steps so you will only really get a handful of results from
  2007. the many samplerates you can pass. 44100 is passthru.</p>
  2008. <p class=desc>set xbitDepth to 16 and xsampleRate to 44100 to pass audio
  2009. through without any Bitcrush effect.</p>
  2010. <h3>Examples</h3>
  2011. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Bitcrusher
  2012. </p>
  2013. <h3>Notes</h3>
  2014. <p>Needs a lot of improvement. Options for anti-aliasing would be nice in
  2015. the future, but for now, it's rough, it's dirty and it sounds a bit like
  2016. Nine Inch Nails.
  2017. </p>
  2018. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  2019. should be used when changing
  2020. settings on multiple objects, so all changes always take effect
  2021. at the same moment.
  2022. </p>
  2023. </script>
  2024. <script type="text/x-red" data-template-name="AudioEffectBitcrusher">
  2025. <div class="form-row">
  2026. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2027. <input type="text" id="node-input-name" placeholder="Name">
  2028. </div>
  2029. </script>
  2030. <script type="text/x-red" data-help-name="AudioEffectMidSide">
  2031. <h3>Summary</h3>
  2032. <div class=tooltipinfo>
  2033. <p>Convert stereo signals to/from Mid-Side format.
  2034. Mid-Side encoding can be used to increase stereo width, make the lower
  2035. frequencies mono (to please your sub), or as the basis of audio compression.</p>
  2036. </div>
  2037. <h3>Audio Connections</h3>
  2038. <table class=doc align=center cellpadding=3>
  2039. <tr class=top><th>Port</th><th>While<br>Encoding</th><th>While<br>Decoding</th></tr>
  2040. <tr class=odd><td align=center>In 0</td><td>Left Input</td><td>Mid Output</td></tr>
  2041. <tr class=odd><td align=center>In 1</td><td>Right Input</td><td>Side Output</td></tr>
  2042. <tr class=odd><td align=center>Out 0</td><td>Mid Input</td><td>Left Output</td></tr>
  2043. <tr class=odd><td align=center>Out 1</td><td>Side Input</td><td>Right Output</td></tr>
  2044. </table>
  2045. <h3>Functions</h3>
  2046. <p class=func><span class=keyword>encode</span>();</p>
  2047. <p class=desc>Configure this object to encode from stereo to Mid-Side format.</p>
  2048. <p class=func><span class=keyword>decode</span>();</p>
  2049. <p class=desc>Configure this object to decode from Mid-Side format back to stereo signals.</p>
  2050. <h3>Examples</h3>
  2051. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>
  2052. <h3>Notes</h3>
  2053. <p>Many interesting stereo effects can be achieved by manipulating Mid-Side signals.</p>
  2054. <p>Normally a pair of these objects are used, one to encode, then additional
  2055. gain/attenuation or effects applied to the Mid-Side signals, and finally
  2056. decoding back to stereo signals</p>
  2057. <p>To prevent saturation, halving is done in the encoding, that is:</p>
  2058. <p>Mid = (left+right)/2</p>
  2059. <p>Side = (left-right)/2</p>
  2060. <p>And to decode:</p>
  2061. <p>Left = Mid+Side</p>
  2062. <p>Right = Mid-Side</p>
  2063. </script>
  2064. <script type="text/x-red" data-template-name="AudioEffectMidSide">
  2065. <div class="form-row">
  2066. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2067. <input type="text" id="node-input-name" placeholder="Name">
  2068. </div>
  2069. </script>
  2070. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  2071. <h3>Summary</h3>
  2072. <div class=tooltipinfo>
  2073. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  2074. Up to 4 stages may be cascaded.
  2075. </p>
  2076. <p align=center><img src="img/biquad.png"></p>
  2077. </div>
  2078. <h3>Audio Connections</h3>
  2079. <table class=doc align=center cellpadding=3>
  2080. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2081. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2082. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2083. </table>
  2084. <h3>Functions</h3>
  2085. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  2086. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  2087. response, with the specified corner frequency and Q shape. If Q is
  2088. higher that 0.7071, be careful of filter gain (see below).
  2089. </p>
  2090. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  2091. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  2092. response, with the specified corner frequency and Q shape. If Q is
  2093. higher that 0.7071, be careful of filter gain (see below).
  2094. </p>
  2095. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  2096. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  2097. response. The filter has unity gain at the specified frequency. Q
  2098. controls the width of frequencies allowed to pass.
  2099. </p>
  2100. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  2101. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  2102. response. Q controls the width of rejected frequencies.
  2103. </p>
  2104. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  2105. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  2106. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  2107. Each coefficient must be less than 2.0 and greater than -2.0. The array
  2108. should be type double. Alternately, it may be type int, where 1.0 is
  2109. represented with 1073741824 (2<sup>30</sup>).
  2110. </p>
  2111. <h3>Examples</h3>
  2112. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  2113. </p>
  2114. <h3>Notes</h3>
  2115. <p>Filters can with gain must have their input signals attenuated, so the
  2116. signal does not exceed 1.0.
  2117. </p>
  2118. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  2119. not pass any signal.
  2120. </p>
  2121. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  2122. trouble with limited numerical precision, causing the filter to perform
  2123. poorly. For very low corner frequency, the State Variable (Chamberlin)
  2124. filter should be used.
  2125. </p>
  2126. </script>
  2127. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  2128. <div class="form-row">
  2129. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2130. <input type="text" id="node-input-name" placeholder="Name">
  2131. </div>
  2132. </script>
  2133. <script type="text/x-red" data-help-name="AudioFilterFIR">
  2134. <h3>Summary</h3>
  2135. <div class=tooltipinfo>
  2136. <p>Finite impulse response filter, useful for all sorts of filtering.
  2137. </p>
  2138. <p align=center><img src="img/fir_filter.png"></p>
  2139. </div>
  2140. <h3>Audio Connections</h3>
  2141. <table class=doc align=center cellpadding=3>
  2142. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2143. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2144. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2145. </table>
  2146. <h3>Functions</h3>
  2147. <p class=func><span class=keyword>begin</span>(array, length);</p>
  2148. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  2149. filter's impulse response), and
  2150. length indicates the number of points in the array. Array may also be
  2151. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  2152. filtering.
  2153. </p>
  2154. <p class=func><span class=keyword>end</span>();</p>
  2155. <p class=desc>Turn the filter off.
  2156. </p>
  2157. <h3>Examples</h3>
  2158. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  2159. </p>
  2160. <h3>Known Issues</h3>
  2161. <p>Your filter's impulse response array must have an even length. If you have
  2162. add odd number of taps, you must add an extra zero to increase the length
  2163. to an even number.
  2164. </p>
  2165. <p>The minimum number of taps is 4. If you use less, add extra zeros to increase
  2166. the length to 4.
  2167. </p>
  2168. <p>The impulse response must be given in reverse order. Many filters have
  2169. symetrical impluse response, making this a non-issue. If your filter has
  2170. a non-symetrical response, make sure the data is in reverse time order.
  2171. </p>
  2172. <h3>Notes</h3>
  2173. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  2174. implement filters with better phase response.
  2175. </p>
  2176. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  2177. supported filter length is 200 points.
  2178. </p>
  2179. <p>The free
  2180. <a href="http://t-filter.engineerjs.com/" target="_blank"> TFilter Design Tool</a>
  2181. can be used to create the impulse response array. Be sure to set the sampling
  2182. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  2183. </p>
  2184. <p>
  2185. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  2186. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  2187. and add "const" to avoid consuming extra RAM.
  2188. </p>
  2189. </script>
  2190. <script type="text/x-red" data-template-name="AudioFilterFIR">
  2191. <div class="form-row">
  2192. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2193. <input type="text" id="node-input-name" placeholder="Name">
  2194. </div>
  2195. </script>
  2196. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  2197. <h3>Summary</h3>
  2198. <div class=tooltipinfo>
  2199. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  2200. adjustable resonance, and optional signal control of corner
  2201. frequency.</p>
  2202. </div>
  2203. <h3>Audio Connections</h3>
  2204. <table class=doc align=center cellpadding=3>
  2205. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2206. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  2207. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  2208. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  2209. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  2210. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  2211. </table>
  2212. <h3>Functions</h3>
  2213. <p class=func><span class=keyword>frequency</span>(freq);</p>
  2214. <p class=desc>Set the filter's corner frequency. When a signal is
  2215. connected to the control input, the filter will implement this
  2216. frequency when the signal is zero.
  2217. </p>
  2218. <p class=func><span class=keyword>resonance</span>(Q);</p>
  2219. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  2220. Resonance greater than 0.707 will amplify the signal near the
  2221. corner frequency. You must attenuate the signal before input
  2222. to this filter, to prevent clipping.
  2223. </p>
  2224. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  2225. <p class=desc>Set how much (in octaves) the control signal can alter
  2226. the filter's corner freqency. Range is 0 to 7 octaves. For
  2227. example, when set to 2.5, a full scale positive signal (1.0) will
  2228. shift the filter frequency up 2.5 octaves, and a full scale negative
  2229. signal will shift it down 2.5 octaves.
  2230. </p>
  2231. <!--
  2232. <h3>Examples</h3>
  2233. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2234. </p>
  2235. -->
  2236. <h3>Notes</h3>
  2237. <p>
  2238. When controlled by a signal, the equation for the filter
  2239. frequency is:
  2240. </p>
  2241. <p>
  2242. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  2243. <br><small>If anyone knows how to do HTML equations, please
  2244. help me improve this.....</small>
  2245. </p>
  2246. <p>When operating with signal control of corner frequency, this
  2247. object uses approximately 4% of the CPU time on Teensy 3.1.
  2248. </p>
  2249. </script>
  2250. <script type="text/x-red" data-template-name="AudioFilterFIR">
  2251. <div class="form-row">
  2252. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2253. <input type="text" id="node-input-name" placeholder="Name">
  2254. </div>
  2255. </script>
  2256. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  2257. <h3>Summary</h3>
  2258. <div class=tooltipinfo>
  2259. <p>Track the signal peak amplitude. Very useful for simple
  2260. audio level response projects, and general troubleshooting.</p>
  2261. </div>
  2262. <h3>Audio Connections</h3>
  2263. <table class=doc align=center cellpadding=3>
  2264. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2265. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2266. </table>
  2267. <h3>Functions</h3>
  2268. <p class=func><span class=keyword>available</span>();</p>
  2269. <p class=desc>Returns true each time new peak data is available.
  2270. </p>
  2271. <p class=func><span class=keyword>read</span>();</p>
  2272. <p class=desc>Read the highest peak amplitude value since the last read.
  2273. Return is from 0.0 to 1.0.
  2274. </p>
  2275. <p class=func><span class=keyword>readPeakToPeak</span>();</p>
  2276. <p class=desc>Read the highest peak-to-peak amplitude since the last read.
  2277. Return is from 0.0 to 2.0.
  2278. </p>
  2279. <h3>Examples</h3>
  2280. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  2281. </p>
  2282. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  2283. </p>
  2284. <h3>Notes</h3>
  2285. <p></p>
  2286. </script>
  2287. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  2288. <div class="form-row">
  2289. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2290. <input type="text" id="node-input-name" placeholder="Name">
  2291. </div>
  2292. </script>
  2293. <script type="text/x-red" data-help-name="AudioAnalyzeRMS">
  2294. <h3>Summary</h3>
  2295. <div class=tooltipinfo>
  2296. <p>Track the signal RMS amplitude. Useful for
  2297. audio level response projects, and general troubleshooting.</p>
  2298. </div>
  2299. <h3>Audio Connections</h3>
  2300. <table class=doc align=center cellpadding=3>
  2301. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2302. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2303. </table>
  2304. <h3>Functions</h3>
  2305. <p class=func><span class=keyword>available</span>();</p>
  2306. <p class=desc>Returns true if new RMS data is available.
  2307. </p>
  2308. <p class=func><span class=keyword>read</span>();</p>
  2309. <p class=desc>Read the new RMS value.
  2310. Return is from 0.0 to 1.0.
  2311. </p>
  2312. <h3>Examples</h3>
  2313. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakAndRMSMeterStereo</p>
  2314. </p>
  2315. <h3>Notes</h3>
  2316. <p></p>
  2317. </script>
  2318. <script type="text/x-red" data-template-name="AudioAnalyzeRMS">
  2319. <div class="form-row">
  2320. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2321. <input type="text" id="node-input-name" placeholder="Name">
  2322. </div>
  2323. </script>
  2324. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  2325. <h3>Summary</h3>
  2326. <div class=tooltipinfo>
  2327. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  2328. with real value (magnitude) output. The frequency resolution is
  2329. 172 Hz, useful for simple audio visualization.</p>
  2330. </div>
  2331. <h3>Audio Connections</h3>
  2332. <table class=doc align=center cellpadding=3>
  2333. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2334. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2335. </table>
  2336. <h3>Functions</h3>
  2337. <p class=func><span class=keyword>available</span>();</p>
  2338. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2339. </p>
  2340. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2341. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  2342. so 1.0 represents a full scale sine wave.
  2343. </p>
  2344. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2345. <p class=desc>Read several frequency bins, returning their sum. The higher
  2346. audio octaves are represented by many bins, which are typically read
  2347. as a group for audio visualization.
  2348. </p>
  2349. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2350. <p class=desc>New data is produced very radidly, approximately 344 times
  2351. per second. Multiple outputs can be averaged together, so available()
  2352. returns true at a slower rate.
  2353. </p>
  2354. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2355. <p class=desc>Set the window function to be used. AudioWindowHanning256
  2356. is the default. Windowing may be disabled by NULL, but windowing
  2357. should be used for all non-periodic (music) signals, and all periodic
  2358. signals that are not exact integer division of the sample rate.
  2359. </p>
  2360. <h3>Examples</h3>
  2361. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2362. </p>
  2363. <h3>Notes</h3>
  2364. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2365. num is 0 to 127.</p>
  2366. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  2367. <p>Window Types:
  2368. <ul>
  2369. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  2370. <li><span class=literal>AudioWindowBartlett256</span></li>
  2371. <li><span class=literal>AudioWindowBlackman256</span></li>
  2372. <li><span class=literal>AudioWindowFlattop256</span></li>
  2373. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  2374. <li><span class=literal>AudioWindowNuttall256</span></li>
  2375. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  2376. <li><span class=literal>AudioWindowWelch256</span></li>
  2377. <li><span class=literal>AudioWindowHamming256</span></li>
  2378. <li><span class=literal>AudioWindowCosine256</span></li>
  2379. <li><span class=literal>AudioWindowTukey256</span></li>
  2380. </ul>
  2381. </p>
  2382. </script>
  2383. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  2384. <div class="form-row">
  2385. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2386. <input type="text" id="node-input-name" placeholder="Name">
  2387. </div>
  2388. </script>
  2389. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  2390. <h3>Summary</h3>
  2391. <div class=tooltipinfo>
  2392. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  2393. with real value (magnitude) output. The frequency resolution is
  2394. 43 Hz, useful detailed for audio visualization.</p>
  2395. </div>
  2396. <h3>Audio Connections</h3>
  2397. <table class=doc align=center cellpadding=3>
  2398. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2399. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2400. </table>
  2401. <h3>Functions</h3>
  2402. <p class=func><span class=keyword>available</span>();</p>
  2403. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2404. </p>
  2405. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2406. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  2407. so 1.0 represents a full scale sine wave.
  2408. </p>
  2409. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2410. <p class=desc>Read several frequency bins, returning their sum. The higher
  2411. audio octaves are represented by many bins, which are typically read
  2412. as a group for audio visualization.
  2413. </p>
  2414. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2415. <p class=desc>This function does nothing. The 1024 point FFT always
  2416. updates at approximately 86 times per second.
  2417. </p>
  2418. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2419. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  2420. is the default. Windowing may be disabled by NULL, but windowing
  2421. should be used for all non-periodic (music) signals, and all periodic
  2422. signals that are not exact integer division of the sample rate.
  2423. </p>
  2424. <h3>Examples</h3>
  2425. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  2426. </p>
  2427. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  2428. </p>
  2429. <h3>Notes</h3>
  2430. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2431. num is 0 to 511.</p>
  2432. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  2433. <p>Window Types:
  2434. <ul>
  2435. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  2436. <li><span class=literal>AudioWindowBartlett1024</span></li>
  2437. <li><span class=literal>AudioWindowBlackman1024</span></li>
  2438. <li><span class=literal>AudioWindowFlattop1024</span></li>
  2439. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  2440. <li><span class=literal>AudioWindowNuttall1024</span></li>
  2441. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  2442. <li><span class=literal>AudioWindowWelch1024</span></li>
  2443. <li><span class=literal>AudioWindowHamming1024</span></li>
  2444. <li><span class=literal>AudioWindowCosine1024</span></li>
  2445. <li><span class=literal>AudioWindowTukey1024</span></li>
  2446. </ul>
  2447. </p>
  2448. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  2449. Average usage is much lower. Future versions might distribute the
  2450. load more evenly over time....
  2451. </p>
  2452. </script>
  2453. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  2454. <div class="form-row">
  2455. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2456. <input type="text" id="node-input-name" placeholder="Name">
  2457. </div>
  2458. </script>
  2459. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  2460. <h3>Summary</h3>
  2461. <div class=tooltipinfo>
  2462. <p>Detect the level of a single tone</p>
  2463. </div>
  2464. <h3>Audio Connections</h3>
  2465. <table class=doc align=center cellpadding=3>
  2466. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2467. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2468. </table>
  2469. <h3>Functions</h3>
  2470. <p class=func><span class=keyword>frequency</span>(freq);</p>
  2471. <p class=desc>Set the frequency to detect. The default detection time
  2472. will be 10 cycles of this frequency.
  2473. </p>
  2474. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  2475. <p class=desc>Set the frequency to detect, and the number of cycles.
  2476. Longer detection time (more cycles) will give higher precision,
  2477. but of course slower response.
  2478. </p>
  2479. <p class=func><span class=keyword>available</span>();</p>
  2480. <p class=desc>Returns true (non-zero) each time a detection interval
  2481. (number of cycles) completed and a new level is detected.
  2482. </p>
  2483. <p class=func><span class=keyword>read</span>();</p>
  2484. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  2485. </p>
  2486. <p class=func><span class=keyword>threshold</span>(level);</p>
  2487. <p class=desc>Set a detection threshold, where the bool test operation
  2488. will return true if at or above this level, or false when below.
  2489. </p>
  2490. <p class=func>(bool)</p>
  2491. <p class=desc>By testing the object as a boolean value, you can respond
  2492. to detection of a tone.
  2493. </p>
  2494. <h3>Examples</h3>
  2495. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  2496. </p>
  2497. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  2498. </p>
  2499. <h3>Notes</h3>
  2500. <p>Low frequency detection has trouble with numerical precision.
  2501. Works really well for all 8 DTMF frequencies, but fails for
  2502. detecting "sub audible tones" used in some control applications.</p>
  2503. <p>The (bool) test continues to return true until the next detection
  2504. interval (the configured number of cycles). This behavior may
  2505. change in future versions, for a single true each time the signal
  2506. is detected, and then false for the remainder of that interval.</p>
  2507. </script>
  2508. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  2509. <div class="form-row">
  2510. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2511. <input type="text" id="node-input-name" placeholder="Name">
  2512. </div>
  2513. </script>
  2514. <script type="text/x-red" data-help-name="AudioAnalyzeNoteFrequency">
  2515. <h3>Summary</h3>
  2516. <div class=tooltipinfo>
  2517. <p>Detect with fairly good accuracy the fundamental frequency f<sub>o</sub>
  2518. of musical notes, such as electric guitar and bass.</p>
  2519. </div>
  2520. <p>Written By Collin Duffy</p>
  2521. <h3>Audio Connections</h3>
  2522. <table class=doc align=center cellpadding=3>
  2523. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2524. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2525. </table>
  2526. <h3>Functions</h3>
  2527. <p class=func><span class=keyword>begin</span>(threshold);</p>
  2528. <p class=desc>Initialize and start detecting frequencies,
  2529. with an initial threshold (the amount of allowed uncertainty).
  2530. </p>
  2531. <p class=func><span class=keyword>available</span>();</p>
  2532. <p class=desc>Returns true (non-zero) when a valid
  2533. frequency is detected.
  2534. </p>
  2535. <p class=func><span class=keyword>read</span>();</p>
  2536. <p class=desc>Read the detected frequency.
  2537. </p>
  2538. <p class=func><span class=keyword>probability</span>();</p>
  2539. <p class=desc>Return the level of certainty, betweeo 0 to 1.0.
  2540. </p>
  2541. <p class=func><span class=keyword>threshold</span>(level);</p>
  2542. <p class=desc>Set the detection threshold, the amount of allowed uncertainty.
  2543. </p>
  2544. <h3>Examples</h3>
  2545. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; NoteFrequency
  2546. </p>
  2547. <h3>Notes</h3>
  2548. <p>The <a href="http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf">YIN algorithm</a> (PDF)
  2549. is used to detect frequencies, with many optimizations for
  2550. frequencies between 29-400Hz. This algorithm can be somewhat
  2551. memory and processor hungry but will allow you to detect with
  2552. fairly good accuracy the fundamental frequencies from
  2553. electric guitars and basses.</p>
  2554. <p>Within the code, AUDIO_GUITARTUNER_BLOCKS
  2555. may be edited to control low frequency range. The default
  2556. (24) allows measurement down to 29.14 Hz, or B(flat)0.</p>
  2557. <p>TODO: The usable upper range of this object is not well known.
  2558. Duff says "it should be good up to 1000Hz", but may have trouble
  2559. at 4 kHz. Please <a href="https://forum.pjrc.com/threads/32252-Different-Range-FFT-Algorithm/page2">post feedback here</a>, ideally with audio clips for the NoteFrequency example.</p>
  2560. <p>This object was contributed by Collin Duffy from his
  2561. <a href="https://github.com/duff2013/AudioTuner">AudioTuner project</a>.
  2562. Additional details and documentation may be found there.</p>
  2563. </script>
  2564. <script type="text/x-red" data-template-name="AudioAnalyzeNoteFrequency">
  2565. <div class="form-row">
  2566. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2567. <input type="text" id="node-input-name" placeholder="Name">
  2568. </div>
  2569. </script>
  2570. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  2571. <h3>Summary</h3>
  2572. <div class=tooltipinfo>
  2573. <p>Print raw audio data to the Arduino Serial Monitor. This
  2574. object creates massive output quickly, and should not normally be used.</p>
  2575. </div>
  2576. <h3>Audio Connections</h3>
  2577. <table class=doc align=center cellpadding=3>
  2578. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2579. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  2580. </table>
  2581. <h3>Functions</h3>
  2582. <p class=func><span class=keyword>name</span>(string);</p>
  2583. <p class=desc>blah blah blah blah
  2584. </p>
  2585. <p class=func><span class=keyword>trigger</span>();</p>
  2586. <p class=desc>blah blah blah blah
  2587. </p>
  2588. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  2589. <p class=desc>blah blah blah blah
  2590. </p>
  2591. <p class=func><span class=keyword>delay</span>(samples);</p>
  2592. <p class=desc>blah blah blah blah
  2593. </p>
  2594. <p class=func><span class=keyword>length</span>(samples);</p>
  2595. <p class=desc>blah blah blah blah
  2596. </p>
  2597. <!--
  2598. <h3>Examples</h3>
  2599. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2600. </p>
  2601. -->
  2602. <h3>Notes</h3>
  2603. <p>This object doesn't work very well and probably should not be used.</p>
  2604. </script>
  2605. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  2606. <div class="form-row">
  2607. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2608. <input type="text" id="node-input-name" placeholder="Name">
  2609. </div>
  2610. </script>
  2611. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  2612. <h3>Summary</h3>
  2613. <div class=tooltipinfo>
  2614. <p>Control the SGTL5000 chip on the
  2615. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  2616. SGTL5000 is always used in slave mode, where Teensy controls
  2617. all I2S timing.
  2618. </p>
  2619. <p align=center><img src="img/sgtl5000closeup.jpg"></p>
  2620. </div>
  2621. <h3>Audio Connections</h3>
  2622. <p>This object has no audio inputs or outputs. Separate i2s objects
  2623. are used to send and receive audio data. I2S master mode objects
  2624. must be used, because this object configures the SGTL5000 in slave
  2625. mode, where it depends on Teensy to provide all I2S clocks.
  2626. This object controls
  2627. how the SGTL5000 will use those I2S audio streams.</p>
  2628. <h3>Functions</h3>
  2629. <p>These are the most commonly used SGTL5000 functions.</p>
  2630. <p class=func><span class=keyword>enable</span>();</p>
  2631. <p class=desc>Start the SGTL5000. This function should be called first.
  2632. </p>
  2633. <p class=func><span class=keyword>volume</span>(level);</p>
  2634. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  2635. 0.8 corresponds to the maximum undistorted output for a full scale
  2636. signal. Usually 0.5 is a comfortable listening level. The line
  2637. level outputs are <em>not</em> changed by this function.
  2638. </p>
  2639. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2640. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  2641. </p>
  2642. <p class=func><span class=keyword>micGain</span>(dB);</p>
  2643. <p class=desc>When using the microphone input, set the amplifier gain.
  2644. The input number is in decibels, from 0 to 63.
  2645. </p>
  2646. <h3>Signal Levels</h3>
  2647. <p>The default signal levels should be used for most applications,
  2648. but these functions allow you to customize the analog signals.</p>
  2649. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  2650. <p class=desc>Silence the headphone output.
  2651. </p>
  2652. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  2653. <p class=desc>Turn the headphone output on.
  2654. </p>
  2655. <p class=func><span class=keyword>muteLineout</span>();</p>
  2656. <p class=desc>Silence the line level outputs.
  2657. </p>
  2658. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  2659. <p class=desc>Turn the line level outputs on.
  2660. </p>
  2661. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  2662. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  2663. Fifteen settings are possible:
  2664. </p>
  2665. <pre class="desc">
  2666. 0: 3.12 Volts p-p
  2667. 1: 2.63 Volts p-p
  2668. 2: 2.22 Volts p-p
  2669. 3: 1.87 Volts p-p
  2670. 4: 1.58 Volts p-p
  2671. 5: 1.33 Volts p-p (default)
  2672. 6: 1.11 Volts p-p
  2673. 7: 0.94 Volts p-p
  2674. 8: 0.79 Volts p-p
  2675. 9: 0.67 Volts p-p
  2676. 10: 0.56 Volts p-p
  2677. 11: 0.48 Volts p-p
  2678. 12: 0.40 Volts p-p
  2679. 13: 0.34 Volts p-p
  2680. 14: 0.29 Volts p-p
  2681. 15: 0.24 Volts p-p
  2682. </pre>
  2683. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  2684. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  2685. settings for left and right. The same 15 settings are available.
  2686. </p>
  2687. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  2688. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  2689. voltage range. The following settings are possible:
  2690. </p>
  2691. <pre class="desc">
  2692. 13: 3.16 Volts p-p
  2693. 14: 2.98 Volts p-p
  2694. 15: 2.83 Volts p-p
  2695. 16: 2.67 Volts p-p
  2696. 17: 2.53 Volts p-p
  2697. 18: 2.39 Volts p-p
  2698. 19: 2.26 Volts p-p
  2699. 20: 2.14 Volts p-p
  2700. 21: 2.02 Volts p-p
  2701. 22: 1.91 Volts p-p
  2702. 23: 1.80 Volts p-p
  2703. 24: 1.71 Volts p-p
  2704. 25: 1.62 Volts p-p
  2705. 26: 1.53 Volts p-p
  2706. 27: 1.44 Volts p-p
  2707. 28: 1.37 Volts p-p
  2708. 29: 1.29 Volts p-p (default)
  2709. 30: 1.22 Volts p-p
  2710. 31: 1.16 Volts p-p
  2711. </pre>
  2712. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  2713. <p class=desc>Adjust the line level outout voltage range, with separate
  2714. settings for left and right. The same settings (13 to 31) are available.
  2715. </p>
  2716. <h3>Signal Conditioning</h3>
  2717. <p>Usually these digital signal conditioning features should be left at their
  2718. default settings.
  2719. </p>
  2720. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  2721. <p class=desc>By default, the analog input (either line-level inputs or mic)
  2722. is high-pass filtered, to remove any DC component. This function
  2723. freezes the filter, so the current DC component is still substracted, but
  2724. the filter stops tracking any DC or low frequency changes.
  2725. </p>
  2726. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  2727. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  2728. low frequencies are allowed to enter the digital signal.
  2729. </p>
  2730. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  2731. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  2732. allows it to resume tracking DC and low frequency changes, if
  2733. previously frozen. This is the default setting.
  2734. </p>
  2735. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  2736. <p class=desc>Normally output volume should be used with volume(), which
  2737. changes the analog gain in the headphone amplifier. This function
  2738. on the other hand controls digital attenuation before conversion to analog, which
  2739. reduces resolution, but allows another fine control of output
  2740. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  2741. at 1.0.
  2742. </p>
  2743. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and graceful
  2744. ramping is handled by the chip so that a new volume may be set directly in
  2745. a single call.
  2746. </p>
  2747. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  2748. <p class=desc>Adjust the digital output volume separately on left and
  2749. right channels.
  2750. </p>
  2751. <p class=func><span class=keyword>dacVolumeRamp</span>();</p>
  2752. <p class=desc>Enable graceful volume ramping. The dacVolume adjusts gradually using
  2753. an exponential curve. Pops or loud clicks are avoided when making large
  2754. changes in volume level.
  2755. </p>
  2756. <p class=func><span class=keyword>dacVolumeRampLinear</span>();</p>
  2757. <p class=desc>Enable faster volume ramping. A slight click may be heard during a
  2758. large volume change.
  2759. </p>
  2760. <p class=func><span class=keyword>dacVolumeRampDisable</span>();</p>
  2761. <p class=desc>Do not use any gradual ramping. The zero cross feature still helps
  2762. for small changes, but large volume changes may produce a pop or click.
  2763. </p>
  2764. <h3>Audio Processor</h3>
  2765. <p>The optional digital audio processor is capable of implementing
  2766. one or more of: automatic volume control, surround sound control,
  2767. bass enhancement, and tonal adjustments (either a
  2768. simple tone control, or a parametric equalizer, or a graphic equalizer),
  2769. in that order.
  2770. </p>
  2771. <p>These signal processing features are implemented in the SGTL5000 chip,
  2772. so they do not consume CPU time on Teensy. However, the order of
  2773. these processes is fixed in the hardware.
  2774. </p>
  2775. <p>It is good practice to mute the outputs before enabling or disabling
  2776. the Audio Processor, to avoid clicks or thumps.
  2777. </p>
  2778. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  2779. <p class=desc>Enable the audio processor to pre-process the input
  2780. (from either line-level inputs or microphone) before it's sent
  2781. to Teensy by I2S.
  2782. </p>
  2783. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  2784. <p class=desc>Enable the audio processor to post-process Teensy's
  2785. I2S output before it's turned into analog signals for the
  2786. headphones and/or line level outputs.
  2787. </p>
  2788. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  2789. <p class=desc>Disable the audio processor.
  2790. </p>
  2791. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  2792. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  2793. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  2794. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  2795. as 2. <em>response</em> controls the integration time for the compressor and can take
  2796. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  2797. over a longer time, allowing short-term peaks through.
  2798. </p>
  2799. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  2800. knee' compressor is used to progressively compress louder values which are near to or above the
  2801. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  2802. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  2803. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  2804. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  2805. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  2806. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  2807. </p>
  2808. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  2809. <p class=desc>Enables auto volume control, using the previously specified settings.
  2810. </p>
  2811. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  2812. <p class=desc>Disables auto volume control.
  2813. </p>
  2814. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  2815. <p class=desc>Enable virtual surround processing, to give a broader and
  2816. deeper stereo image (even with mono input).
  2817. </p>
  2818. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  2819. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  2820. the width to maximum to avoid pops.
  2821. </p>
  2822. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  2823. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2824. </p>
  2825. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  2826. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2827. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  2828. </p>
  2829. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  2830. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  2831. the original stereo signal has bass levels boosted and is then mixed back into
  2832. the stereo signal, which is then optionally high pass filtered (to remove
  2833. inaudible subsonic frequencies).
  2834. </p>
  2835. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  2836. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  2837. enhancement level to zero.
  2838. </p>
  2839. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  2840. <p class=desc>Configures the bass enhancement by setting the levels of the
  2841. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2842. There is no high-pass filter.
  2843. </p>
  2844. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2845. steps of 0.5dB, to avoid pops.
  2846. </p>
  2847. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  2848. <p class=desc>Configures the bass enhancement by setting the levels of the
  2849. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2850. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  2851. as follows:
  2852. </p>
  2853. <pre class="desc">
  2854. value frequency
  2855. 0 80Hz
  2856. 1 100Hz
  2857. 2 125Hz
  2858. 3 150Hz
  2859. 4 175Hz
  2860. 5 200Hz
  2861. 6 225Hz
  2862. </pre>
  2863. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2864. steps of 0.5dB, to avoid pops.
  2865. </p>
  2866. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  2867. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  2868. one of</p>
  2869. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  2870. Equalizers and tone controls disabled, flat frequency response.</p>
  2871. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  2872. Enables the 7-band parametric equalizer, thus disabling the
  2873. tone controls and graphic equalizer.</p>
  2874. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  2875. Enables bass and treble tone controls, disabling the parametric
  2876. equalization and graphic equalizer.</p>
  2877. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  2878. Enables the five-band graphic equalizer, disabling the parametric
  2879. equalization and tone controls.</p>
  2880. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  2881. <p class=desc>Configures bass and treble tone controls, which are
  2882. implemented as one second order low pass filter (bass) in parallel with
  2883. one second order high pass filter (treble).
  2884. </p>
  2885. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  2886. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  2887. </p>
  2888. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  2889. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  2890. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  2891. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  2892. </p>
  2893. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  2894. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  2895. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  2896. </p>
  2897. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  2898. to avoid pops.
  2899. </p>
  2900. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  2901. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  2902. is specified along with a pointer to an array of filter coefficients.
  2903. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  2904. filters whose frequencies, gain, and Q may be freely configured, but each filter
  2905. can only be specified as a set of filter coefficients.
  2906. </p>
  2907. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  2908. <p class=desc>Enables zero or more of the already enabled parametric filters.
  2909. </p>
  2910. <h3>Examples</h3>
  2911. <p>Nearly all of the library's examples use this object. These
  2912. examples demonstrate its special features.
  2913. </p>
  2914. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  2915. </p>
  2916. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  2917. </p>
  2918. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  2919. </p>
  2920. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  2921. </p>
  2922. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  2923. </p>
  2924. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  2925. </p>
  2926. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; VolumeRamp
  2927. </p>
  2928. <h3>Notes</h3>
  2929. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  2930. and surround enhancement while speech uses bandpass filtering and auto volume control
  2931. compression.
  2932. </p>
  2933. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  2934. </p>
  2935. </script>
  2936. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  2937. <div class="form-row">
  2938. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2939. <input type="text" id="node-input-name" placeholder="Name">
  2940. </div>
  2941. </script>
  2942. <script type="text/x-red" data-help-name="AudioControlWM8731">
  2943. <h3>Summary</h3>
  2944. <div class=tooltipinfo>
  2945. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  2946. </div>
  2947. <h3>Audio Connections</h3>
  2948. <p>This object has no audio inputs or outputs. Separate i2s objects
  2949. are used to send and receive audio data. I2S master mode objects
  2950. must be used, since this control object configures the WM8731 into
  2951. slave mode.
  2952. </p>
  2953. <h3>Functions</h3>
  2954. <p class=func><span class=keyword>enable</span>();</p>
  2955. <p class=desc>blah blah blah blah
  2956. </p>
  2957. <p class=func><span class=keyword>disable</span>();</p>
  2958. <p class=desc>not implemented
  2959. </p>
  2960. <p class=func><span class=keyword>volume</span>(level);</p>
  2961. <p class=desc>blah blah blah blah
  2962. </p>
  2963. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2964. <p class=desc>not implemented
  2965. </p>
  2966. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2967. <p class=desc>not implemented
  2968. </p>
  2969. <!--
  2970. <h3>Examples</h3>
  2971. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2972. </p>
  2973. -->
  2974. <h3>Notes</h3>
  2975. <p></p>
  2976. </script>
  2977. <script type="text/x-red" data-template-name="AudioControlWM8731">
  2978. <div class="form-row">
  2979. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2980. <input type="text" id="node-input-name" placeholder="Name">
  2981. </div>
  2982. </script>
  2983. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  2984. <h3>Summary</h3>
  2985. <div class=tooltipinfo>
  2986. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  2987. </div>
  2988. <h3>Audio Connections</h3>
  2989. <p>This object has no audio inputs or outputs. Separate i2s objects
  2990. are used to send and receive audio data. I2S slave mode objects
  2991. must be used, since this control object configures the WM8731 into
  2992. master mode.
  2993. </p>
  2994. <h3>Functions</h3>
  2995. <p class=func><span class=keyword>enable</span>();</p>
  2996. <p class=desc>blah blah blah blah
  2997. </p>
  2998. <p class=func><span class=keyword>disable</span>();</p>
  2999. <p class=desc>not implemented
  3000. </p>
  3001. <p class=func><span class=keyword>volume</span>(level);</p>
  3002. <p class=desc>blah blah blah blah
  3003. </p>
  3004. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3005. <p class=desc>not implemented
  3006. </p>
  3007. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3008. <p class=desc>not implemented
  3009. </p>
  3010. <h3>Examples</h3>
  3011. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  3012. </p>
  3013. <h3>Notes</h3>
  3014. <p></p>
  3015. </script>
  3016. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  3017. <div class="form-row">
  3018. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3019. <input type="text" id="node-input-name" placeholder="Name">
  3020. </div>
  3021. </script>
  3022. <script type="text/x-red" data-help-name="AudioControlAK4558">
  3023. <h3>Summary</h3>
  3024. <div class=tooltipinfo>
  3025. <p>Control the AK4558 chip on the <a href="https://hackaday.io/project/8567-hifi-audio-codec-module" target="_blank">HiFi Audio CODEC Module</a>
  3026. in slave mode, where the Teensy controls all I2S timing.</p>
  3027. </div>
  3028. <h3>Audio Connections</h3>
  3029. <p>This object has no audio inputs or outputs. Separate I2S objects
  3030. are used to send and receive audio data.
  3031. </p>
  3032. <h3>Functions</h3>
  3033. <p class=func><span class=keyword>enable</span>();</p>
  3034. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3035. </p>
  3036. <p class=func><span class=keyword>enableIn</span>();</p>
  3037. <p class=desc>Enables the ADC module.
  3038. </p>
  3039. <p class=func><span class=keyword>enableOut</span>();</p>
  3040. <p class=desc>Enables the DAC module.
  3041. </p>
  3042. <p class=func><span class=keyword>disable</span>();</p>
  3043. <p class=desc>Disables the ADC and the DAC modules.
  3044. </p>
  3045. <p class=func><span class=keyword>disableIn</span>();</p>
  3046. <p class=desc>Disable the ADC module.
  3047. </p>
  3048. <p class=func><span class=keyword>disableOut</span>();</p>
  3049. <p class=desc>Disable the DAC module.
  3050. </p>
  3051. <p class=func><span class=keyword>volume</span>(level);</p>
  3052. <p class=desc>Accepts a float in range 0.0-1.0 and sets the line output volume accordingly.
  3053. </p>
  3054. <p class=func><span class=keyword>volumeLeft</span>(level);</p>
  3055. <p class=desc>Accepts a float in range 0.0-1.0 and sets the left line output volume accordingly.
  3056. </p>
  3057. <p class=func><span class=keyword>volumeRight</span>(level);</p>
  3058. <p class=desc>Accepts a float in range 0.0-1.0 and sets the right line output volume accordingly.
  3059. </p>
  3060. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3061. <p class=desc>NOT SUPPORTED BY THE AK4558
  3062. </p>
  3063. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3064. <p class=desc>not implemented yet
  3065. </p>
  3066. <h3>Examples</h3>
  3067. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; PassthroughTest
  3068. </p>
  3069. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; SineOutTest
  3070. </p>
  3071. <h3>Notes</h3>
  3072. <p>TODO: Implement inputSelect() function to enable mono left, mono right, stereo operation.</p>
  3073. <p>TODO: Implement ADC and DAC filters control.</p>
  3074. <p>TODO: Implement DAC level attenuator attack rate modifier.</p>
  3075. </script>
  3076. <script type="text/x-red" data-template-name="AudioControlAK4558">
  3077. <div class="form-row">
  3078. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3079. <input type="text" id="node-input-name" placeholder="Name">
  3080. </div>
  3081. </script>
  3082. <script type="text/x-red" data-help-name="AudioControlCS4272">
  3083. <h3>Summary</h3>
  3084. <div class=tooltipinfo>
  3085. <p>Control the CS4272 chip on the <a href="https://hackaday.io/project/5912-teensy-super-audio-board" target="_blank">Super Audio Board</a>.
  3086. </p>
  3087. <p>TODO: does this control object put the CS4272 into I2S master or slave mode</p>
  3088. </div>
  3089. <h3>Audio Connections</h3>
  3090. <p>This object has no audio inputs or outputs. Separate I2S objects
  3091. are used to send and receive audio data.
  3092. </p>
  3093. <h3>Functions</h3>
  3094. <p class=func><span class=keyword>enable</span>();</p>
  3095. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3096. </p>
  3097. <p class=func><span class=keyword>volume</span>(vol);</p>
  3098. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3099. </p>
  3100. <p class=func><span class=keyword>volume</span>(left, right);</p>
  3101. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3102. </p>
  3103. <p class=func><span class=keyword>dacVolume</span>(vol);</p>
  3104. <p class=desc>Set the volume level. Range is 0 to 1.0. TODO: what's the
  3105. distinction between volume() and dacVolume()?
  3106. </p>
  3107. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  3108. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3109. </p>
  3110. <p class=func><span class=keyword>muteOutput</span>();</p>
  3111. <p class=desc>TODO: description
  3112. </p>
  3113. <p class=func><span class=keyword>unmuteOutput</span>();</p>
  3114. <p class=desc>TODO: description
  3115. </p>
  3116. <p class=func><span class=keyword>muteInput</span>();</p>
  3117. <p class=desc>TODO: description
  3118. </p>
  3119. <p class=func><span class=keyword>unmuteInput</span>();</p>
  3120. <p class=desc>TODO: description
  3121. </p>
  3122. <p class=func><span class=keyword>enableDither</span>();</p>
  3123. <p class=desc>TODO: description
  3124. </p>
  3125. <p class=func><span class=keyword>disableDither</span>();</p>
  3126. <p class=desc>TODO: description
  3127. </p>
  3128. <h3>Hardware</h3>
  3129. <p>Pin 2 must be connected to the CS4272 reset. SDA &amp; SCL are used for all control.
  3130. </p>
  3131. <h3>Notes</h3>
  3132. </script>
  3133. <script type="text/x-red" data-template-name="AudioControlCS4272">
  3134. <div class="form-row">
  3135. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3136. <input type="text" id="node-input-name" placeholder="Name">
  3137. </div>
  3138. </script>
  3139. </body>
  3140. </html>