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

5576 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_BANDLIMIT_SAWTOOTH</span></li>
  3131. <li><span class=literal>WAVEFORM_SAWTOOTH_REVERSE</span></li>
  3132. <li><span class=literal>WAVEFORM_BANDLIMIT_SAWTOOTH_REVERSE</span></li>
  3133. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  3134. <li><span class=literal>WAVEFORM_BANDLIMIT_SQUARE</span></li>
  3135. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  3136. <li><span class=literal>WAVEFORM_TRIANGLE_VARIABLE</span></li>
  3137. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  3138. <li><span class=literal>WAVEFORM_PULSE</span></li>
  3139. <li><span class=literal>WAVEFORM_BANDLIMIT_PULSE</span></li>
  3140. <li><span class=literal>WAVEFORM_SAMPLE_HOLD</span></li>
  3141. </ul>
  3142. </p>
  3143. </script>
  3144. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  3145. <div class="form-row">
  3146. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3147. <input type="text" id="node-input-name" placeholder="Name">
  3148. </div>
  3149. </script>
  3150. <script type="text/x-red" data-help-name="AudioSynthWaveformModulated">
  3151. <h3>Summary</h3>
  3152. <div class=tooltipinfo>
  3153. <p>Create a waveform <b>with modulation</b>: sine, sawtooth, square, triangle, pulse, random S&H or arbitrary.</p>
  3154. <p align=center><img src="img/waveformsmod.png"></p>
  3155. </div>
  3156. <h3>Audio Connections</h3>
  3157. <table class=doc align=center cellpadding=3>
  3158. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3159. <tr class=odd><td align=center>In 0</td><td>Frequency or Phase</td></tr>
  3160. <tr class=odd><td align=center>In 1</td><td>Shape (Pulse &amp; Var Triangle)</td></tr>
  3161. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  3162. </table>
  3163. <h3>Functions</h3>
  3164. <p class=func><span class=keyword>begin</span>(waveform);</p>
  3165. <p class=desc>Configure the waveform type to create.
  3166. </p>
  3167. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  3168. <p class=desc>Output a waveform, and set the amplitude and base frequency.
  3169. </p>
  3170. <p class=func><span class=keyword>frequency</span>(freq);</p>
  3171. <p class=desc>Change the base (unmodulated) frequency.
  3172. </p>
  3173. <p class=func><span class=keyword>amplitude</span>(level);</p>
  3174. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  3175. </p>
  3176. <p class=func><span class=keyword>offset</span>(level);</p>
  3177. <p class=desc>Add a DC offset, from -1.0 to +1.0. Useful for generating
  3178. waveforms to use as control or modulation signals.
  3179. </p>
  3180. <p class=func><span class=keyword>frequencyModulation</span>(octaves);</p>
  3181. <p class=desc>
  3182. Configure for frequency modulation mode (the default) where the
  3183. input signal will adjust the frequency by a specific number of
  3184. octaves (the default is 8 octaves). If the -1.0 to +1.0 signal
  3185. represents a &plusmn;10 volt range and you wish to have control
  3186. at 1 volt/octave, then configure for 10 octaves range. The
  3187. maximum modulation sensitivity is 12 octaves.
  3188. </p>
  3189. <p class=func><span class=keyword>phaseModulation</span>(degrees);</p>
  3190. <p class=desc>
  3191. Configure for phase modulation mode where the input signal will
  3192. adjust the waveform phase angle a specific number of degrees.
  3193. 180.0 allows a full scale &plusmn;1.0 signal to span 1 full
  3194. cycle of the waveform. Maximum modulation sensitivity is 9000
  3195. degrees (&plusmn;25 cycles).
  3196. </p>
  3197. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  3198. <p class=desc>
  3199. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  3200. must be an array of 256 samples. Currently, the data is used
  3201. without any filtering, which can cause aliasing with frequencies
  3202. above 172 Hz. For higher frequency output, you must bandwidth
  3203. limit your waveform data. Someday, "maxFreq" will be used to
  3204. do this automatically.
  3205. </p>
  3206. <h3>Examples</h3>
  3207. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; WaveformsModulated
  3208. </p>
  3209. <h3>Notes</h3>
  3210. <p>Supported Waveforms:<br>
  3211. <ul>
  3212. <li><span class=literal>WAVEFORM_SINE</span></li>
  3213. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  3214. <li><span class=literal>WAVEFORM_SAWTOOTH_REVERSE</span></li>
  3215. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  3216. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  3217. <li><span class=literal>WAVEFORM_TRIANGLE_VARIABLE</span></li>
  3218. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  3219. <li><span class=literal>WAVEFORM_PULSE</span></li>
  3220. <li><span class=literal>WAVEFORM_SAMPLE_HOLD</span></li>
  3221. </ul>
  3222. </p>
  3223. <p>The Sample &amp; Hold waveform does not support phase modulation.
  3224. Attempting to modulate its phase may give random or
  3225. inconsistent results. Use only frequency modulation
  3226. to vary the Sample &amp; Hold waveform speed
  3227. </p>
  3228. </script>
  3229. <script type="text/x-red" data-template-name="AudioSynthWaveformModulated">
  3230. <div class="form-row">
  3231. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3232. <input type="text" id="node-input-name" placeholder="Name">
  3233. </div>
  3234. </script>
  3235. <script type="text/x-red" data-help-name="AudioSynthWaveformPWM">
  3236. <h3>Summary</h3>
  3237. <div class=tooltipinfo>
  3238. <p>Create a Pulse Width Modulated waveform, with an audio signal
  3239. controlling the pulse width duty cycle.</p>
  3240. <p align=center><img src="img/pwm.png"></p>
  3241. </div>
  3242. <h3>Audio Connections</h3>
  3243. <table class=doc align=center cellpadding=3>
  3244. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3245. <tr class=odd><td align=center>In 0</td><td>Control Signal Output</td></tr>
  3246. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  3247. </table>
  3248. <p>The duty cycle is 50% when the control waveform is zero.
  3249. As the control input causes a linear changes in PWM duty
  3250. cycle, from nearly 0 to 100% over -1.0 to +1.0 range.
  3251. See the notes below for minimum and maximum limitations.
  3252. </p>
  3253. <h3>Functions</h3>
  3254. <p class=func><span class=keyword>frequency</span>(freq);</p>
  3255. <p class=desc>Change the frequency.
  3256. </p>
  3257. <p class=func><span class=keyword>amplitude</span>(level);</p>
  3258. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  3259. </p>
  3260. <h3>Examples</h3>
  3261. <p class=exam>TODO, examples needed
  3262. </p>
  3263. <h3>Notes</h3>
  3264. <p>The maximum duty cycle is 65536 samples high followed by
  3265. one sample low (99.9985%) and the minimum duty cycle is
  3266. 1 sample high followed by 65536 samples low (0.00153%).
  3267. </p>
  3268. </script>
  3269. <script type="text/x-red" data-template-name="AudioSynthWaveformPWM">
  3270. <div class="form-row">
  3271. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3272. <input type="text" id="node-input-name" placeholder="Name">
  3273. </div>
  3274. </script>
  3275. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  3276. <h3>Summary</h3>
  3277. <div class=tooltipinfo>
  3278. <p>Create a continuously varying (in frequency) sine wave</p>
  3279. </div>
  3280. <h3>Audio Connections</h3>
  3281. <table class=doc align=center cellpadding=3>
  3282. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3283. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  3284. </table>
  3285. <h3>Functions</h3>
  3286. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  3287. <p class=desc>Start generating frequency sweep output. The time is specified
  3288. in seconds. Level is 0 to 1.0.
  3289. </p>
  3290. <p class=func><span class=keyword>isPlaying</span>();</p>
  3291. <p class=desc>Returns true (non-zero) while the output is active.
  3292. </p>
  3293. <p class=func><span class=keyword>read</span>();</p>
  3294. <p class=desc>Returns the current frequency, or zero if the output is not active.
  3295. </p>
  3296. <h3>Examples</h3>
  3297. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; ToneSweep
  3298. </p>
  3299. <h3>Notes</h3>
  3300. <p>Uses excessive CPU time.</p>
  3301. <p>The frequency actually changes in discrete steps every 128 samples (2.9 ms).</p>
  3302. </script>
  3303. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  3304. <div class="form-row">
  3305. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3306. <input type="text" id="node-input-name" placeholder="Name">
  3307. </div>
  3308. </script>
  3309. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  3310. <h3>Summary</h3>
  3311. <div class=tooltipinfo>
  3312. <p>Create constant (DC) signal, useful for control of objects that take
  3313. a modulation or control input signal. This constant level can be
  3314. used to modify other waveforms using mixer or multiplier objects</p>
  3315. </div>
  3316. <h3>Audio Connections</h3>
  3317. <table class=doc align=center cellpadding=3>
  3318. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3319. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  3320. </table>
  3321. <h3>Functions</h3>
  3322. <p class=func><span class=keyword>amplitude</span>(level);</p>
  3323. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  3324. changed immediately.
  3325. </p>
  3326. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  3327. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  3328. gradually changed over a "milliseconds" time period. Any time may
  3329. be specified, but periods longer than 1 second may be automatically
  3330. shortened for small level changes, due to numerical precision limits.
  3331. </p>
  3332. <p class=func><span class=keyword>read</span>();</p>
  3333. <p class=desc>Read the current level. Returns -1.0 to 1.0. This can be
  3334. useful for monitoring the amplitude after configuring a slow change.
  3335. </p>
  3336. <!--
  3337. <h3>Examples</h3>
  3338. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3339. </p>
  3340. -->
  3341. <h3>Notes</h3>
  3342. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  3343. to a pure digital stream of numerical values. But the term is widely
  3344. understood in audio applications, so hopefully it's not too confusing?</p>
  3345. </script>
  3346. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  3347. <div class="form-row">
  3348. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3349. <input type="text" id="node-input-name" placeholder="Name">
  3350. </div>
  3351. </script>
  3352. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  3353. <h3>Summary</h3>
  3354. <div class=tooltipinfo>
  3355. <p>Create white noise.
  3356. </p>
  3357. <p align=center><img src="img/whitenoise.png"></p>
  3358. </div>
  3359. <h3>Audio Connections</h3>
  3360. <table class=doc align=center cellpadding=3>
  3361. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3362. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  3363. </table>
  3364. <h3>Functions</h3>
  3365. <p class=func><span class=keyword>amplitude</span>(level);</p>
  3366. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  3367. The default is off. Noise is generated only after setting
  3368. to a non-zero level.
  3369. </p>
  3370. <h3>Examples</h3>
  3371. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3372. </p>
  3373. <h3>Notes</h3>
  3374. <p>Setting the amplitude to zero causes this object to stop using
  3375. CPU time to generate random numbers.
  3376. </p>
  3377. </script>
  3378. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  3379. <div class="form-row">
  3380. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3381. <input type="text" id="node-input-name" placeholder="Name">
  3382. </div>
  3383. </script>
  3384. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  3385. <h3>Summary</h3>
  3386. <div class=tooltipinfo>
  3387. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  3388. </p>
  3389. <!--
  3390. <p align=center><img src="img/whitenoise.png"></p>
  3391. -->
  3392. </div>
  3393. <h3>Audio Connections</h3>
  3394. <table class=doc align=center cellpadding=3>
  3395. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3396. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  3397. </table>
  3398. <h3>Functions</h3>
  3399. <p class=func><span class=keyword>amplitude</span>(level);</p>
  3400. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  3401. The default is off. Noise is generated only after setting
  3402. to a non-zero level.
  3403. </p>
  3404. <h3>Examples</h3>
  3405. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  3406. </p>
  3407. <h3>Notes</h3>
  3408. <p>Setting the amplitude to zero causes this object to stop using
  3409. CPU time. CPU usage is approx 3% on Teensy 3.1.
  3410. </p>
  3411. <p>Stefan Stenzel's
  3412. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  3413. algorithm. Stefan's terms of use are "Use for any purpose. If used
  3414. in a commercial product, you should give me one."
  3415. </p>
  3416. </script>
  3417. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  3418. <div class="form-row">
  3419. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3420. <input type="text" id="node-input-name" placeholder="Name">
  3421. </div>
  3422. </script>
  3423. <script type="text/x-red" data-help-name="AudioEffectFade">
  3424. <h3>Summary</h3>
  3425. <div class=tooltipinfo>
  3426. <p>Gradually increase or decrease audio level.</p>
  3427. </div>
  3428. <h3>Audio Connections</h3>
  3429. <table class=doc align=center cellpadding=3>
  3430. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3431. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3432. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  3433. </table>
  3434. <h3>Functions</h3>
  3435. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  3436. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  3437. directly to the output) after "milliseconds" time.
  3438. </p>
  3439. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  3440. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  3441. after "milliseconds" time.
  3442. </p>
  3443. <!--
  3444. <h3>Examples</h3>
  3445. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3446. </p>
  3447. -->
  3448. <h3>Notes</h3>
  3449. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  3450. When one fade object is off (fully faded out) and the other on
  3451. (fully faded in), if both are started at the same moment for the
  3452. same time duration, their signal gains always add to 1.0. This
  3453. allows 2 fade objects to work together for a smooth transition
  3454. between a pair of signals.
  3455. </p>
  3456. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  3457. should be used when changing
  3458. settings on multiple objects, so all changes always take effect
  3459. at the same moment.
  3460. </p>
  3461. </script>
  3462. <script type="text/x-red" data-template-name="AudioEffectFade">
  3463. <div class="form-row">
  3464. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3465. <input type="text" id="node-input-name" placeholder="Name">
  3466. </div>
  3467. </script>
  3468. <script type="text/x-red" data-help-name="AudioEffectChorus">
  3469. <h3>Summary</h3>
  3470. <div class=tooltipinfo>
  3471. <p>The chorus effect simulates the richness of several nearly-identical
  3472. sound sources (like the way a choir sounds different to a single singer).
  3473. It does this by sampling from a delay line, so each voice is actually
  3474. the same but at a slightly different point in time. This is a type of
  3475. comb filtering.</p>
  3476. </div>
  3477. <p>Chorus combines one or more samples ranging from the most recent
  3478. sample back to about 50ms ago. The additional samples are evenly spread
  3479. through the supplied delay line, and there is no modulation.</p>
  3480. <p>If the number of voices is specified as 2, then the
  3481. effect combines the current sample and the oldest sample (the last one
  3482. in the delay line). If the number of voices is 3 then the effect combines
  3483. the most recent sample, the oldest sample and the sample in the middle of
  3484. the delay line.</p>
  3485. <p>For two voices the effect can be represented as:<br/>
  3486. result = (sample(0) + sample(dt))/2<br/>
  3487. where sample(0) represents the current sample and sample(dt)
  3488. is the sample in the delay line from dt milliseconds ago.</p>
  3489. <h3>Audio Connections</h3>
  3490. <table class=doc align=center cellpadding=3>
  3491. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  3492. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  3493. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  3494. </table>
  3495. <h3>Functions</h3>
  3496. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  3497. <p class=desc>Create a chorus by specifying the address of the delayline, the
  3498. total number of samples in the delay line (often done as an integer multiple of
  3499. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  3500. the original voice (so, 2 and up to get a chorus effect, although you can
  3501. specify 1 if you want).
  3502. </p>
  3503. <p class=func><span class=keyword>voices</span>(n_chorus);</p>
  3504. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  3505. </p>
  3506. <h3>Examples</h3>
  3507. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  3508. </p>
  3509. <h3>Notes</h3>
  3510. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  3511. </script>
  3512. <script type="text/x-red" data-template-name="AudioEffectChorus">
  3513. <div class="form-row">
  3514. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3515. <input type="text" id="node-input-name" placeholder="Name">
  3516. </div>
  3517. </script>
  3518. <script type="text/x-red" data-help-name="AudioEffectFlange">
  3519. <h3>Summary</h3>
  3520. <div class=tooltipinfo>
  3521. <p>Originally, flanging was produced by playing the same signal on two synchronized
  3522. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  3523. pressing on the flange of the reel (hence the name). This is a type of
  3524. comb filtering, and produces a harmonically-related series of peaks and notches
  3525. in the audio spectrum.</p>
  3526. </div>
  3527. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  3528. line, but the position of that sample varies sinusoidally.</p>
  3529. <p>The effect can be represented as:<br>
  3530. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  3531. <p>The value of the sine function is always a number from -1 to +1 and
  3532. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  3533. Thus, the delayed sample will be selected from the range (dt-depth) to
  3534. (dt+depth). This selection will vary at whatever rate is specified as the
  3535. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  3536. <h3>Audio Connections</h3>
  3537. <table class=doc align=center cellpadding=3>
  3538. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  3539. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  3540. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  3541. </table>
  3542. <h3>Functions</h3>
  3543. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  3544. <p class=desc>Create a flanger by specifying the address of the delayline, the
  3545. total number of samples in the delay line (often done as an integer multiple of
  3546. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  3547. the modulation depth (larger values give a greater variation) and the modulation
  3548. frequency, in Hertz.
  3549. </p>
  3550. <p class=func><span class=keyword>voices</span>(offset, depth, delayRate);</p>
  3551. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  3552. </p>
  3553. <h3>Examples</h3>
  3554. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  3555. </p>
  3556. <h3>Notes</h3>
  3557. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  3558. <p>Try these settings:<br>
  3559. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  3560. and<br>
  3561. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  3562. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  3563. double s_freq = 3;</p>
  3564. <p>The flange effect can also produce a chorus-like effect if a longer
  3565. delay line is used with a slower modulation rate, for example try:<br>
  3566. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  3567. and<br>
  3568. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  3569. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  3570. double s_freq = .0625;</p>
  3571. </script>
  3572. <script type="text/x-red" data-template-name="AudioEffectFlange">
  3573. <div class="form-row">
  3574. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3575. <input type="text" id="node-input-name" placeholder="Name">
  3576. </div>
  3577. </script>
  3578. <script type="text/x-red" data-help-name="AudioEffectReverb">
  3579. <h3>Summary</h3>
  3580. <div class=tooltipinfo>
  3581. <p>Reverb with adjustable reverberation time. Contributed by Joao Rossi FIlho.
  3582. </p>
  3583. </div>
  3584. <h3>Audio Connections</h3>
  3585. <table class=doc align=center cellpadding=3>
  3586. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  3587. <tr class="odd"><td align="center">In 0</td><td>Input</td></tr>
  3588. <tr class="odd"><td align="center">Out 0</td><td>Output</td></tr>
  3589. </table>
  3590. <h3>Functions</h3>
  3591. <p class=func><span class=keyword>reverbTime</span>(seconds);</p>
  3592. <p class=desc>Sets the amount of reverberation time.
  3593. </p>
  3594. <h3>Examples</h3>
  3595. <p><a href="https://twitter.com/joaorossifilho/status/779737126841753601">Video Demo</a>
  3596. </p>
  3597. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  3598. </p>-->
  3599. <h3>Notes</h3>
  3600. <p>This effect may have distortion problems with the input signal is more than 0.5.</p>
  3601. </script>
  3602. <script type="text/x-red" data-template-name="AudioEffectReverb">
  3603. <div class="form-row">
  3604. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3605. <input type="text" id="node-input-name" placeholder="Name">
  3606. </div>
  3607. </script>
  3608. <script type="text/x-red" data-help-name="AudioEffectFreeverb">
  3609. <h3>Summary</h3>
  3610. <div class=tooltipinfo>
  3611. <p>High quality Reverb effect, based on Freeverb by Jezar at Dreampoint.
  3612. </p>
  3613. </div>
  3614. <h3>Audio Connections</h3>
  3615. <table class=doc align=center cellpadding=3>
  3616. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  3617. <tr class="odd"><td align="center">In 0</td><td>Input</td></tr>
  3618. <tr class="odd"><td align="center">Out 0</td><td>Output</td></tr>
  3619. </table>
  3620. <h3>Functions</h3>
  3621. <p class=func><span class=keyword>roomsize</span>(amount);</p>
  3622. <p class=desc>Sets the amount of reverberant echo or apparent room
  3623. size, from 0 (smallest) to 1.0 (largest);
  3624. </p>
  3625. <p class=func><span class=keyword>damping</span>(amount);</p>
  3626. <p class=desc>Sets the damping factor, from 0 to 1.0. More damping
  3627. causes higher frequency echo to decay, creating a softer sound,
  3628. similar to a large room filled with people or materials which
  3629. absorb some sound as it travels between reflecting surfaces.
  3630. Lower damping simulates a harsher reverberant field.
  3631. </p>
  3632. <h3>Examples</h3>
  3633. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Freeverb
  3634. </p>
  3635. <h3>Notes</h3>
  3636. <p>Freeverb mono consumes about 21% of the CPU time on Teensy 3.2 and
  3637. requires about 22K of RAM.</p>
  3638. </script>
  3639. <script type="text/x-red" data-template-name="AudioEffectFreeverb">
  3640. <div class="form-row">
  3641. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3642. <input type="text" id="node-input-name" placeholder="Name">
  3643. </div>
  3644. </script>
  3645. <script type="text/x-red" data-help-name="AudioEffectFreeverbStereo">
  3646. <h3>Summary</h3>
  3647. <div class=tooltipinfo>
  3648. <p>High quality stereo Reverb effect, based on Freeverb by Jezar at Dreampoint.
  3649. </p>
  3650. <p>Teensy 3.5 or 3.6 required to run stereo version.</p>
  3651. </div>
  3652. <h3>Audio Connections</h3>
  3653. <table class=doc align=center cellpadding=3>
  3654. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  3655. <tr class="odd"><td align="center">In 0</td><td>Input</td></tr>
  3656. <tr class="odd"><td align="center">Out 0</td><td>Left Output</td></tr>
  3657. <tr class="odd"><td align="center">Out 1</td><td>Right Output</td></tr>
  3658. </table>
  3659. <h3>Functions</h3>
  3660. <p class=func><span class=keyword>roomsize</span>(amount);</p>
  3661. <p class=desc>Sets the amount of reverberant echo or apparent room
  3662. size, from 0 (smallest) to 1.0 (largest);
  3663. </p>
  3664. <p class=func><span class=keyword>damping</span>(amount);</p>
  3665. <p class=desc>Sets the damping factor, from 0 to 1.0. More damping
  3666. causes higher frequency echo to decay, creating a softer sound,
  3667. similar to a large room filled with people or materials which
  3668. absorb some sound as it travels between reflecting surfaces.
  3669. Lower damping simulates a harsher reverberant field.
  3670. </p>
  3671. <h3>Examples</h3>
  3672. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Freeverb_Stereo
  3673. </p>
  3674. <h3>Notes</h3>
  3675. <p>Freeverb mono consumes about 18% of the CPU time on Teensy 3.6 and
  3676. requires about 45K of RAM.</p>
  3677. <p>Teensy 3.2 does not have enough RAM to
  3678. run this effect while playing WAV file and implementing USB Serial.</p>
  3679. </script>
  3680. <script type="text/x-red" data-template-name="AudioEffectFreeverbStereo">
  3681. <div class="form-row">
  3682. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3683. <input type="text" id="node-input-name" placeholder="Name">
  3684. </div>
  3685. </script>
  3686. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  3687. <h3>Summary</h3>
  3688. <div class=tooltipinfo>
  3689. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  3690. Release) envelope.
  3691. </p>
  3692. <p align=center><img src="img/dahdsr.png"></p>
  3693. </div>
  3694. <h3>Audio Connections</h3>
  3695. <table class=doc align=center cellpadding=3>
  3696. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3697. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3698. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  3699. </table>
  3700. <h3>Functions</h3>
  3701. <p class=func><span class=keyword>noteOn</span>();</p>
  3702. <p class=desc>Begin the delay to attack, or the attack phase is
  3703. delay is zero.
  3704. </p>
  3705. <p class=func><span class=keyword>noteOff</span>();</p>
  3706. <p class=desc>Begin the release phase.
  3707. </p>
  3708. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  3709. <p class=desc>Set the delay from noteOn to the attach phase. The
  3710. default is zero, for no delay.
  3711. </p>
  3712. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  3713. <p class=desc>Set the attack time. The default is 10.5 milliseconds.
  3714. The maximum is 11880 milliseconds.
  3715. </p>
  3716. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  3717. <p class=desc>Set the hold time. The default is 2.5 milliseconds.
  3718. The maximum is 11880 milliseconds.
  3719. </p>
  3720. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  3721. <p class=desc>Set the decay time. The default is 35 milliseconds.
  3722. The maximum is 11880 milliseconds.
  3723. </p>
  3724. <p class=func><span class=keyword>sustain</span>(level);</p>
  3725. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  3726. gain will be maintained at this level after the decay phase,
  3727. until noteOff() is called. The sustain phase may last any
  3728. length of time, controlled by when release() is called.
  3729. </p>
  3730. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  3731. <p class=desc>Set the release time. The default is 300 millisecond.
  3732. The maximum is 11880 milliseconds.
  3733. </p>
  3734. <p class=func><span class=keyword>releaseNoteOn</span>(milliseconds);</p>
  3735. <p class=desc>Set a quick release time to be used when a new note is
  3736. started while the envelop is in any state passing the signal.
  3737. This will add latency before your new attack phase begins, so
  3738. short times are recommended. Zero may be used to completely
  3739. disable this feature (never extra latency). Longer times help
  3740. reduce clicks or pops. The default is 5 millisecond.
  3741. </p>
  3742. <p class=func><span class=keyword>isActive</span>();</p>
  3743. <p class=desc>Returns true when the envelope is currently in any of
  3744. its 6 phases.
  3745. </p>
  3746. <p class=func><span class=keyword>isSustain</span>();</p>
  3747. <p class=desc>Returns true when the envelope is currently in the
  3748. sustain phase.
  3749. </p>
  3750. <h3>Examples</h3>
  3751. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  3752. </p>
  3753. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  3754. </p>
  3755. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  3756. </p>
  3757. <h3>Notes</h3>
  3758. <p>To achieve the more common ADSR shape, simply
  3759. set delay and hold to zero.</p>
  3760. </script>
  3761. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  3762. <div class="form-row">
  3763. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3764. <input type="text" id="node-input-name" placeholder="Name">
  3765. </div>
  3766. </script>
  3767. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  3768. <h3>Summary</h3>
  3769. <div class=tooltipinfo>
  3770. <p>Multiply two signals together, useful for amplitude modulation
  3771. or "voltage controlled amplification".
  3772. </p>
  3773. <p align=center><img src="img/multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  3774. </div>
  3775. <h3>Audio Connections</h3>
  3776. <table class=doc align=center cellpadding=3>
  3777. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3778. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3779. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  3780. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  3781. </table>
  3782. <h3>Functions</h3>
  3783. <p>There are no functions to call from the Arduino sketch.
  3784. This object simply multiplies the 2 signals to create
  3785. a continuous output
  3786. </p>
  3787. <!--
  3788. <h3>Examples</h3>
  3789. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3790. </p>
  3791. -->
  3792. <h3>Notes</h3>
  3793. <p>
  3794. </p>
  3795. </script>
  3796. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  3797. <div class="form-row">
  3798. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3799. <input type="text" id="node-input-name" placeholder="Name">
  3800. </div>
  3801. </script>
  3802. <script type="text/x-red" data-help-name="AudioEffectRectifier">
  3803. <h3>Summary</h3>
  3804. <div class=tooltipinfo>
  3805. <p>Invert the negative portion of a signal, similar to a full wave rectifier circuit.
  3806. </p>
  3807. </div>
  3808. <h3>Audio Connections</h3>
  3809. <table class=doc align=center cellpadding=3>
  3810. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3811. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3812. <tr class=odd><td align=center>Out 0</td><td>Rectifed (positive only) Signal</td></tr>
  3813. </table>
  3814. <h3>Functions</h3>
  3815. <p>There are no functions to call from the Arduino sketch.
  3816. This object simply passes the positive portion of the
  3817. signal and inverts the signal when the input is negative.
  3818. </p>
  3819. <h3>Examples</h3>
  3820. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Vocoder19Band
  3821. </p>
  3822. <h3>Notes</h3>
  3823. <p>To create a half wave rectifier effect, use the waveshape effect. See
  3824. <a href="https://forum.pjrc.com/threads/62091?p=255367&viewfull=1#post255367">this forum message</a> for a half-wave rectifier example.
  3825. </p>
  3826. </p>
  3827. </script>
  3828. <script type="text/x-red" data-template-name="AudioEffectRectifier">
  3829. <div class="form-row">
  3830. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3831. <input type="text" id="node-input-name" placeholder="Name">
  3832. </div>
  3833. </script>
  3834. <script type="text/x-red" data-help-name="AudioEffectDelay">
  3835. <h3>Summary</h3>
  3836. <div class=tooltipinfo>
  3837. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  3838. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  3839. </div>
  3840. <h3>Audio Connections</h3>
  3841. <table class=doc align=center cellpadding=3>
  3842. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3843. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3844. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  3845. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  3846. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  3847. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  3848. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  3849. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  3850. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  3851. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  3852. </table>
  3853. <h3>Functions</h3>
  3854. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  3855. <p class=desc>Set output channel (0 to 7) to delay the signals by
  3856. milliseconds. See the table below for the maximum delay. The actual delay
  3857. is rounded to the nearest sample. Each channel can be configured for
  3858. any delay. There is no requirement to configure the "taps" in increasing
  3859. delay order.
  3860. </p>
  3861. <p class=func><span class=keyword>disable</span>(channel);</p>
  3862. <p class=desc>Disable a channel. The output of this channel becomes
  3863. silent. If this channel is the longest delay, memory usage is
  3864. automatically reduced to accomodate only the remaining channels used.
  3865. </p>
  3866. <h3>Examples</h3>
  3867. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  3868. </p>
  3869. <h3>Notes</h3>
  3870. <p>Memory for the delayed signal is take from the memory pool allocated by
  3871. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  3872. Each block allows about 2.9 milliseconds of delay, so AudioMemory
  3873. should be increased to allow for the longest delay tap.
  3874. </p>
  3875. <p>Each board has a maximum possible delay.
  3876. </p>
  3877. <table class=doc align=center cellpadding=3>
  3878. <tr class=top><th>Board</th><th>Maximum</th></tr>
  3879. <tr class=odd><td>Teensy 3.0</td><td align=center>139.26 ms</td></tr>
  3880. <tr class=odd><td>Teensy 3.1</td><td align=center>449.39 ms</td></tr>
  3881. <tr class=odd><td>Teensy 3.2</td><td align=center>449.39 ms</td></tr>
  3882. <tr class=odd><td>Teensy 3.5</td><td align=center>1671.19 ms</td></tr>
  3883. <tr class=odd><td>Teensy 3.6</td><td align=center>2413.94 ms</td></tr>
  3884. </table>
  3885. </script>
  3886. <script type="text/x-red" data-template-name="AudioEffectDelay">
  3887. <div class="form-row">
  3888. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3889. <input type="text" id="node-input-name" placeholder="Name">
  3890. </div>
  3891. </script>
  3892. <script type="text/x-red" data-help-name="AudioEffectDelayExternal">
  3893. <h3>Summary</h3>
  3894. <div class=tooltipinfo>
  3895. <p>Delay a signal, using external memory for longer delay times! Up to 8 separate delay taps can be used.</p>
  3896. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  3897. </div>
  3898. <h3>Audio Connections</h3>
  3899. <table class=doc align=center cellpadding=3>
  3900. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3901. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  3902. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  3903. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  3904. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  3905. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  3906. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  3907. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  3908. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  3909. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  3910. </table>
  3911. <h3>Functions</h3>
  3912. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  3913. <p class=desc>Set output channel (0 to 7) to delay the signals by
  3914. milliseconds. The maximum delay is approx 1.5 seconds for each 23LC1024 chip.
  3915. The actual delay
  3916. is rounded to the nearest sample. Each channel can be configured for
  3917. any delay. There is no requirement to configure the "taps" in increasing
  3918. delay order.
  3919. </p>
  3920. <p class=func><span class=keyword>disable</span>(channel);</p>
  3921. <p class=desc>Disable a channel. The output of this channel becomes
  3922. silent. If this channel is the longest delay, memory usage is
  3923. automatically reduced to accomodate only the remaining channels used.
  3924. </p>
  3925. <h3>Hardware</h3>
  3926. <p>By default, or when <span class=literal>AUDIO_MEMORY_23LC1024</span> is used (see below),
  3927. a single 23LC1024 RAM chip is used, with these pins:
  3928. <table class=doc align=center cellpadding=3>
  3929. <tr class=top><th>Pin</th><th>Signal</th></tr>
  3930. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  3931. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  3932. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  3933. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  3934. </table>
  3935. </p>
  3936. <p>When <span class=literal>AUDIO_MEMORY_CY15B104</span> is used, a single
  3937. CY15B104 FRAM chip is used, with these pins:
  3938. <table class=doc align=center cellpadding=3>
  3939. <tr class=top><th>Pin</th><th>Signal</th></tr>
  3940. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  3941. <tr class=odd><td align=center>7</td><td>SI</td></tr>
  3942. <tr class=odd><td align=center>12</td><td>SO</td></tr>
  3943. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  3944. </table>
  3945. </p>
  3946. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  3947. 23LC1024 chips are used.
  3948. </p>
  3949. <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>
  3950. <p>
  3951. <table class=doc align=center cellpadding=3>
  3952. <tr class=top><th>Pin</th><th>Signal</th></tr>
  3953. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  3954. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  3955. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  3956. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  3957. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  3958. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  3959. </table>
  3960. </p>
  3961. <p>
  3962. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  3963. must be used. See below for details. Each chip provides 1485 ms of delay
  3964. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  3965. exceed the amount of memory physically present.
  3966. </p>
  3967. <h3>Examples</h3>
  3968. <p>
  3969. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  3970. </p>
  3971. <!--
  3972. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  3973. </p>
  3974. -->
  3975. <p>
  3976. <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)
  3977. </p>
  3978. <h3>Notes</h3>
  3979. <p>External RAM allows for longer delays without consuming
  3980. limited internal RAM. However, SPI communication is required,
  3981. which consumes much more CPU time. The
  3982. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  3983. function may be used to monitor how much CPU time is consumed.
  3984. </p>
  3985. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  3986. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  3987. chips.
  3988. </p>
  3989. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  3990. </p>
  3991. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  3992. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  3993. channels of a stereo signal.
  3994. <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);
  3995. </p>
  3996. <p>When using CY15B104, you
  3997. <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>
  3998. to make the chip work.
  3999. </p>
  4000. </script>
  4001. <script type="text/x-red" data-template-name="AudioEffectDelayExternal">
  4002. <div class="form-row">
  4003. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4004. <input type="text" id="node-input-name" placeholder="Name">
  4005. </div>
  4006. </script>
  4007. <script type="text/x-red" data-help-name="AudioEffectBitcrusher">
  4008. <h3>Summary</h3>
  4009. <div class=tooltipinfo>
  4010. <p>Reduce the samplerate and/or bitdepth of a source signal, resulting in
  4011. a distorted sound.</p>
  4012. </div>
  4013. <h3>Audio Connections</h3>
  4014. <table class=doc align=center cellpadding=3>
  4015. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4016. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  4017. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  4018. </table>
  4019. <h3>Functions</h3>
  4020. <p class=func><span class=keyword>bits</span>(xcrushBits);</p>
  4021. <p class=desc>xcrushBits sets the bitdepth, from 1 to 16. A Value of 16
  4022. does not crush the bitdepth, and is effectively a passthru for this part
  4023. of the function.</p>
  4024. <p class=func><span class=keyword>sampleRate</span>(xsampleRate);</p>
  4025. <p class=desc>xsampleRate sets the frequency, from 1 to 44100Hz, however it
  4026. works in integer steps so you will only really get a handful of results from
  4027. the many samplerates you can pass. 44100 is passthru.</p>
  4028. <p class=desc>set xbitDepth to 16 and xsampleRate to 44100 to pass audio
  4029. through without any Bitcrush effect.</p>
  4030. <h3>Examples</h3>
  4031. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Bitcrusher
  4032. </p>
  4033. <h3>Notes</h3>
  4034. <p>Needs a lot of improvement. Options for anti-aliasing would be nice in
  4035. the future, but for now, it's rough, it's dirty and it sounds a bit like
  4036. Nine Inch Nails.
  4037. </p>
  4038. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  4039. should be used when changing
  4040. settings on multiple objects, so all changes always take effect
  4041. at the same moment.
  4042. </p>
  4043. </script>
  4044. <script type="text/x-red" data-template-name="AudioEffectBitcrusher">
  4045. <div class="form-row">
  4046. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4047. <input type="text" id="node-input-name" placeholder="Name">
  4048. </div>
  4049. </script>
  4050. <script type="text/x-red" data-help-name="AudioEffectMidSide">
  4051. <h3>Summary</h3>
  4052. <div class=tooltipinfo>
  4053. <p>Convert stereo signals to/from Mid-Side format.
  4054. Mid-Side encoding can be used to increase stereo width, make the lower
  4055. frequencies mono (to please your sub), or as the basis of audio compression.</p>
  4056. </div>
  4057. <h3>Audio Connections</h3>
  4058. <table class=doc align=center cellpadding=3>
  4059. <tr class=top><th>Port</th><th>While<br>Encoding</th><th>While<br>Decoding</th></tr>
  4060. <tr class=odd><td align=center>In 0</td><td>Left Input</td><td>Mid Output</td></tr>
  4061. <tr class=odd><td align=center>In 1</td><td>Right Input</td><td>Side Output</td></tr>
  4062. <tr class=odd><td align=center>Out 0</td><td>Mid Input</td><td>Left Output</td></tr>
  4063. <tr class=odd><td align=center>Out 1</td><td>Side Input</td><td>Right Output</td></tr>
  4064. </table>
  4065. <h3>Functions</h3>
  4066. <p class=func><span class=keyword>encode</span>();</p>
  4067. <p class=desc>Configure this object to encode from stereo to Mid-Side format.</p>
  4068. <p class=func><span class=keyword>decode</span>();</p>
  4069. <p class=desc>Configure this object to decode from Mid-Side format back to stereo signals.</p>
  4070. <h3>Examples</h3>
  4071. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>
  4072. <h3>Notes</h3>
  4073. <p>Many interesting stereo effects can be achieved by manipulating Mid-Side signals.</p>
  4074. <p>Normally a pair of these objects are used, one to encode, then additional
  4075. gain/attenuation or effects applied to the Mid-Side signals, and finally
  4076. decoding back to stereo signals</p>
  4077. <p>To prevent saturation, halving is done in the encoding, that is:</p>
  4078. <p>Mid = (left+right)/2</p>
  4079. <p>Side = (left-right)/2</p>
  4080. <p>And to decode:</p>
  4081. <p>Left = Mid+Side</p>
  4082. <p>Right = Mid-Side</p>
  4083. </script>
  4084. <script type="text/x-red" data-template-name="AudioEffectMidSide">
  4085. <div class="form-row">
  4086. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4087. <input type="text" id="node-input-name" placeholder="Name">
  4088. </div>
  4089. </script>
  4090. <script type="text/x-red" data-help-name="AudioEffectWaveshaper">
  4091. <h3>Summary</h3>
  4092. <div class=tooltipinfo>
  4093. <p>Modify the waveform shape of a signal.</p>
  4094. <p align=center><img src="img/waveshaper.png"></p>
  4095. <p>Useful for overdrive, distortion, fuzz,
  4096. clipping, expo converters, phase inversion, waveform modification &amp; adjustments.
  4097. </p>
  4098. </div>
  4099. <h3>Audio Connections</h3>
  4100. <table class=doc align=center cellpadding=3>
  4101. <tr class=top><th>Port</th><th>Signal</th></tr>
  4102. <tr class=odd><td align=center>In 0</td><td>Original Input Signal</td></tr>
  4103. <tr class=odd><td align=center>Out 0</td><td>Shaped Output</td></tr>
  4104. </table>
  4105. <h3>Functions</h3>
  4106. <p class=func><span class=keyword>shape</span>(array, length);</p>
  4107. <p class=desc>Configure the waveform shape. Array is a list of float
  4108. numbers, given in order. The first number maps to input -1.0. The
  4109. last maps to input +1.0. The numbers represent the desired output
  4110. level at each of these input levels. Length must be 2, 3, 5, 9, 17,
  4111. 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, or 32769.
  4112. </p>
  4113. <h3>Examples</h3>
  4114. <p class=exam>TODO: example needed</p>
  4115. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>-->
  4116. <h3>Notes</h3>
  4117. <p><a href="https://github.com/dxinteractive/TeensyAudioWaveshaper">More information</a>
  4118. </p>
  4119. </script>
  4120. <script type="text/x-red" data-template-name="AudioEffectWaveshaper">
  4121. <div class="form-row">
  4122. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4123. <input type="text" id="node-input-name" placeholder="Name">
  4124. </div>
  4125. </script>
  4126. <script type="text/x-red" data-help-name="AudioEffectGranular">
  4127. <h3>Summary</h3>
  4128. <div class=tooltipinfo>
  4129. <p>Classic granular effect that uses a variable speed buffer to shift the pitch
  4130. and freeze incoming audio.
  4131. Contributed by Bleep Labs.
  4132. </p>
  4133. </div>
  4134. <h3>Audio Connections</h3>
  4135. <table class=doc align=center cellpadding=3>
  4136. <tr class=top><th>Port</th><th>Signal</th></tr>
  4137. <tr class=odd><td align=center>In 0</td><td>Input Signal</td></tr>
  4138. <tr class=odd><td align=center>Out 0</td><td>Granular Output</td></tr>
  4139. </table>
  4140. <h3>Functions</h3>
  4141. <p class=func><span class=keyword>begin</span>(array, length);</p>
  4142. <p class=desc>Initialize the granular processing with an array of 16 bit
  4143. integers used to store the sound grains. Until memory is allocated
  4144. with this function, no audio appears at the output.
  4145. </p>
  4146. <p class=func><span class=keyword>setSpeed</span>(ratio);</p>
  4147. <p class=desc>Configure the relative speed grains will be played. 1.0
  4148. plays the grains without any change. Less than 1.0 slows the sound,
  4149. and greater than 1.0 speeds up. The allowed range is 0.125 to 8.0,
  4150. for &plusmn;3 octaves shift.
  4151. </p>
  4152. <p class=func><span class=keyword>beginFreeze</span>(grainLength);</p>
  4153. <p class=desc>Freeze the sound by sampling one grain, then repeated playing
  4154. it. The grainLength is specified in milliseconds, up to the size allowed
  4155. by the array from begin().
  4156. </p>
  4157. <p class=func><span class=keyword>beginPitchShift</span>(grainLength);</p>
  4158. <p class=desc>Pitch shift by continuously sampling grains and playing them
  4159. at altered speed. The grainLength is specified in milliseconds, up to
  4160. one third of the memory from begin();
  4161. </p>
  4162. <p class=func><span class=keyword>stop</span>();</p>
  4163. <p class=desc>Stop granual processing. The input signal is passed to the
  4164. output without any changes.
  4165. </p>
  4166. <h3>Examples</h3>
  4167. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Granular</p>
  4168. <!--<h3>Notes</h3>
  4169. <p> </p>-->
  4170. </script>
  4171. <script type="text/x-red" data-template-name="AudioEffectGranular">
  4172. <div class="form-row">
  4173. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4174. <input type="text" id="node-input-name" placeholder="Name">
  4175. </div>
  4176. </script>
  4177. <script type="text/x-red" data-help-name="AudioEffectDigitalCombine">
  4178. <h3>Summary</h3>
  4179. <div class=tooltipinfo>
  4180. <p>Combine signals with digital logic functions, with results from
  4181. interesting new waveforms to aggressive digital distortion.
  4182. Contributed by Bleep Labs.
  4183. </p>
  4184. </div>
  4185. <h3>Audio Connections</h3>
  4186. <table class=doc align=center cellpadding=3>
  4187. <tr class=top><th>Port</th><th>Signal</th></tr>
  4188. <tr class=odd><td align=center>In 0</td><td>Input Signal #1</td></tr>
  4189. <tr class=odd><td align=center>In 1</td><td>Input Signal #2</td></tr>
  4190. <tr class=odd><td align=center>Out 0</td><td>Combined Output</td></tr>
  4191. </table>
  4192. <h3>Functions</h3>
  4193. <p class=func><span class=keyword>setCombineMode</span>(mode);</p>
  4194. <p class=desc>Configure which digital combine operation is performed.
  4195. </p>
  4196. <p class=desc>Supported modes:<br>
  4197. <span class=keyword>AudioEffectDigitalCombine</span><b>::OR</b><br>
  4198. <span class=keyword>AudioEffectDigitalCombine</span><b>::XOR</b><br>
  4199. <span class=keyword>AudioEffectDigitalCombine</span><b>::AND</b><br>
  4200. <span class=keyword>AudioEffectDigitalCombine</span><b>::MODULO</b><br>
  4201. </p>
  4202. <h3>Examples</h3>
  4203. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Combine</p>-->
  4204. <!--<h3>Notes</h3>
  4205. <p> </p>-->
  4206. </script>
  4207. <script type="text/x-red" data-template-name="AudioEffectDigitalCombine">
  4208. <div class="form-row">
  4209. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4210. <input type="text" id="node-input-name" placeholder="Name">
  4211. </div>
  4212. </script>
  4213. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  4214. <h3>Summary</h3>
  4215. <div class=tooltipinfo>
  4216. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  4217. Up to 4 stages may be cascaded.
  4218. </p>
  4219. <p align=center><img src="img/biquad.png"></p>
  4220. </div>
  4221. <h3>Audio Connections</h3>
  4222. <table class=doc align=center cellpadding=3>
  4223. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4224. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  4225. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  4226. </table>
  4227. <h3>Functions</h3>
  4228. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  4229. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  4230. response, with the specified corner frequency and Q shape. If Q is
  4231. higher that 0.7071, be careful of filter gain (see below).
  4232. </p>
  4233. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  4234. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  4235. response, with the specified corner frequency and Q shape. If Q is
  4236. higher that 0.7071, be careful of filter gain (see below).
  4237. </p>
  4238. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  4239. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  4240. response. The filter has unity gain at the specified frequency. Q
  4241. controls the width of frequencies allowed to pass.
  4242. </p>
  4243. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  4244. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  4245. response. Q controls the width of rejected frequencies.
  4246. </p>
  4247. <p class=func><span class=keyword>setLowShelf</span>(stage, frequency, gain, slope);</p>
  4248. <p class=desc>Configure one stage of the filter (0 to 3) with low shelf response.
  4249. A low shelf filter attenuates or amplifies signals below the specified frequency.
  4250. Frequency controls the slope midpoint, gain is in dB and can be both
  4251. positive or negative. The slope parameter controls steepness of gain transition.
  4252. A slope of 1 yields maximum steepness without overshoot,
  4253. lower values yield a less steep slope. See the picture below for a visualization
  4254. of the slope parameter's effect.
  4255. Be careful with positive gains and slopes higher than 1 as they introduce gain
  4256. (see warning below).
  4257. </p>
  4258. </p>
  4259. <p class=func><span class=keyword>setHighShelf</span>(stage, frequency, gain, slope);</p>
  4260. <p class=desc>Configure one stage of the filter (0 to 3) with high shelf response.
  4261. A high shelf filter attenuates or amplifies signals above the specified frequency.
  4262. Frequency controls the slope midpoint, gain is in dB and can be both
  4263. positive or negative. The slope parameter controls steepness of gain transition.
  4264. A slope of 1 yields maximum steepness without overshoot,
  4265. lower values yield a less steep slope. See the picture below for a visualization
  4266. of the slope parameter's effect.
  4267. Be careful with positive gains and slopes higher than 1 as they introduce gain
  4268. (see warning below).
  4269. </p>
  4270. <p align=center><img src="img/shelf_filter.png"></p>
  4271. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  4272. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  4273. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  4274. Each coefficient must be less than 2.0 and greater than -2.0. The array
  4275. should be type double. Alternately, it may be type int, where 1.0 is
  4276. represented with 1073741824 (2<sup>30</sup>).
  4277. </p>
  4278. <h3>Examples</h3>
  4279. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  4280. </p>
  4281. <h3>Notes</h3>
  4282. <p>Filters can with gain must have their input signals attenuated, so the
  4283. signal does not exceed 1.0.
  4284. </p>
  4285. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  4286. not pass any signal.
  4287. </p>
  4288. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  4289. trouble with limited numerical precision, causing the filter to perform
  4290. poorly. For very low corner frequency, the State Variable (Chamberlin)
  4291. filter should be used.
  4292. </p>
  4293. </script>
  4294. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  4295. <div class="form-row">
  4296. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4297. <input type="text" id="node-input-name" placeholder="Name">
  4298. </div>
  4299. </script>
  4300. <script type="text/x-red" data-help-name="AudioFilterFIR">
  4301. <h3>Summary</h3>
  4302. <div class=tooltipinfo>
  4303. <p>Finite impulse response filter, useful for all sorts of filtering.
  4304. </p>
  4305. <p align=center><img src="img/fir_filter.png"></p>
  4306. </div>
  4307. <h3>Audio Connections</h3>
  4308. <table class=doc align=center cellpadding=3>
  4309. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4310. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  4311. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  4312. </table>
  4313. <h3>Functions</h3>
  4314. <p class=func><span class=keyword>begin</span>(array, length);</p>
  4315. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  4316. filter's impulse response), and
  4317. length indicates the number of points in the array. Array may also be
  4318. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  4319. filtering.
  4320. </p>
  4321. <p class=func><span class=keyword>end</span>();</p>
  4322. <p class=desc>Turn the filter off.
  4323. </p>
  4324. <h3>Examples</h3>
  4325. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  4326. </p>
  4327. <h3>Known Issues</h3>
  4328. <p>Your filter's impulse response array must have an even length. If you have
  4329. add odd number of taps, you must add an extra zero to increase the length
  4330. to an even number.
  4331. </p>
  4332. <p>The minimum number of taps is 4. If you use less, add extra zeros to increase
  4333. the length to 4.
  4334. </p>
  4335. <p>The impulse response must be given in reverse order. Many filters have
  4336. symetrical impluse response, making this a non-issue. If your filter has
  4337. a non-symetrical response, make sure the data is in reverse time order.
  4338. </p>
  4339. <h3>Notes</h3>
  4340. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  4341. implement filters with better phase response.
  4342. </p>
  4343. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  4344. supported filter length is 200 points.
  4345. </p>
  4346. <p>The free
  4347. <a href="http://t-filter.engineerjs.com/" target="_blank"> TFilter Design Tool</a>
  4348. can be used to create the impulse response array. Be sure to set the sampling
  4349. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  4350. </p>
  4351. <p>
  4352. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  4353. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  4354. and add "const" to avoid consuming extra RAM.
  4355. </p>
  4356. </script>
  4357. <script type="text/x-red" data-template-name="AudioFilterFIR">
  4358. <div class="form-row">
  4359. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4360. <input type="text" id="node-input-name" placeholder="Name">
  4361. </div>
  4362. </script>
  4363. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  4364. <h3>Summary</h3>
  4365. <div class=tooltipinfo>
  4366. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  4367. adjustable resonance, and optional signal control of corner
  4368. frequency.</p>
  4369. </div>
  4370. <h3>Audio Connections</h3>
  4371. <table class=doc align=center cellpadding=3>
  4372. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4373. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  4374. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  4375. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  4376. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  4377. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  4378. </table>
  4379. <h3>Functions</h3>
  4380. <p class=func><span class=keyword>frequency</span>(freq);</p>
  4381. <p class=desc>Set the filter's corner frequency. When a signal is
  4382. connected to the control input, the filter will implement this
  4383. frequency when the signal is zero.
  4384. </p>
  4385. <p class=func><span class=keyword>resonance</span>(Q);</p>
  4386. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  4387. Resonance greater than 0.707 will amplify the signal near the
  4388. corner frequency. You must attenuate the signal before input
  4389. to this filter, to prevent clipping.
  4390. </p>
  4391. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  4392. <p class=desc>Set how much (in octaves) the control signal can alter
  4393. the filter's corner frequency. Range is 0 to 7 octaves. For
  4394. example, when set to 2.5, a full scale positive signal (1.0) will
  4395. shift the filter frequency up 2.5 octaves, and a full scale negative
  4396. signal will shift it down 2.5 octaves.
  4397. </p>
  4398. <!--
  4399. <h3>Examples</h3>
  4400. <p class=exam>File &gt; Examples &gt; Audio &gt;
  4401. </p>
  4402. -->
  4403. <h3>Notes</h3>
  4404. <p>
  4405. When controlled by a signal, the equation for the filter
  4406. frequency is:
  4407. </p>
  4408. <p>
  4409. <img src="img/filter_formula.png">
  4410. </p>
  4411. <p>When operating with signal control of corner frequency, this
  4412. object uses approximately 4% of the CPU time on Teensy 3.1.
  4413. </p>
  4414. </script>
  4415. <script type="text/x-red" data-template-name="AudioFilterStateVariable">
  4416. <div class="form-row">
  4417. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4418. <input type="text" id="node-input-name" placeholder="Name">
  4419. </div>
  4420. </script>
  4421. <script type="text/x-red" data-help-name="AudioFilterLadder">
  4422. <h3>Summary</h3>
  4423. <div class=tooltipinfo>
  4424. <p>A low pass filter with resonant feedback, meant to approximate the
  4425. classic "Moog sound". Both cut-off frequency and resonance level
  4426. can optionally be controlled by input audio signals.
  4427. </p>
  4428. <p align=center><img src="img/ladder.png"></p>
  4429. </div>
  4430. <h3>Audio Connections</h3>
  4431. <table class=doc align=center cellpadding=3>
  4432. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4433. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  4434. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  4435. <tr class=odd><td align=center>In 2</td><td>Resonance Control</td></tr>
  4436. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  4437. </table>
  4438. <h3>Functions</h3>
  4439. <p class=func><span class=keyword>frequency</span>(freq);</p>
  4440. <p class=desc>Set the filter's corner frequency. When a signal is
  4441. connected to the frequency control input, this setting is
  4442. the corner frequency the filter will implement
  4443. when the signal is zero.
  4444. </p>
  4445. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  4446. <p class=desc>Set how much (in octaves) the control signal can alter
  4447. the filter's corner frequency. Range is 0 to 7 octaves. For
  4448. example, when set to 2.5, a full scale positive signal (1.0) will
  4449. shift the filter frequency up 2.5 octaves, and a full scale negative
  4450. signal will shift it down 2.5 octaves.
  4451. </p>
  4452. <p class=func><span class=keyword>resonance</span>(level);</p>
  4453. <p class=desc>Set the filter's feedback level for resonance. The
  4454. usable range is 0 to 1.07, where values over 1.0 can cause
  4455. the filter to self oscillate. When an audio signal is present
  4456. at the resonance control input, it overrides this setting.
  4457. Only positive signal values are used. A full scale 1.0 signal
  4458. creates resonance setting 1.07 (self oscillation).
  4459. Any negative signal input is treated as zero.
  4460. </p>
  4461. <h3>Examples</h3>
  4462. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; LadderFilter
  4463. </p>
  4464. <h3>Notes</h3>
  4465. <p>
  4466. When controlled by a signal, the equation for the filter
  4467. frequency is:
  4468. </p>
  4469. <p>
  4470. <img src="img/filter_formula.png">
  4471. </p>
  4472. <p>This filter uses floating point math. It is recommended for use
  4473. on Teensy 4.0 or higher.
  4474. </p>
  4475. </script>
  4476. <script type="text/x-red" data-template-name="AudioFilterLadder">
  4477. <div class="form-row">
  4478. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4479. <input type="text" id="node-input-name" placeholder="Name">
  4480. </div>
  4481. </script>
  4482. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  4483. <h3>Summary</h3>
  4484. <div class=tooltipinfo>
  4485. <p>Track the signal peak amplitude. Very useful for simple
  4486. audio level response projects, and general troubleshooting.</p>
  4487. </div>
  4488. <h3>Audio Connections</h3>
  4489. <table class=doc align=center cellpadding=3>
  4490. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4491. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  4492. </table>
  4493. <h3>Functions</h3>
  4494. <p class=func><span class=keyword>available</span>();</p>
  4495. <p class=desc>Returns true each time new peak data is available.
  4496. </p>
  4497. <p class=func><span class=keyword>read</span>();</p>
  4498. <p class=desc>Read the highest peak amplitude value since the last read.
  4499. Return is from 0.0 to 1.0.
  4500. </p>
  4501. <p class=func><span class=keyword>readPeakToPeak</span>();</p>
  4502. <p class=desc>Read the highest peak-to-peak amplitude since the last read.
  4503. Return is from 0.0 to 2.0.
  4504. </p>
  4505. <h3>Examples</h3>
  4506. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  4507. </p>
  4508. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  4509. </p>
  4510. <h3>Notes</h3>
  4511. <p></p>
  4512. </script>
  4513. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  4514. <div class="form-row">
  4515. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4516. <input type="text" id="node-input-name" placeholder="Name">
  4517. </div>
  4518. </script>
  4519. <script type="text/x-red" data-help-name="AudioAnalyzeRMS">
  4520. <h3>Summary</h3>
  4521. <div class=tooltipinfo>
  4522. <p>Track the signal RMS amplitude. Useful for
  4523. audio level response projects, and general troubleshooting.</p>
  4524. </div>
  4525. <h3>Audio Connections</h3>
  4526. <table class=doc align=center cellpadding=3>
  4527. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4528. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  4529. </table>
  4530. <h3>Functions</h3>
  4531. <p class=func><span class=keyword>available</span>();</p>
  4532. <p class=desc>Returns true if new RMS data is available.
  4533. </p>
  4534. <p class=func><span class=keyword>read</span>();</p>
  4535. <p class=desc>Read the new RMS value.
  4536. Return is from 0.0 to 1.0.
  4537. </p>
  4538. <h3>Examples</h3>
  4539. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakAndRMSMeterStereo</p>
  4540. </p>
  4541. <h3>Notes</h3>
  4542. <p></p>
  4543. </script>
  4544. <script type="text/x-red" data-template-name="AudioAnalyzeRMS">
  4545. <div class="form-row">
  4546. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4547. <input type="text" id="node-input-name" placeholder="Name">
  4548. </div>
  4549. </script>
  4550. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  4551. <h3>Summary</h3>
  4552. <div class=tooltipinfo>
  4553. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  4554. with real value (magnitude) output. The frequency resolution is
  4555. 172 Hz, useful for simple audio visualization.</p>
  4556. </div>
  4557. <h3>Audio Connections</h3>
  4558. <table class=doc align=center cellpadding=3>
  4559. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4560. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  4561. </table>
  4562. <h3>Functions</h3>
  4563. <p class=func><span class=keyword>available</span>();</p>
  4564. <p class=desc>Returns true each time the FFT analysis produces new output data.
  4565. </p>
  4566. <p class=func><span class=keyword>read</span>(binNumber);</p>
  4567. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  4568. so 1.0 represents a full scale sine wave.
  4569. </p>
  4570. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  4571. <p class=desc>Read several frequency bins, returning their sum. The higher
  4572. audio octaves are represented by many bins, which are typically read
  4573. as a group for audio visualization.
  4574. </p>
  4575. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  4576. <p class=desc>New data is produced very radidly, approximately 344 times
  4577. per second. Multiple outputs can be averaged together, so available()
  4578. returns true at a slower rate.
  4579. </p>
  4580. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  4581. <p class=desc>Set the window function to be used. AudioWindowHanning256
  4582. is the default. Windowing may be disabled by NULL, but windowing
  4583. should be used for all non-periodic (music) signals, and all periodic
  4584. signals that are not exact integer division of the sample rate.
  4585. </p>
  4586. <h3>Examples</h3>
  4587. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  4588. </p>
  4589. <h3>Notes</h3>
  4590. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  4591. num is 0 to 127.</p>
  4592. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  4593. <p>Window Types:
  4594. <ul>
  4595. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  4596. <li><span class=literal>AudioWindowBartlett256</span></li>
  4597. <li><span class=literal>AudioWindowBlackman256</span></li>
  4598. <li><span class=literal>AudioWindowFlattop256</span></li>
  4599. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  4600. <li><span class=literal>AudioWindowNuttall256</span></li>
  4601. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  4602. <li><span class=literal>AudioWindowWelch256</span></li>
  4603. <li><span class=literal>AudioWindowHamming256</span></li>
  4604. <li><span class=literal>AudioWindowCosine256</span></li>
  4605. <li><span class=literal>AudioWindowTukey256</span></li>
  4606. </ul>
  4607. </p>
  4608. </script>
  4609. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  4610. <div class="form-row">
  4611. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4612. <input type="text" id="node-input-name" placeholder="Name">
  4613. </div>
  4614. </script>
  4615. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  4616. <h3>Summary</h3>
  4617. <div class=tooltipinfo>
  4618. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  4619. with real value (magnitude) output. The frequency resolution is
  4620. 43 Hz, useful detailed for audio visualization.</p>
  4621. </div>
  4622. <h3>Audio Connections</h3>
  4623. <table class=doc align=center cellpadding=3>
  4624. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4625. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  4626. </table>
  4627. <h3>Functions</h3>
  4628. <p class=func><span class=keyword>available</span>();</p>
  4629. <p class=desc>Returns true each time the FFT analysis produces new output data.
  4630. </p>
  4631. <p class=func><span class=keyword>read</span>(binNumber);</p>
  4632. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  4633. so 1.0 represents a full scale sine wave.
  4634. </p>
  4635. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  4636. <p class=desc>Read several frequency bins, returning their sum. The higher
  4637. audio octaves are represented by many bins, which are typically read
  4638. as a group for audio visualization.
  4639. </p>
  4640. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  4641. <p class=desc>This function does nothing. The 1024 point FFT always
  4642. updates at approximately 86 times per second.
  4643. </p>
  4644. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  4645. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  4646. is the default. Windowing may be disabled by NULL, but windowing
  4647. should be used for all non-periodic (music) signals, and all periodic
  4648. signals that are not exact integer division of the sample rate.
  4649. </p>
  4650. <h3>Examples</h3>
  4651. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  4652. </p>
  4653. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  4654. </p>
  4655. <h3>Notes</h3>
  4656. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  4657. num is 0 to 511.</p>
  4658. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  4659. <p>Window Types:
  4660. <ul>
  4661. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  4662. <li><span class=literal>AudioWindowBartlett1024</span></li>
  4663. <li><span class=literal>AudioWindowBlackman1024</span></li>
  4664. <li><span class=literal>AudioWindowFlattop1024</span></li>
  4665. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  4666. <li><span class=literal>AudioWindowNuttall1024</span></li>
  4667. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  4668. <li><span class=literal>AudioWindowWelch1024</span></li>
  4669. <li><span class=literal>AudioWindowHamming1024</span></li>
  4670. <li><span class=literal>AudioWindowCosine1024</span></li>
  4671. <li><span class=literal>AudioWindowTukey1024</span></li>
  4672. </ul>
  4673. </p>
  4674. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  4675. Average usage is much lower. Future versions might distribute the
  4676. load more evenly over time....
  4677. </p>
  4678. </script>
  4679. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  4680. <div class="form-row">
  4681. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4682. <input type="text" id="node-input-name" placeholder="Name">
  4683. </div>
  4684. </script>
  4685. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  4686. <h3>Summary</h3>
  4687. <div class=tooltipinfo>
  4688. <p>Detect the level of a single tone.</p>
  4689. <p>Uses the
  4690. <a href="https://en.wikipedia.org/wiki/Goertzel_algorithm" target="_blank">Goertzel algorithm</a>
  4691. .</p>
  4692. </div>
  4693. <h3>Audio Connections</h3>
  4694. <table class=doc align=center cellpadding=3>
  4695. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4696. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  4697. </table>
  4698. <h3>Functions</h3>
  4699. <p class=func><span class=keyword>frequency</span>(freq);</p>
  4700. <p class=desc>Set the frequency to detect. The default detection time
  4701. will be 10 cycles of this frequency.
  4702. </p>
  4703. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  4704. <p class=desc>Set the frequency to detect, and the number of cycles.
  4705. Longer detection time (more cycles) will give higher precision,
  4706. but of course slower response.
  4707. </p>
  4708. <p class=func><span class=keyword>available</span>();</p>
  4709. <p class=desc>Returns true (non-zero) each time a detection interval
  4710. (number of cycles) completed and a new level is detected.
  4711. </p>
  4712. <p class=func><span class=keyword>read</span>();</p>
  4713. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  4714. </p>
  4715. <p class=func><span class=keyword>threshold</span>(level);</p>
  4716. <p class=desc>Set a detection threshold, where the bool test operation
  4717. will return true if at or above this level, or false when below.
  4718. </p>
  4719. <p class=func>(bool)</p>
  4720. <p class=desc>By testing the object as a boolean value, you can respond
  4721. to detection of a tone.
  4722. </p>
  4723. <h3>Examples</h3>
  4724. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  4725. </p>
  4726. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  4727. </p>
  4728. <h3>Notes</h3>
  4729. <p>Low frequency detection has trouble with numerical precision.
  4730. Works really well for all 8 DTMF frequencies, but fails for
  4731. detecting "sub audible tones" used in some control applications.</p>
  4732. <p>The (bool) test continues to return true until the next detection
  4733. interval (the configured number of cycles). This behavior may
  4734. change in future versions, for a single true each time the signal
  4735. is detected, and then false for the remainder of that interval.</p>
  4736. </script>
  4737. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  4738. <div class="form-row">
  4739. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4740. <input type="text" id="node-input-name" placeholder="Name">
  4741. </div>
  4742. </script>
  4743. <script type="text/x-red" data-help-name="AudioAnalyzeNoteFrequency">
  4744. <h3>Summary</h3>
  4745. <div class=tooltipinfo>
  4746. <p>Detect with fairly good accuracy the fundamental frequency f<sub>o</sub>
  4747. of musical notes, such as electric guitar and bass.</p>
  4748. </div>
  4749. <p>Written By Collin Duffy</p>
  4750. <h3>Audio Connections</h3>
  4751. <table class=doc align=center cellpadding=3>
  4752. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4753. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  4754. </table>
  4755. <h3>Functions</h3>
  4756. <p class=func><span class=keyword>begin</span>(threshold);</p>
  4757. <p class=desc>Initialize and start detecting frequencies,
  4758. with an initial threshold (the amount of allowed uncertainty).
  4759. </p>
  4760. <p class=func><span class=keyword>available</span>();</p>
  4761. <p class=desc>Returns true (non-zero) when a valid
  4762. frequency is detected.
  4763. </p>
  4764. <p class=func><span class=keyword>read</span>();</p>
  4765. <p class=desc>Read the detected frequency.
  4766. </p>
  4767. <p class=func><span class=keyword>probability</span>();</p>
  4768. <p class=desc>Return the level of certainty, betweeo 0 to 1.0.
  4769. </p>
  4770. <p class=func><span class=keyword>threshold</span>(level);</p>
  4771. <p class=desc>Set the detection threshold, the amount of allowed uncertainty.
  4772. </p>
  4773. <h3>Examples</h3>
  4774. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; NoteFrequency
  4775. </p>
  4776. <h3>Notes</h3>
  4777. <p>The <a href="http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf">YIN algorithm</a> (PDF)
  4778. is used to detect frequencies, with many optimizations for
  4779. frequencies between 29-400Hz. This algorithm can be somewhat
  4780. memory and processor hungry but will allow you to detect with
  4781. fairly good accuracy the fundamental frequencies from
  4782. electric guitars and basses.</p>
  4783. <p>Within the code, AUDIO_GUITARTUNER_BLOCKS
  4784. may be edited to control low frequency range. The default
  4785. (24) allows measurement down to 29.14 Hz, or B(flat)0.</p>
  4786. <p>TODO: The usable upper range of this object is not well known.
  4787. Duff says "it should be good up to 1000Hz", but may have trouble
  4788. 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>
  4789. <p>This object was contributed by Collin Duffy from his
  4790. <a href="https://github.com/duff2013/AudioTuner">AudioTuner project</a>.
  4791. Additional details and documentation may be found there.</p>
  4792. </script>
  4793. <script type="text/x-red" data-template-name="AudioAnalyzeNoteFrequency">
  4794. <div class="form-row">
  4795. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4796. <input type="text" id="node-input-name" placeholder="Name">
  4797. </div>
  4798. </script>
  4799. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  4800. <h3>Summary</h3>
  4801. <div class=tooltipinfo>
  4802. <p>Print raw audio data to the Arduino Serial Monitor. This
  4803. object creates massive output quickly, and should not normally be used.</p>
  4804. </div>
  4805. <h3>Audio Connections</h3>
  4806. <table class=doc align=center cellpadding=3>
  4807. <tr class=top><th>Port</th><th>Purpose</th></tr>
  4808. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  4809. </table>
  4810. <h3>Functions</h3>
  4811. <p class=func><span class=keyword>name</span>(string);</p>
  4812. <p class=desc>blah blah blah blah
  4813. </p>
  4814. <p class=func><span class=keyword>trigger</span>();</p>
  4815. <p class=desc>blah blah blah blah
  4816. </p>
  4817. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  4818. <p class=desc>blah blah blah blah
  4819. </p>
  4820. <p class=func><span class=keyword>delay</span>(samples);</p>
  4821. <p class=desc>blah blah blah blah
  4822. </p>
  4823. <p class=func><span class=keyword>length</span>(samples);</p>
  4824. <p class=desc>blah blah blah blah
  4825. </p>
  4826. <!--
  4827. <h3>Examples</h3>
  4828. <p class=exam>File &gt; Examples &gt; Audio &gt;
  4829. </p>
  4830. -->
  4831. <h3>Notes</h3>
  4832. <p>This object doesn't work very well and probably should not be used.</p>
  4833. </script>
  4834. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  4835. <div class="form-row">
  4836. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  4837. <input type="text" id="node-input-name" placeholder="Name">
  4838. </div>
  4839. </script>
  4840. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  4841. <h3>Summary</h3>
  4842. <div class=tooltipinfo>
  4843. <p>Control the SGTL5000 chip on the
  4844. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  4845. SGTL5000 is always used in slave mode, where Teensy controls
  4846. all I2S timing.
  4847. </p>
  4848. <p align=center><img src="img/sgtl5000closeup.jpg"></p>
  4849. </div>
  4850. <h3>Audio Connections</h3>
  4851. <p>This object has no audio inputs or outputs. Separate i2s objects
  4852. are used to send and receive audio data. I2S master mode objects
  4853. must be used, because this object configures the SGTL5000 in slave
  4854. mode, where it depends on Teensy to provide all I2S clocks.
  4855. This object controls
  4856. how the SGTL5000 will use those I2S audio streams.</p>
  4857. <h3>Functions</h3>
  4858. <p>These are the most commonly used SGTL5000 functions.</p>
  4859. <p class=func><span class=keyword>enable</span>();</p>
  4860. <p class=desc>Start the SGTL5000. This function should be called first.
  4861. </p>
  4862. <p class=func><span class=keyword>volume</span>(level);</p>
  4863. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  4864. 0.8 corresponds to the maximum undistorted output for a full scale
  4865. signal. Usually 0.5 is a comfortable listening level. The line
  4866. level outputs are <em>not</em> changed by this function.
  4867. </p>
  4868. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  4869. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  4870. </p>
  4871. <p class=func><span class=keyword>micGain</span>(dB);</p>
  4872. <p class=desc>When using the microphone input, set the amplifier gain.
  4873. The input number is in decibels, from 0 to 63.
  4874. </p>
  4875. <h3>Signal Levels</h3>
  4876. <p>The default signal levels should be used for most applications,
  4877. but these functions allow you to customize the analog signals.</p>
  4878. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  4879. <p class=desc>Silence the headphone output.
  4880. </p>
  4881. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  4882. <p class=desc>Turn the headphone output on.
  4883. </p>
  4884. <p class=func><span class=keyword>muteLineout</span>();</p>
  4885. <p class=desc>Silence the line level outputs.
  4886. </p>
  4887. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  4888. <p class=desc>Turn the line level outputs on.
  4889. </p>
  4890. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  4891. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  4892. Fifteen settings are possible:
  4893. </p>
  4894. <pre class="desc">
  4895. 0: 3.12 Volts p-p
  4896. 1: 2.63 Volts p-p
  4897. 2: 2.22 Volts p-p
  4898. 3: 1.87 Volts p-p
  4899. 4: 1.58 Volts p-p
  4900. 5: 1.33 Volts p-p (default)
  4901. 6: 1.11 Volts p-p
  4902. 7: 0.94 Volts p-p
  4903. 8: 0.79 Volts p-p
  4904. 9: 0.67 Volts p-p
  4905. 10: 0.56 Volts p-p
  4906. 11: 0.48 Volts p-p
  4907. 12: 0.40 Volts p-p
  4908. 13: 0.34 Volts p-p
  4909. 14: 0.29 Volts p-p
  4910. 15: 0.24 Volts p-p
  4911. </pre>
  4912. <p class=func><span class=keyword>lineInLevel</span>(right, left);</p>
  4913. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  4914. settings for left and right. The same 15 settings are available.
  4915. </p>
  4916. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  4917. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  4918. voltage range. The following settings are possible:
  4919. </p>
  4920. <pre class="desc">
  4921. 13: 3.16 Volts p-p
  4922. 14: 2.98 Volts p-p
  4923. 15: 2.83 Volts p-p
  4924. 16: 2.67 Volts p-p
  4925. 17: 2.53 Volts p-p
  4926. 18: 2.39 Volts p-p
  4927. 19: 2.26 Volts p-p
  4928. 20: 2.14 Volts p-p
  4929. 21: 2.02 Volts p-p
  4930. 22: 1.91 Volts p-p
  4931. 23: 1.80 Volts p-p
  4932. 24: 1.71 Volts p-p
  4933. 25: 1.62 Volts p-p
  4934. 26: 1.53 Volts p-p
  4935. 27: 1.44 Volts p-p
  4936. 28: 1.37 Volts p-p
  4937. 29: 1.29 Volts p-p (default)
  4938. 30: 1.22 Volts p-p
  4939. 31: 1.16 Volts p-p
  4940. </pre>
  4941. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  4942. <p class=desc>Adjust the line level outout voltage range, with separate
  4943. settings for left and right. The same settings (13 to 31) are available.
  4944. </p>
  4945. <h3>Signal Conditioning</h3>
  4946. <p>Usually these digital signal conditioning features should be left at their
  4947. default settings.
  4948. </p>
  4949. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  4950. <p class=desc>By default, the analog input (either line-level inputs or mic)
  4951. is high-pass filtered, to remove any DC component. This function
  4952. freezes the filter, so the current DC component is still substracted, but
  4953. the filter stops tracking any DC or low frequency changes.
  4954. </p>
  4955. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  4956. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  4957. low frequencies are allowed to enter the digital signal. This
  4958. <a href="http://openaudio.blogspot.com/2017/03/teensy-audio-board-self-noise.html">may
  4959. reduce noise</a> in some cases.
  4960. </p>
  4961. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  4962. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  4963. allows it to resume tracking DC and low frequency changes, if
  4964. previously frozen. This is the default setting.
  4965. </p>
  4966. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  4967. <p class=desc>Normally output volume should be used with volume(), which
  4968. changes the analog gain in the headphone amplifier. This function
  4969. on the other hand controls digital attenuation before conversion to analog, which
  4970. reduces resolution, but allows another fine control of output
  4971. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  4972. at 1.0.
  4973. </p>
  4974. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and graceful
  4975. ramping is handled by the chip so that a new volume may be set directly in
  4976. a single call.
  4977. </p>
  4978. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  4979. <p class=desc>Adjust the digital output volume separately on left and
  4980. right channels.
  4981. </p>
  4982. <p class=func><span class=keyword>dacVolumeRamp</span>();</p>
  4983. <p class=desc>Enable graceful volume ramping. The dacVolume adjusts gradually using
  4984. an exponential curve. Pops or loud clicks are avoided when making large
  4985. changes in volume level.
  4986. </p>
  4987. <p class=func><span class=keyword>dacVolumeRampLinear</span>();</p>
  4988. <p class=desc>Enable faster volume ramping. A slight click may be heard during a
  4989. large volume change.
  4990. </p>
  4991. <p class=func><span class=keyword>dacVolumeRampDisable</span>();</p>
  4992. <p class=desc>Do not use any gradual ramping. The zero cross feature still helps
  4993. for small changes, but large volume changes may produce a pop or click.
  4994. </p>
  4995. <h3>Audio Processor</h3>
  4996. <p>The optional digital audio processor is capable of implementing
  4997. one or more of: automatic volume control, surround sound control,
  4998. bass enhancement, and tonal adjustments (either a
  4999. simple tone control, or a parametric equalizer, or a graphic equalizer),
  5000. in that order.
  5001. </p>
  5002. <p>These signal processing features are implemented in the SGTL5000 chip,
  5003. so they do not consume CPU time on Teensy. However, the order of
  5004. these processes is fixed in the hardware.
  5005. </p>
  5006. <p>It is good practice to mute the outputs before enabling or disabling
  5007. the Audio Processor, to avoid clicks or thumps.
  5008. </p>
  5009. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  5010. <p class=desc>Enable the audio processor to pre-process the input
  5011. (from either line-level inputs or microphone) before it's sent
  5012. to Teensy by I2S.
  5013. </p>
  5014. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  5015. <p class=desc>Enable the audio processor to post-process Teensy's
  5016. I2S output before it's turned into analog signals for the
  5017. headphones and/or line level outputs.
  5018. </p>
  5019. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  5020. <p class=desc>Disable the audio processor.
  5021. </p>
  5022. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  5023. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  5024. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  5025. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  5026. as 2. <em>response</em> controls the integration time for the compressor and can take
  5027. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  5028. over a longer time, allowing short-term peaks through.
  5029. </p>
  5030. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  5031. knee' compressor is used to progressively compress louder values which are near to or above the
  5032. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  5033. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  5034. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  5035. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  5036. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  5037. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  5038. </p>
  5039. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  5040. <p class=desc>Enables auto volume control, using the previously specified settings.
  5041. </p>
  5042. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  5043. <p class=desc>Disables auto volume control.
  5044. </p>
  5045. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  5046. <p class=desc>Enable virtual surround processing, to give a broader and
  5047. deeper stereo image (even with mono input).
  5048. </p>
  5049. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  5050. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  5051. the width to maximum to avoid pops.
  5052. </p>
  5053. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  5054. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  5055. </p>
  5056. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  5057. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  5058. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  5059. </p>
  5060. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  5061. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  5062. the original stereo signal has bass levels boosted and is then mixed back into
  5063. the stereo signal, which is then optionally high pass filtered (to remove
  5064. inaudible subsonic frequencies).
  5065. </p>
  5066. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  5067. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  5068. enhancement level to zero.
  5069. </p>
  5070. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  5071. <p class=desc>Configures the bass enhancement by setting the levels of the
  5072. original stereo signal and the bass-enhanced mono level which will be mixed together.
  5073. There is no high-pass filter.
  5074. </p>
  5075. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  5076. steps of 0.5dB, to avoid pops.
  5077. </p>
  5078. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  5079. <p class=desc>Configures the bass enhancement by setting the levels of the
  5080. original stereo signal and the bass-enhanced mono level which will be mixed together.
  5081. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  5082. as follows:
  5083. </p>
  5084. <pre class="desc">
  5085. value frequency
  5086. 0 80Hz
  5087. 1 100Hz
  5088. 2 125Hz
  5089. 3 150Hz
  5090. 4 175Hz
  5091. 5 200Hz
  5092. 6 225Hz
  5093. </pre>
  5094. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  5095. steps of 0.5dB, to avoid pops.
  5096. </p>
  5097. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  5098. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  5099. one of</p>
  5100. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  5101. Equalizers and tone controls disabled, flat frequency response.</p>
  5102. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  5103. Enables the 7-band parametric equalizer, thus disabling the
  5104. tone controls and graphic equalizer.</p>
  5105. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  5106. Enables bass and treble tone controls, disabling the parametric
  5107. equalization and graphic equalizer.</p>
  5108. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  5109. Enables the five-band graphic equalizer, disabling the parametric
  5110. equalization and tone controls.</p>
  5111. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  5112. <p class=desc>Configures bass and treble tone controls, which are
  5113. implemented as one second order low pass filter (bass) in parallel with
  5114. one second order high pass filter (treble).
  5115. </p>
  5116. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  5117. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  5118. </p>
  5119. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  5120. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  5121. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  5122. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  5123. </p>
  5124. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  5125. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  5126. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  5127. </p>
  5128. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  5129. to avoid pops.
  5130. </p>
  5131. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  5132. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  5133. is specified along with a pointer to an array of filter coefficients.
  5134. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  5135. filters whose frequencies, gain, and Q may be freely configured, but each filter
  5136. can only be specified as a set of filter coefficients.
  5137. </p>
  5138. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  5139. <p class=desc>Enables zero or more of the already enabled parametric filters.
  5140. </p>
  5141. <h3>Examples</h3>
  5142. <p>Nearly all of the library's examples use this object. These
  5143. examples demonstrate its special features.
  5144. </p>
  5145. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  5146. </p>
  5147. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  5148. </p>
  5149. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  5150. </p>
  5151. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  5152. </p>
  5153. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  5154. </p>
  5155. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  5156. </p>
  5157. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; VolumeRamp
  5158. </p>
  5159. <h3>Notes</h3>
  5160. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  5161. and surround enhancement while speech uses bandpass filtering and auto volume control
  5162. compression.
  5163. </p>
  5164. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  5165. </p>
  5166. </script>
  5167. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  5168. <div class="form-row">
  5169. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5170. <input type="text" id="node-input-name" placeholder="Name">
  5171. </div>
  5172. </script>
  5173. <script type="text/x-red" data-help-name="AudioControlWM8731">
  5174. <h3>Summary</h3>
  5175. <div class=tooltipinfo>
  5176. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  5177. </div>
  5178. <h3>Audio Connections</h3>
  5179. <p>This object has no audio inputs or outputs. Separate i2s objects
  5180. are used to send and receive audio data. I2S master mode objects
  5181. must be used, since this control object configures the WM8731 into
  5182. slave mode.
  5183. </p>
  5184. <h3>Functions</h3>
  5185. <p class=func><span class=keyword>enable</span>();</p>
  5186. <p class=desc>Turn on the WS8731.
  5187. </p>
  5188. <p class=func><span class=keyword>disable</span>();</p>
  5189. <p class=desc>not implemented
  5190. </p>
  5191. <p class=func><span class=keyword>volume</span>(level);</p>
  5192. <p class=desc>Set the headphone volume level. Range is 0 to 1.0.
  5193. </p>
  5194. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  5195. <p class=desc>Adjust the line level input gain. Range is 0 to 1.0.
  5196. </p>
  5197. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  5198. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  5199. </p>
  5200. <!--
  5201. <h3>Examples</h3>
  5202. <p class=exam>File &gt; Examples &gt; Audio &gt;
  5203. </p>
  5204. -->
  5205. <h3>Notes</h3>
  5206. <p></p>
  5207. </script>
  5208. <script type="text/x-red" data-template-name="AudioControlWM8731">
  5209. <div class="form-row">
  5210. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5211. <input type="text" id="node-input-name" placeholder="Name">
  5212. </div>
  5213. </script>
  5214. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  5215. <h3>Summary</h3>
  5216. <div class=tooltipinfo>
  5217. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  5218. </div>
  5219. <h3>Audio Connections</h3>
  5220. <p>This object has no audio inputs or outputs. Separate i2s objects
  5221. are used to send and receive audio data. I2S slave mode objects
  5222. must be used, since this control object configures the WM8731 into
  5223. master mode.
  5224. </p>
  5225. <h3>Functions</h3>
  5226. <p class=func><span class=keyword>enable</span>();</p>
  5227. <p class=desc>Turn on the WS8731, in I2S Master mode. I2S slave mode
  5228. communication must be used by Teensy.
  5229. </p>
  5230. <p class=func><span class=keyword>disable</span>();</p>
  5231. <p class=desc>not implemented
  5232. </p>
  5233. <p class=func><span class=keyword>volume</span>(level);</p>
  5234. <p class=desc>Set the headphone volume level. Range is 0 to 1.0.
  5235. </p>
  5236. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  5237. <p class=desc>Adjust the line level input gain. Range is 0 to 1.0.
  5238. </p>
  5239. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  5240. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  5241. </p>
  5242. <h3>Examples</h3>
  5243. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  5244. </p>
  5245. <h3>Notes</h3>
  5246. <p>The WM8731 will implement a sample rate of its crystal frequency divided by 256.
  5247. To get the 44.1 kHz sample rate the Teensy Audio Library expects, an
  5248. 11.2896 MHz crystal should be used.
  5249. </p>
  5250. </script>
  5251. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  5252. <div class="form-row">
  5253. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5254. <input type="text" id="node-input-name" placeholder="Name">
  5255. </div>
  5256. </script>
  5257. <script type="text/x-red" data-help-name="AudioControlAK4558">
  5258. <h3>Summary</h3>
  5259. <div class=tooltipinfo>
  5260. <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>
  5261. in slave mode, where the Teensy controls all I2S timing.</p>
  5262. </div>
  5263. <h3>Audio Connections</h3>
  5264. <p>This object has no audio inputs or outputs. Separate I2S objects
  5265. are used to send and receive audio data.
  5266. </p>
  5267. <h3>Functions</h3>
  5268. <p class=func><span class=keyword>enable</span>();</p>
  5269. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  5270. </p>
  5271. <p class=func><span class=keyword>enableIn</span>();</p>
  5272. <p class=desc>Enables the ADC module.
  5273. </p>
  5274. <p class=func><span class=keyword>enableOut</span>();</p>
  5275. <p class=desc>Enables the DAC module.
  5276. </p>
  5277. <p class=func><span class=keyword>disable</span>();</p>
  5278. <p class=desc>Disables the ADC and the DAC modules.
  5279. </p>
  5280. <p class=func><span class=keyword>disableIn</span>();</p>
  5281. <p class=desc>Disable the ADC module.
  5282. </p>
  5283. <p class=func><span class=keyword>disableOut</span>();</p>
  5284. <p class=desc>Disable the DAC module.
  5285. </p>
  5286. <p class=func><span class=keyword>volume</span>(level);</p>
  5287. <p class=desc>Accepts a float in range 0.0-1.0 and sets the line output volume accordingly.
  5288. </p>
  5289. <p class=func><span class=keyword>volumeLeft</span>(level);</p>
  5290. <p class=desc>Accepts a float in range 0.0-1.0 and sets the left line output volume accordingly.
  5291. </p>
  5292. <p class=func><span class=keyword>volumeRight</span>(level);</p>
  5293. <p class=desc>Accepts a float in range 0.0-1.0 and sets the right line output volume accordingly.
  5294. </p>
  5295. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  5296. <p class=desc>NOT SUPPORTED BY THE AK4558
  5297. </p>
  5298. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  5299. <p class=desc>not implemented yet
  5300. </p>
  5301. <h3>Examples</h3>
  5302. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; PassthroughTest
  5303. </p>
  5304. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; SineOutTest
  5305. </p>
  5306. <h3>Notes</h3>
  5307. <p>TODO: Implement inputSelect() function to enable mono left, mono right, stereo operation.</p>
  5308. <p>TODO: Implement ADC and DAC filters control.</p>
  5309. <p>TODO: Implement DAC level attenuator attack rate modifier.</p>
  5310. </script>
  5311. <script type="text/x-red" data-template-name="AudioControlAK4558">
  5312. <div class="form-row">
  5313. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5314. <input type="text" id="node-input-name" placeholder="Name">
  5315. </div>
  5316. </script>
  5317. <script type="text/x-red" data-help-name="AudioControlCS4272">
  5318. <h3>Summary</h3>
  5319. <div class=tooltipinfo>
  5320. <p>Control the CS4272 chip on the <a href="https://hackaday.io/project/5912-teensy-super-audio-board" target="_blank">Super Audio Board</a>.
  5321. </p>
  5322. <p>TODO: does this control object put the CS4272 into I2S master or slave mode</p>
  5323. </div>
  5324. <h3>Audio Connections</h3>
  5325. <p>This object has no audio inputs or outputs. Separate I2S objects
  5326. are used to send and receive audio data.
  5327. </p>
  5328. <h3>Functions</h3>
  5329. <p class=func><span class=keyword>enable</span>();</p>
  5330. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  5331. </p>
  5332. <p class=func><span class=keyword>volume</span>(vol);</p>
  5333. <p class=desc>Set the volume level. Range is 0 to 1.0.
  5334. </p>
  5335. <p class=func><span class=keyword>volume</span>(left, right);</p>
  5336. <p class=desc>Set the volume level. Range is 0 to 1.0.
  5337. </p>
  5338. <p class=func><span class=keyword>dacVolume</span>(vol);</p>
  5339. <p class=desc>Set the volume level. Range is 0 to 1.0. TODO: what's the
  5340. distinction between volume() and dacVolume()?
  5341. </p>
  5342. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  5343. <p class=desc>Set the volume level. Range is 0 to 1.0.
  5344. </p>
  5345. <p class=func><span class=keyword>muteOutput</span>();</p>
  5346. <p class=desc>TODO: description
  5347. </p>
  5348. <p class=func><span class=keyword>unmuteOutput</span>();</p>
  5349. <p class=desc>TODO: description
  5350. </p>
  5351. <p class=func><span class=keyword>muteInput</span>();</p>
  5352. <p class=desc>TODO: description
  5353. </p>
  5354. <p class=func><span class=keyword>unmuteInput</span>();</p>
  5355. <p class=desc>TODO: description
  5356. </p>
  5357. <p class=func><span class=keyword>enableDither</span>();</p>
  5358. <p class=desc>TODO: description
  5359. </p>
  5360. <p class=func><span class=keyword>disableDither</span>();</p>
  5361. <p class=desc>TODO: description
  5362. </p>
  5363. <h3>Hardware</h3>
  5364. <p>Pin 2 must be connected to the CS4272 reset. SDA &amp; SCL are used for all control.
  5365. </p>
  5366. <h3>Notes</h3>
  5367. </script>
  5368. <script type="text/x-red" data-template-name="AudioControlCS4272">
  5369. <div class="form-row">
  5370. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5371. <input type="text" id="node-input-name" placeholder="Name">
  5372. </div>
  5373. </script>
  5374. <script type="text/x-red" data-help-name="AudioControlCS42448">
  5375. <h3>Summary</h3>
  5376. <div class=tooltipinfo>
  5377. <p>Control the CS42448 chip in TDM mode, for 6 inputs and 8 outputs.
  5378. </p>
  5379. <p align=center><img src="img/cs42448.jpg"></p>
  5380. </div>
  5381. </div>
  5382. <h3>Audio Connections</h3>
  5383. <p>This object has no audio inputs or outputs. Separate TDM objects
  5384. are used to send and receive audio data.
  5385. </p>
  5386. <h3>Functions</h3>
  5387. <p class=func><span class=keyword>enable</span>();</p>
  5388. <p class=desc>Enables the CS42448 to work in TDM mode.
  5389. </p>
  5390. <p class=func><span class=keyword>volume</span>(level);</p>
  5391. <p class=desc>Set the volume level for all output channels. Range is 0 to 1.0.
  5392. </p>
  5393. <p class=func><span class=keyword>volume</span>(channel, level);</p>
  5394. <p class=desc>Set the volume level for a single output. Channel is 1 to 8. Range is 0 to 1.0.
  5395. </p>
  5396. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  5397. <p class=desc>Set the input gain level for all input channels. Range is 0 to 15.85.
  5398. </p>
  5399. <p class=func><span class=keyword>inputLevel</span>(channel, level);</p>
  5400. <p class=desc>Set the input gain level for a single input. Channel is 1 to 6. Range is 0 to 15.85.
  5401. </p>
  5402. <h3>Hardware</h3>
  5403. <p>Tested with this <a href="https://oshpark.com/shared_projects/2Yj6rFaW">
  5404. CS42448 Circuit Board</a>.
  5405. </p>
  5406. <p align=center><img src="img/tdm.jpg"></p>
  5407. </div>
  5408. <h3>Notes</h3>
  5409. </script>
  5410. <script type="text/x-red" data-template-name="AudioControlCS42448">
  5411. <div class="form-row">
  5412. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  5413. <input type="text" id="node-input-name" placeholder="Name">
  5414. </div>
  5415. </script>
  5416. </body>
  5417. </html>