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.

2741 lines
122KB

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