Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

3229 Zeilen
142KB

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