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

5440 lines
246KB

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