Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

5508 lines
251KB

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