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.

3251 lines
143KB

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