Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

5572 lines
254KB

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