You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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