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.

5441 lines
246KB

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