Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

3641 rinda
161KB

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