Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

5331 lines
236KB

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