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.

4374 line
196KB

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