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.

3164 lines
140KB

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