Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

3925 Zeilen
176KB

  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="NodeDefinitions">
  323. {"nodes":[
  324. {"type":"AudioInputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  325. {"type":"AudioInputI2SQuad","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s_quad","inputs":0,"outputs":4,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  326. {"type":"AudioInputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"adc","inputs":0,"outputs":1,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  327. {"type":"AudioInputAnalogStereo","data":{"defaults":{"name":{"value":"new"}},"shortName":"adcs","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  328. {"type":"AudioInputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sslave","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  329. {"type":"AudioInputTDM","data":{"defaults":{"name":{"value":"new"}},"shortName":"tdm","inputs":0,"outputs":16,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  330. {"type":"AudioInputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usb","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  331. {"type":"AudioOutputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  332. {"type":"AudioOutputI2SQuad","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s_quad","inputs":4,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  333. {"type":"AudioOutputSPDIF","data":{"defaults":{"name":{"value":"new"}},"shortName":"spdif","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  334. {"type":"AudioOutputPT8211","data":{"defaults":{"name":{"value":"new"}},"shortName":"pt8211","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  335. {"type":"AudioOutputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"dac","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  336. {"type":"AudioOutputAnalogStereo","data":{"defaults":{"name":{"value":"new"}},"shortName":"dacs","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  337. {"type":"AudioOutputPWM","data":{"defaults":{"name":{"value":"new"}},"shortName":"pwm","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  338. {"type":"AudioOutputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2sslave","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  339. {"type":"AudioOutputTDM","data":{"defaults":{"name":{"value":"new"}},"shortName":"tdm","inputs":16,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  340. {"type":"AudioOutputUSB","data":{"defaults":{"name":{"value":"new"}},"shortName":"usb","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  341. {"type":"AudioMixer4","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer","inputs":4,"outputs":1,"category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  342. {"type":"AudioPlayMemory","data":{"defaults":{"name":{"value":"new"}},"shortName":"playMem","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  343. {"type":"AudioPlaySdWav","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdWav","inputs":0,"outputs":2,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  344. {"type":"AudioPlaySdRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  345. {"type":"AudioPlaySerialflashRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playFlashRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  346. {"type":"AudioPlayQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  347. {"type":"AudioRecordQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":1,"outputs":0,"category":"record-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  348. {"type":"AudioSynthSimpleDrum","data":{"defaults":{"name":{"value":"new"}},"shortName":"drum","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  349. {"type":"AudioSynthKarplusStrong","data":{"defaults":{"name":{"value":"new"}},"shortName":"string","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  350. {"type":"AudioSynthWaveformSine","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  351. {"type":"AudioSynthWaveformSineHires","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine_hires","inputs":0,"outputs":2,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  352. {"type":"AudioSynthWaveformSineModulated","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine_fm","inputs":1,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  353. {"type":"AudioSynthWaveform","data":{"defaults":{"name":{"value":"new"}},"shortName":"waveform","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  354. {"type":"AudioSynthWaveformPWM","data":{"defaults":{"name":{"value":"new"}},"shortName":"pwm","inputs":1,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  355. {"type":"AudioSynthToneSweep","data":{"defaults":{"name":{"value":"new"}},"shortName":"tonesweep","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  356. {"type":"AudioSynthWaveformDc","data":{"defaults":{"name":{"value":"new"}},"shortName":"dc","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  357. {"type":"AudioSynthNoiseWhite","data":{"defaults":{"name":{"value":"new"}},"shortName":"noise","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  358. {"type":"AudioSynthNoisePink","data":{"defaults":{"name":{"value":"new"}},"shortName":"pink","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  359. {"type":"AudioEffectFade","data":{"defaults":{"name":{"value":"new"}},"shortName":"fade","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  360. {"type":"AudioEffectChorus","data":{"defaults":{"name":{"value":"new"}},"shortName":"chorus","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  361. {"type":"AudioEffectFlange","data":{"defaults":{"name":{"value":"new"}},"shortName":"flange","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  362. {"type":"AudioEffectReverb","data":{"defaults":{"name":{"value":"new"}},"shortName":"reverb","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  363. {"type":"AudioEffectEnvelope","data":{"defaults":{"name":{"value":"new"}},"shortName":"envelope","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  364. {"type":"AudioEffectMultiply","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":2,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  365. {"type":"AudioEffectDelay","data":{"defaults":{"name":{"value":"new"}},"shortName":"delay","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  366. {"type":"AudioEffectDelayExternal","data":{"defaults":{"name":{"value":"new"}},"shortName":"delayExt","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  367. {"type":"AudioEffectBitcrusher","data":{"shortName":"bitcrusher","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  368. {"type":"AudioEffectMidSide","data":{"shortName":"midside","inputs":2,"outputs":2,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  369. {"type":"AudioEffectWaveshaper","data":{"shortName":"waveshape","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  370. {"type":"AudioFilterBiquad","data":{"defaults":{"name":{"value":"new"}},"shortName":"biquad","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  371. {"type":"AudioFilterFIR","data":{"defaults":{"name":{"value":"new"}},"shortName":"fir","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  372. {"type":"AudioFilterStateVariable","data":{"defaults":{"name":{"value":"new"}},"shortName":"filter","inputs":2,"outputs":3,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  373. {"type":"AudioAnalyzePeak","data":{"defaults":{"name":{"value":"new"}},"shortName":"peak","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  374. {"type":"AudioAnalyzeRMS","data":{"defaults":{"name":{"value":"new"}},"shortName":"rms","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  375. {"type":"AudioAnalyzeFFT256","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft256","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  376. {"type":"AudioAnalyzeFFT1024","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft1024","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  377. {"type":"AudioAnalyzeToneDetect","data":{"defaults":{"name":{"value":"new"}},"shortName":"tone","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  378. {"type":"AudioAnalyzeNoteFrequency","data":{"defaults":{"name":{"value":"new"}},"shortName":"notefreq","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  379. {"type":"AudioAnalyzePrint","data":{"defaults":{"name":{"value":"new"}},"shortName":"print","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  380. {"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  381. {"type":"AudioControlAK4558","data":{"defaults":{"name":{"value":"new"}},"shortName":"ak4558","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  382. {"type":"AudioControlCS4272","data":{"defaults":{"name":{"value":"new"}},"shortName":"cs4272","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  383. {"type":"AudioControlWM8731","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  384. {"type":"AudioControlWM8731master","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731m","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  385. {"type":"AudioControlCS42448","data":{"defaults":{"name":{"value":"new"}},"shortName":"cs42448","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}}
  386. ]}
  387. </script>
  388. <script type="text/x-red" data-help-name="AudioInputI2S">
  389. <h3>Summary</h3>
  390. <div class=tooltipinfo>
  391. <p>Receive 16 bit stereo audio from the
  392. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  393. or another I2S device, using I2S master mode.</p>
  394. <p align=center><img src="img/audioshield_inputs.jpg"></p>
  395. </div>
  396. <h3>Audio Connections</h3>
  397. <table class=doc align=center cellpadding=3>
  398. <tr class=top><th>Port</th><th>Purpose</th></tr>
  399. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  400. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  401. </table>
  402. <h3>Functions</h3>
  403. <p>This object has no functions to call from the Arduino sketch. It
  404. simply streams data from the I2S hardware to its 2 output ports.</p>
  405. <h3>Hardware</h3>
  406. <p align=center><img src="img/audioshield_backside.jpg"></p>
  407. <p>The I2S signals are used in "master" mode, where Teensy creates
  408. all 3 clock signals and controls all data timing.</p>
  409. <table class=doc align=center cellpadding=3>
  410. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  411. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  412. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  413. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  414. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  415. </table>
  416. <p>Audio from
  417. master mode I2S may be used in the same project as ADC, DAC and
  418. PWM signals, because all remain in sync to Teensy's timing</p>
  419. <h3>Examples</h3>
  420. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  421. </p>
  422. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  423. </p>
  424. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  425. </p>
  426. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  427. </p>
  428. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  429. </p>
  430. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  431. </p>
  432. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  433. </p>
  434. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  435. </p>
  436. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  437. </p>
  438. <h3>Notes</h3>
  439. <p>Normally, this object is used with the Audio Shield, which
  440. is controlled separately by the "sgtl5000" object.</p>
  441. <p>Only one I2S input and one I2S output object may be used. Master
  442. and slave modes may not be mixed (both must be of the same type).
  443. </p>
  444. <p>I2S master objects can be used together with non-I2S input and output
  445. objects, for simultaneous audio streaming on different hardware.</p>
  446. </script>
  447. <script type="text/x-red" data-template-name="AudioInputI2S">
  448. <div class="form-row">
  449. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  450. <input type="text" id="node-input-name" placeholder="Name">
  451. </div>
  452. </script>
  453. <script type="text/x-red" data-help-name="AudioInputI2SQuad">
  454. <h3>Summary</h3>
  455. <div class=tooltipinfo>
  456. <p>Receive 16 bit quad (4) channel audio from two
  457. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shields</a>
  458. or another I2S devices, using I2S master mode.</p>
  459. <p align=center><img src="img/audioshield_quad_in.jpg"></p>
  460. </div>
  461. <h3>Audio Connections</h3>
  462. <table class=doc align=center cellpadding=3>
  463. <tr class=top><th>Port</th><th>Purpose</th></tr>
  464. <tr class=odd><td align=center>Out 0</td><td>Channel #1</td></tr>
  465. <tr class=odd><td align=center>Out 1</td><td>Channel #2</td></tr>
  466. <tr class=odd><td align=center>Out 2</td><td>Channel #3</td></tr>
  467. <tr class=odd><td align=center>Out 3</td><td>Channel #4</td></tr>
  468. </table>
  469. <h3>Functions</h3>
  470. <p>This object has no functions to call from the Arduino sketch. It
  471. simply streams data from the I2S hardware to its 4 output ports.</p>
  472. <h3>Hardware</h3>
  473. <p>See this Sparkfun blog for <a href="https://www.sparkfun.com/news/2055" target="_blank">how
  474. to connect two audio adaptors for 4 channel audio</a>.
  475. <p>The I2S signals are used in "master" mode, where Teensy creates
  476. all 3 clock signals and controls all data timing.</p>
  477. <table class=doc align=center cellpadding=3>
  478. <tr class=top><th>Teensy<br>3.2 Pin</th><th>Teensy<br>3.5/3.6 Pin</th><th>Signal</th><th>Direction</th></tr>
  479. <tr class=odd><td align=center>9</td><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  480. <tr class=odd><td align=center>11</td><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  481. <tr class=odd><td align=center>13</td><td align=center>13</td><td>RX</td><td>Input</td></tr>
  482. <tr class=odd><td align=center>30</td><td align=center>38</td><td>RX</td><td>Input</td></tr>
  483. <tr class=odd><td align=center>23</td><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  484. </table>
  485. <p>Audio from
  486. master mode I2S may be used in the same project as ADC, DAC and
  487. PWM signals, because all remain in sync to Teensy's timing</p>
  488. <h3>Examples</h3>
  489. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughQuad
  490. </p>
  491. <h3>Notes</h3>
  492. <p>Normally, this object is used with two Audio Shield, which
  493. are controlled separately by a pair "sgtl5000" object.</p>
  494. </script>
  495. <script type="text/x-red" data-template-name="AudioInputI2SQuad">
  496. <div class="form-row">
  497. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  498. <input type="text" id="node-input-name" placeholder="Name">
  499. </div>
  500. </script>
  501. <script type="text/x-red" data-help-name="AudioInputAnalog">
  502. <h3>Summary</h3>
  503. <div class=tooltipinfo>
  504. <p>Receive audio using the built-in analog to digital converter.</p>
  505. </div>
  506. <h3>Audio Connections</h3>
  507. <table class=doc align=center cellpadding=3>
  508. <tr class=top><th>Port</th><th>Purpose</th></tr>
  509. <tr class=odd><td align=center>Out 0</td><td>Audio Channel</td></tr>
  510. </table>
  511. <h3>Functions</h3>
  512. <p>This object has no functions to call from the Arduino sketch. It
  513. simply streams data from the ADC to its output port.</p>
  514. <h3>Hardware</h3>
  515. <p>Pin A2 is used for audio input. This circuitry is recommended.</p>
  516. <p align=center><img src="img/adccircuit.png"></p>
  517. <p>Signal range is 0 to 1.2V</p>
  518. <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>
  519. <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>
  520. <p>Control Voltage (CV) from +5V to -5V can be adapted with a
  521. <a href="https://www.dorkbotpdx.org/blog/paul/control_voltage_cv_to_analog_input_pin">simple circuit</a>
  522. or better <a href="https://forum.pjrc.com/threads/28423?p=71257&viewfull=1#post71257">opamp-based circuity</a>
  523. to Teensy's 0-1.2V analog input range.</p>
  524. <h3>Examples</h3>
  525. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  526. </p>
  527. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  528. </p>
  529. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  530. </p>
  531. <p class=exam>File &gt; Examples &gt; OctoWS2811 &gt; SpectrumAnalyzer
  532. </p>
  533. <h3>Notes</h3>
  534. <p><b>analogRead() must not be used</b>, because AudioInputAnalog is regularly
  535. accessing the ADC hardware. If both access the hardware at the same
  536. moment, analogRead() can end up waiting forever, which effectively
  537. crashes your program.
  538. </p>
  539. <p>A different pin may be used, but adding it as an parameter
  540. to the AudioInputAnalog object definition.
  541. </p>
  542. <p>For example, to use pin A3:
  543. </p>
  544. <p class=desc><span class=keyword>AudioInputAnalog</span> adc1(<span class=literal>A3</span>);
  545. </p>
  546. <p>Noise due to high source impedance, which allows rapidly switching digital signals
  547. to capacitively couple... avoiding higher analog impedance is the solution.</p>
  548. <p>Power Supply rejection issue with simple DC bias (bigger capacitor may be needed if 3.3V has low frequency noise)</p>
  549. <p>Algorithm for automatic DC bias tracking</p>
  550. <p>TODO: actual noise measurements with different input circuitry
  551. (it's not as quiet as the audio shield)</p>
  552. </script>
  553. <script type="text/x-red" data-template-name="AudioInputAnalog">
  554. <div class="form-row">
  555. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  556. <input type="text" id="node-input-name" placeholder="Name">
  557. </div>
  558. </script>
  559. <script type="text/x-red" data-help-name="AudioInputAnalogStereo">
  560. <h3>Summary</h3>
  561. <div class=tooltipinfo>
  562. <p>Receive stereo audio using the built-in analog to digital converters.</p>
  563. </div>
  564. <h3>Audio Connections</h3>
  565. <table class=doc align=center cellpadding=3>
  566. <tr class=top><th>Port</th><th>Purpose</th></tr>
  567. <tr class=odd><td align=center>Out 0</td><td>Audio Channel (Left)</td></tr>
  568. <tr class=odd><td align=center>Out 1</td><td>Audio Channel (Right)</td></tr>
  569. </table>
  570. <h3>Functions</h3>
  571. <p>This object has no functions to call from the Arduino sketch. It
  572. simply streams data from both ADCs to its output ports.</p>
  573. <h3>Hardware</h3>
  574. <p>By default, pins A2 & A3 are used for audio input. This circuitry is recommended.</p>
  575. <p align=center><img src="img/adccircuit2.png"></p>
  576. <p>Signal range is 0 to 1.2V</p>
  577. <p>Control Voltage (CV) from +5V to -5V can be adapted with a
  578. <a href="https://www.dorkbotpdx.org/blog/paul/control_voltage_cv_to_analog_input_pin">simple circuit</a>
  579. or better <a href="https://forum.pjrc.com/threads/28423?p=71257&viewfull=1#post71257">opamp-based circuity</a>
  580. to Teensy's 0-1.2V analog input range.</p>
  581. <h3>Examples</h3>
  582. <!--
  583. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  584. </p>
  585. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  586. </p>
  587. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  588. </p>
  589. <p class=exam>File &gt; Examples &gt; OctoWS2811 &gt; SpectrumAnalyzer
  590. </p>
  591. -->
  592. <h3>Notes</h3>
  593. <p><b>analogRead() must not be used</b>, because AudioInputAnalogStereo is regularly
  594. accessing the ADC hardware. If both access the hardware at the same
  595. moment, analogRead() can end up waiting forever, which effectively
  596. crashes your program.
  597. </p>
  598. <p>A different pin may be used, but adding it as an parameter
  599. to the AudioInputAnalog object definition.
  600. </p>
  601. <p>For example:
  602. </p>
  603. <p class=desc><span class=keyword>AudioInputAnalogStereo</span> adc1(<span class=literal>A3</span>, <span class=literal>A2</span>);
  604. </p>
  605. <p>TODO: add info here about which pins work for input 0 and 1.
  606. </p>
  607. <p>Noise due to high source impedance, which allows rapidly switching digital signals
  608. to capacitively couple... avoiding higher analog impedance is the solution.</p>
  609. <p>Power Supply rejection issue with simple DC bias (bigger capacitor may be needed if 3.3V has low frequency noise)</p>
  610. <p>Algorithm for automatic DC bias tracking</p>
  611. <p>TODO: actual noise measurements with different input circuitry
  612. (it's not as quiet as the audio shield)</p>
  613. </script>
  614. <script type="text/x-red" data-template-name="AudioInputAnalogStereo">
  615. <div class="form-row">
  616. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  617. <input type="text" id="node-input-name" placeholder="Name">
  618. </div>
  619. </script>
  620. <script type="text/x-red" data-help-name="AudioInputI2Sslave">
  621. <h3>Summary</h3>
  622. <div class=tooltipinfo>
  623. <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode
  624. (where the ADC or codec chip, not Teensy, controls audio timing).</p>
  625. </div>
  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>Left Channel</td></tr>
  630. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  631. </table>
  632. <h3>Functions</h3>
  633. <p>This object has no functions to call from the Arduino sketch. It
  634. simply streams data from the I2S hardware to its 2 output ports.</p>
  635. <h3>Hardware</h3>
  636. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  637. data timing.</p>
  638. <table class=doc align=center cellpadding=3>
  639. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  640. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  641. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  642. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  643. </table>
  644. <!--
  645. <h3>Examples</h3>
  646. <p class=exam>File &gt; Examples &gt; Audio &gt;
  647. </p>
  648. -->
  649. <h3>Notes</h3>
  650. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  651. PWM</b> signals. Differences in timing between the I2S device and
  652. Teensy's clock can cause occasional audio glitches when I2S slave mode
  653. is used together with other input or output objects based on Teensy's
  654. timing.</p>
  655. <p>Only one I2S input and one I2S output object may be used. Master
  656. and slave modes may not be mixed (both must be of the same type).
  657. </p>
  658. </script>
  659. <script type="text/x-red" data-template-name="AudioInputI2Sslave">
  660. <div class="form-row">
  661. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  662. <input type="text" id="node-input-name" placeholder="Name">
  663. </div>
  664. </script>
  665. <script type="text/x-red" data-help-name="AudioInputTDM">
  666. <h3>Summary</h3>
  667. <div class=tooltipinfo>
  668. <p>Receive a 256 bit Time Division Multiplexed frame containing
  669. many audio channels.</p>
  670. <p align=center><img src="img/tdm.jpg"></p>
  671. </div>
  672. <h3>Audio Connections</h3>
  673. <table class=doc align=center cellpadding=3>
  674. <tr class=top><th>Port</th><th>Purpose</th></tr>
  675. <tr class=odd><td align=center>Out 0</td><td>Bits 0 to 15</td></tr>
  676. <tr class=odd><td align=center>Out 1</td><td>Bits 16 to 31</td></tr>
  677. <tr class=odd><td align=center>Out 2</td><td>Bits 32 to 47</td></tr>
  678. <tr class=odd><td align=center>Out 3</td><td>Bits 48 to 63</td></tr>
  679. <tr class=odd><td align=center>Out 4</td><td>Bits 64 to 79</td></tr>
  680. <tr class=odd><td align=center>Out 5</td><td>Bits 80 to 95</td></tr>
  681. <tr class=odd><td align=center>Out 6</td><td>Bits 96 to 111</td></tr>
  682. <tr class=odd><td align=center>Out 7</td><td>Bits 112 to 127</td></tr>
  683. <tr class=odd><td align=center>Out 8</td><td>Bits 128 to 143</td></tr>
  684. <tr class=odd><td align=center>Out 9</td><td>Bits 144 to 159</td></tr>
  685. <tr class=odd><td align=center>Out 10</td><td>Bits 160 to 175</td></tr>
  686. <tr class=odd><td align=center>Out 11</td><td>Bits 176 to 191</td></tr>
  687. <tr class=odd><td align=center>Out 12</td><td>Bits 192 to 207</td></tr>
  688. <tr class=odd><td align=center>Out 13</td><td>Bits 208 to 223</td></tr>
  689. <tr class=odd><td align=center>Out 14</td><td>Bits 224 to 239</td></tr>
  690. <tr class=odd><td align=center>Out 15</td><td>Bits 240 to 255</td></tr>
  691. </table>
  692. <h3>Functions</h3>
  693. <p>This object has no functions to call from the Arduino sketch. It
  694. simply streams data from the TDM hardware to its 16 output ports.</p>
  695. <h3>Hardware</h3>
  696. <p>TDM has been tested with this <a href="https://oshpark.com/shared_projects/2Yj6rFaW">
  697. CS42448 Circuit Board</a>. It may also work with
  698. <a href="https://forum.pjrc.com/threads/42894">Invensense ICS-52000 microphones</a>.
  699. </p>
  700. <table class=doc align=center cellpadding=3>
  701. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  702. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output, 11.3 MHz</td></tr>
  703. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output, 22.6 MHz</td></tr>
  704. <tr class=odd><td align=center>13</td><td>RX</td><td>Input, 11.3 Mbit/sec</td></tr>
  705. <tr class=odd><td align=center>23</td><td>FS</td><td>Output</td></tr>
  706. </table>
  707. <p>Audio from
  708. master mode TDM may be used in the same project as ADC, DAC and
  709. PWM signals, because all remain in sync to Teensy's timing</p>
  710. <!--<h3>Examples</h3>-->
  711. <h3>Notes</h3>
  712. <p>Only one TDM input and one TDM output object may be used. The
  713. I2S hardware is used by TDM, so TDM objects may not be used
  714. together with I2S, SPDIF or PT8211.</p>
  715. <p>When used with TDM devices which transmit 32 bit audio, the
  716. even numbered channels will contain the useful upper 16
  717. bits of audio data.</p>
  718. <p>AudioMemory should be at least 16. Even if most channels are
  719. unused, this TDM object will need to allocate 16 blocks of
  720. memory.</p>
  721. </script>
  722. <script type="text/x-red" data-template-name="AudioInputTDM">
  723. <div class="form-row">
  724. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  725. <input type="text" id="node-input-name" placeholder="Name">
  726. </div>
  727. </script>
  728. <script type="text/x-red" data-help-name="AudioInputUSB">
  729. <h3>Summary</h3>
  730. <div class=tooltipinfo>
  731. <p>Receive stereo audio from a PC or Mac. Teensy appears as a USB
  732. sound device.</p>
  733. <p align=center><img src="img/usbtype_audio_in.png"></p>
  734. </div>
  735. <h3>Audio Connections</h3>
  736. <table class=doc align=center cellpadding=3>
  737. <tr class=top><th>Port</th><th>Purpose</th></tr>
  738. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  739. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  740. </table>
  741. <h3>Functions</h3>
  742. <p>This object has no functions to call from the Arduino sketch. It
  743. simply streams data from the USB to its 2 output ports.</p>
  744. <!--
  745. <h3>Hardware</h3>
  746. -->
  747. <h3>Examples</h3>
  748. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughUSB</p>
  749. </p>
  750. <h3>Notes</h3>
  751. <p>Arduino's <b>Tools &gt; USB Type</b> menu must be set to <b>Audio</b>.
  752. </p>
  753. <p align=center><img src="img/usbtype_audio.png"></p>
  754. <p>USB input &amp; output does not cause the Teensy Audio Library to
  755. update. At least one non-USB input or output object must be
  756. present for the entire library to update properly.</p>
  757. <p>A known problem exists with USB audio from Macintosh computers.
  758. 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
  759. can be enabled by editing usb_audio.cpp</a>.
  760. Find and uncomment "#define MACOSX_ADAPTIVE_LIMIT".</p>
  761. </script>
  762. <script type="text/x-red" data-template-name="AudioInputUSB">
  763. <div class="form-row">
  764. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  765. <input type="text" id="node-input-name" placeholder="Name">
  766. </div>
  767. </script>
  768. <script type="text/x-red" data-help-name="AudioOutputI2S">
  769. <h3>Summary</h3>
  770. <div class=tooltipinfo>
  771. <p>Transmit 16 bit stereo audio to the
  772. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  773. or another I2S device, using I2S master mode.</p>
  774. <p align=center><img src="img/audioshield_outputs.jpg"></p>
  775. </div>
  776. <h3>Audio Connections</h3>
  777. <table class=doc align=center cellpadding=3>
  778. <tr class=top><th>Port</th><th>Purpose</th></tr>
  779. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  780. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  781. </table>
  782. <h3>Functions</h3>
  783. <p>This object has no functions to call from the Arduino sketch. It
  784. simply streams data from its 2 input ports to the I2S hardware.</p>
  785. <h3>Hardware</h3>
  786. <p align=center><img src="img/audioshield_backside.jpg"></p>
  787. <p>The I2S signals are used in "master" mode, where Teensy creates
  788. all 3 clock signals and controls all data timing.</p>
  789. <table class=doc align=center cellpadding=3>
  790. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  791. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  792. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  793. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  794. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  795. </table>
  796. <p>Audio from
  797. master mode I2S may be used in the same project as ADC, DAC and
  798. PWM signals, because all remain in sync to Teensy's timing</p>
  799. <h3>Examples</h3>
  800. <p>Nearly all the examples use this object. Here are some of the highlights:</p>
  801. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  802. </p>
  803. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  804. </p>
  805. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  806. </p>
  807. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  808. </p>
  809. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  810. </p>
  811. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  812. </p>
  813. <h3>Notes</h3>
  814. <p>Normally, this object is used with the Audio Shield, which
  815. is controlled separately by the "sgtl5000" object.</p>
  816. <p>Only one I2S input and one I2S output object may be used. Master
  817. and slave modes may not be mixed (both must be of the same type).
  818. </p>
  819. </script>
  820. <script type="text/x-red" data-template-name="AudioOutputI2S">
  821. <div class="form-row">
  822. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  823. <input type="text" id="node-input-name" placeholder="Name">
  824. </div>
  825. </script>
  826. <script type="text/x-red" data-help-name="AudioOutputI2SQuad">
  827. <h3>Summary</h3>
  828. <div class=tooltipinfo>
  829. <p>Transmit quad (4) channel 16 bit audio, using I2S master mode.</p>
  830. <p align=center><img src="img/audioshield_quad_out.jpg"></p>
  831. </div>
  832. <h3>Audio Connections</h3>
  833. <table class=doc align=center cellpadding=3>
  834. <tr class=top><th>Port</th><th>Purpose</th></tr>
  835. <tr class=odd><td align=center>In 0</td><td>Channel #1</td></tr>
  836. <tr class=odd><td align=center>In 1</td><td>Channel #2</td></tr>
  837. <tr class=odd><td align=center>In 2</td><td>Channel #3</td></tr>
  838. <tr class=odd><td align=center>In 3</td><td>Channel #4</td></tr>
  839. </table>
  840. <h3>Functions</h3>
  841. <p>This object has no functions to call from the Arduino sketch. It
  842. simply streams data from its 4 input ports to the I2S hardware.</p>
  843. <h3>Hardware</h3>
  844. <p>See this Sparkfun blog for <a href="https://www.sparkfun.com/news/2055" target="_blank">how
  845. to connect two audio adaptors for 4 channel audio</a>. More
  846. <a href="https://forum.pjrc.com/threads/29373-Bit-bang-multiple-I2S-inputs-simultaneously?p=79606#post79606" target="_blank">details</a> are also available.
  847. <p>The I2S signals are used in "master" mode, where Teensy creates
  848. all 3 clock signals and controls all data timing.</p>
  849. <table class=doc align=center cellpadding=3>
  850. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  851. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  852. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  853. <tr class=odd><td align=center>22</td><td>TX (ch 1+2)</td><td>Output</td></tr>
  854. <tr class=odd><td align=center>15</td><td>TX (ch 3+4)</td><td>Output</td></tr>
  855. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  856. </table>
  857. <p>Audio from
  858. master mode I2S may be used in the same project as ADC, DAC and
  859. PWM signals, because all remain in sync to Teensy's timing</p>
  860. <h3>Examples</h3>
  861. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughQuad
  862. </p>
  863. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; QuadChannelOutput
  864. </p>
  865. <h3>Notes</h3>
  866. <p>Normally, this object is used with two Audio Shields, which
  867. are controlled separately by a pair of "sgtl5000" objects.</p>
  868. </script>
  869. <script type="text/x-red" data-template-name="AudioOutputI2SQuad">
  870. <div class="form-row">
  871. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  872. <input type="text" id="node-input-name" placeholder="Name">
  873. </div>
  874. </script>
  875. <script type="text/x-red" data-help-name="AudioOutputSPDIF">
  876. <h3>Summary</h3>
  877. <div class=tooltipinfo>
  878. <p>Transmit 16 bit stereo audio as Digital S/PDIF.</p>
  879. <p align=center><img src="img/spdif_proto.jpg"></p>
  880. </div>
  881. <h3>Audio Connections</h3>
  882. <table class=doc align=center cellpadding=3>
  883. <tr class=top><th>Port</th><th>Purpose</th></tr>
  884. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  885. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  886. </table>
  887. <h3>Functions</h3>
  888. <p>This object has no functions to call from the Arduino sketch. It
  889. simply streams data from its 2 input ports S/PDIF encoded digital
  890. audio on pin 22.</p>
  891. <h3>Hardware</h3>
  892. <p>The S/PDIF output signal can be used to drive an optical TOSLINK
  893. cable, or a standard (usually orange) RCA jack.</p>
  894. <table class=doc align=center cellpadding=3>
  895. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  896. <tr class=odd><td align=center>22</td><td>S/PDIF</td><td>Output</td></tr>
  897. </table>
  898. <p>For optical TOSLINK output, this
  899. <a href="https://www.oshpark.com/shared_projects/KcDBKHta" target="_blank">OSH Park board</a>
  900. can be used with the inexpensive Everlight PLT133/T6A connector, available
  901. at Digikey, 1080-1434-ND.
  902. </p>
  903. <h3>Examples</h3>
  904. <p>The AudioOutputSPDIF object can be used in place of the AudioOutputI2S object,
  905. <p>used in nearly all the examples. The WavFilePlayer shows how to substitute
  906. output objects for different hardware types.
  907. </p>
  908. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  909. </p>
  910. <h3>Credits</h3>
  911. <p><a href="https://github.com/FrankBoesing" target="_blank">Frank Boesing</a>
  912. developed the AudioOutputSPDIF code. The original
  913. <a href="https://forum.pjrc.com/threads/28639-S-pdif" target="_blank">forum disussion</a>
  914. included valuable input and code from "kpc".
  915. <h3>Notes</h3>
  916. <p>S/PDIF output uses the I2S hardware. This object can not be used
  917. together with any of the I2S objects, because it requires the I2S
  918. hardware with different internal settings.</p>
  919. </p>
  920. </script>
  921. <script type="text/x-red" data-template-name="AudioOutputSPDIF">
  922. <div class="form-row">
  923. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  924. <input type="text" id="node-input-name" placeholder="Name">
  925. </div>
  926. </script>
  927. <script type="text/x-red" data-help-name="AudioOutputPT8211">
  928. <h3>Summary</h3>
  929. <div class=tooltipinfo>
  930. <p>Transmit 16 bit stereo audio to a low-cost PT8211 DAC chip. 4X oversampling
  931. and filtering are automatically used to improve output quality.</p>
  932. <p align=center><img src="img/pt8211.jpg"></p>
  933. </div>
  934. <h3>Audio Connections</h3>
  935. <table class=doc align=center cellpadding=3>
  936. <tr class=top><th>Port</th><th>Purpose</th></tr>
  937. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  938. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  939. </table>
  940. <h3>Functions</h3>
  941. <p>This object has no functions to call from the Arduino sketch. It
  942. simply streams data from its 2 input ports to a PT8211 chip. 4X
  943. oversampling and filtering is automatically used to improve quality.</p>
  944. <h3>Hardware</h3>
  945. <table class=doc align=center cellpadding=3>
  946. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  947. <tr class=odd><td align=center>9</td><td>BCK</td><td>Output</td></tr>
  948. <tr class=odd><td align=center>22</td><td>DIN</td><td>Output</td></tr>
  949. <tr class=odd><td align=center>23</td><td>FS</td><td>Output</td></tr>
  950. </table>
  951. <p>More information can be found in the PT8211 datasheet.
  952. </p>
  953. <h3>Examples</h3>
  954. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PT8211Sine
  955. </p>
  956. <h3>Credits</h3>
  957. <p>Frank Boesing and Benjamin developed this PT8211 object. Details can be
  958. found on this
  959. <a href="https://forum.pjrc.com/threads/29284-Dual-channel-16bit-dac-PT8211/page3" target="_blank">forum disussion</a>.
  960. <h3>Notes</h3>
  961. <p>
  962. </p>
  963. </script>
  964. <script type="text/x-red" data-template-name="AudioOutputPT8211">
  965. <div class="form-row">
  966. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  967. <input type="text" id="node-input-name" placeholder="Name">
  968. </div>
  969. </script>
  970. <script type="text/x-red" data-help-name="AudioOutputAnalog">
  971. <h3>Summary</h3>
  972. <div class=tooltipinfo>
  973. <p>Transmit 12 bit audio using Teensy's built-in digital to analog converter.</p>
  974. <p align=center><img src="img/dac_speaker.jpg"><br>
  975. <small><a href="http://www.pjrc.com/store/prop_shield.html" target="_blank_">Prop Shield with 4&ohm; Speaker</a></small></p>
  976. </div>
  977. <h3>Audio Connections</h3>
  978. <table class=doc align=center cellpadding=3>
  979. <tr class=top><th>Port</th><th>Purpose</th></tr>
  980. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  981. </table>
  982. <h3>Functions</h3>
  983. <p class=func><span class=keyword>analogReference</span>(ref);</p>
  984. <p class=desc>Configure output voltage range:<br>
  985. <span class=literal>INTERNAL</span> selects 1.2 volt peak-to-peak output.<br>
  986. <span class=literal>EXTERNAL</span> selects 3.3 volt peak-to-peak output.
  987. </p>
  988. <h3>Hardware</h3>
  989. <p align=center><img src="img/dacpin.jpg"></p>
  990. <p>Signal range default is 0 to 1.2V</p>
  991. <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>
  992. <p>The DAC pin is used with the
  993. <a href="http://www.pjrc.com/store/prop_shield.html" target="_blank_">Prop Shield</a>
  994. to drive speakers.</p>
  995. <h3>Examples</h3>
  996. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  997. </p>
  998. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  999. </p>
  1000. <p class=exam><a href="https://github.com/PaulStoffregen/TouchGuitar" target="_blank">TouchGuitar</a>
  1001. </p>
  1002. <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>
  1003. </p>
  1004. <p class=exam>File &gt; Examples &gt; OctoWS2811 &gt; VideoSDcard
  1005. </p>
  1006. <p class=exam>File &gt; Examples &gt; SerialFlash &gt; MP3Player
  1007. </p>
  1008. <h3>Notes</h3>
  1009. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  1010. not filtered. This may not
  1011. be an issue for many uses, but care should be used if amplified and driven
  1012. to high power tweeters.</p>
  1013. <p>When using 3.3V output, the power supply is used for the analog reference. Noise
  1014. present on the 3.3V power can couple to the DAC output signal.
  1015. </p>
  1016. </script>
  1017. <script type="text/x-red" data-template-name="AudioOutputAnalog">
  1018. <div class="form-row">
  1019. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1020. <input type="text" id="node-input-name" placeholder="Name">
  1021. </div>
  1022. </script>
  1023. <script type="text/x-red" data-help-name="AudioOutputAnalogStereo">
  1024. <h3>Summary</h3>
  1025. <div class=tooltipinfo>
  1026. <p>Transmit 12 bit stereo audio using Teensy 3.5 or 3.6 built-in digital to analog converters.</p>
  1027. <!--<p align=center><img src="img/dac_speaker.jpg"><br>
  1028. <small><a href="http://www.pjrc.com/store/prop_shield.html" target="_blank_">Prop Shield with 4&ohm; Speaker</a></small></p>-->
  1029. </div>
  1030. <h3>Audio Connections</h3>
  1031. <table class=doc align=center cellpadding=3>
  1032. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1033. <tr class=odd><td align=center>In 0</td><td>Audio Channel (Left)</td></tr>
  1034. <tr class=odd><td align=center>In 1</td><td>Audio Channel (Right)</td></tr>
  1035. </table>
  1036. <h3>Functions</h3>
  1037. <p class=func><span class=keyword>analogReference</span>(ref);</p>
  1038. <p class=desc>Configure output voltage range:<br>
  1039. <span class=literal>INTERNAL</span> selects 1.2 volt peak-to-peak output.<br>
  1040. <span class=literal>EXTERNAL</span> selects 3.3 volt peak-to-peak output.
  1041. </p>
  1042. <h3>Hardware</h3>
  1043. <p align=center><img src="img/dacpins.png"></p>
  1044. <p>Signal range default is 0 to 1.2V</p>
  1045. <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>
  1046. <p>The DAC pin is used with the
  1047. <a href="http://www.pjrc.com/store/prop_shield.html" target="_blank_">Prop Shield</a>
  1048. to drive speakers.</p>
  1049. <h3>Examples</h3>
  1050. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  1051. </p>
  1052. <p class=exam>File &gt; Examples &gt; SerialFlash &gt; MP3Player
  1053. </p>-->
  1054. <h3>Notes</h3>
  1055. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  1056. not filtered. This may not
  1057. be an issue for many uses, but care should be used if amplified and driven
  1058. to high power tweeters.</p>
  1059. <p>When using 3.3V output, the power supply is used for the analog reference. Noise
  1060. present on the 3.3V power can couple to the DAC output signal.
  1061. </p>
  1062. </script>
  1063. <script type="text/x-red" data-template-name="AudioOutputAnalogStereo">
  1064. <div class="form-row">
  1065. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1066. <input type="text" id="node-input-name" placeholder="Name">
  1067. </div>
  1068. </script>
  1069. <script type="text/x-red" data-help-name="AudioOutputPWM">
  1070. <h3>Summary</h3>
  1071. <div class=tooltipinfo>
  1072. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  1073. used for coarse and fine pulses, to be combined by scaled
  1074. resistors.</p>
  1075. </div>
  1076. <h3>Audio Connections</h3>
  1077. <table class=doc align=center cellpadding=3>
  1078. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1079. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  1080. </table>
  1081. <h3>Functions</h3>
  1082. <p>This object has no functions to call from the Arduino sketch. It
  1083. simply streams data from the its input port to the PWM pins.</p>
  1084. <h3>Hardware</h3>
  1085. <p>The following circuit is recommended.</p>
  1086. <p align=center><img src="img/pwmdualcircuit.jpg"></p>
  1087. <p>Signal range is approx 1.55 Vp-p.</p>
  1088. <p>These resistor values assume approx 20 ohms output impedance
  1089. on the digital pins. The 127K resistor may be adjusted or
  1090. trimmed for variation in output drive and tolerance on the
  1091. 475 ohm resistor.</p>
  1092. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  1093. C0G/NPO ceramic capacitor should be used for filtering. Low
  1094. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  1095. <h3>Examples</h3>
  1096. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  1097. </p>
  1098. <h3>Notes</h3>
  1099. <p>This object only works properly when Tools &gt; CPU_Speed is set to
  1100. 48 or 96 MHz. Other speeds aren't supported and will likely fail
  1101. in strange ways.</p>
  1102. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  1103. will only slightly filter the carrier. Extra filtering will be
  1104. required for a clean signal without the ultrasonic PWM carrier.
  1105. </p>
  1106. <p>Analog signals created by filtering PWM waveforms use the digital
  1107. power supply as their reference voltage. Any noise on the digital
  1108. power line can directly couple to the output signal. The built-in DAC or
  1109. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  1110. should be used when higher quality signals are needed.</p>
  1111. </script>
  1112. <script type="text/x-red" data-template-name="AudioOutputPWM">
  1113. <div class="form-row">
  1114. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1115. <input type="text" id="node-input-name" placeholder="Name">
  1116. </div>
  1117. </script>
  1118. <script type="text/x-red" data-help-name="AudioOutputI2Sslave">
  1119. <h3>Summary</h3>
  1120. <div class=tooltipinfo>
  1121. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode
  1122. (where the DAC or codec chip, not Teensy, controls audio timing).</p>
  1123. </div>
  1124. <h3>Audio Connections</h3>
  1125. <table class=doc align=center cellpadding=3>
  1126. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1127. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  1128. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  1129. </table>
  1130. <h3>Functions</h3>
  1131. <p>This object has no functions to call from the Arduino sketch. It
  1132. simply streams data from its 2 input ports to the I2S hardware.</p>
  1133. <h3>Hardware</h3>
  1134. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  1135. data timing.</p>
  1136. <table class=doc align=center cellpadding=3>
  1137. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  1138. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  1139. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  1140. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  1141. </table>
  1142. <h3>Examples</h3>
  1143. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  1144. </p>
  1145. <h3>Notes</h3>
  1146. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  1147. PWM</b> signals. Differences in timing between the I2S device and
  1148. Teensy's clock can cause occasional audio glitches when I2S slave mode
  1149. is used together with other input or output objects based on Teensy's
  1150. timing.</p>
  1151. <p>Only one I2S input and one I2S output object may be used. Master
  1152. and slave modes may not be mixed (both must be of the same type).
  1153. </p>
  1154. </script>
  1155. <script type="text/x-red" data-template-name="AudioOutputI2Sslave">
  1156. <div class="form-row">
  1157. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1158. <input type="text" id="node-input-name" placeholder="Name">
  1159. </div>
  1160. </script>
  1161. <script type="text/x-red" data-help-name="AudioOutputTDM">
  1162. <h3>Summary</h3>
  1163. <div class=tooltipinfo>
  1164. <p>Transmit a 256 bit Time Division Multiplexed frame containing
  1165. many audio channels.</p>
  1166. <p align=center><img src="img/tdm.jpg"></p>
  1167. </div>
  1168. <h3>Audio Connections</h3>
  1169. <table class=doc align=center cellpadding=3>
  1170. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1171. <tr class=odd><td align=center>In 0</td><td>Bits 0 to 15</td></tr>
  1172. <tr class=odd><td align=center>In 1</td><td>Bits 16 to 31</td></tr>
  1173. <tr class=odd><td align=center>In 2</td><td>Bits 32 to 47</td></tr>
  1174. <tr class=odd><td align=center>In 3</td><td>Bits 48 to 63</td></tr>
  1175. <tr class=odd><td align=center>In 4</td><td>Bits 64 to 79</td></tr>
  1176. <tr class=odd><td align=center>In 5</td><td>Bits 80 to 95</td></tr>
  1177. <tr class=odd><td align=center>In 6</td><td>Bits 96 to 111</td></tr>
  1178. <tr class=odd><td align=center>In 7</td><td>Bits 112 to 127</td></tr>
  1179. <tr class=odd><td align=center>In 8</td><td>Bits 128 to 143</td></tr>
  1180. <tr class=odd><td align=center>In 9</td><td>Bits 144 to 159</td></tr>
  1181. <tr class=odd><td align=center>In 10</td><td>Bits 160 to 175</td></tr>
  1182. <tr class=odd><td align=center>In 11</td><td>Bits 176 to 191</td></tr>
  1183. <tr class=odd><td align=center>In 12</td><td>Bits 192 to 207</td></tr>
  1184. <tr class=odd><td align=center>In 13</td><td>Bits 208 to 223</td></tr>
  1185. <tr class=odd><td align=center>In 14</td><td>Bits 224 to 239</td></tr>
  1186. <tr class=odd><td align=center>In 15</td><td>Bits 240 to 255</td></tr>
  1187. </table>
  1188. <h3>Functions</h3>
  1189. <p>This object has no functions to call from the Arduino sketch. It
  1190. simply streams data from its 16 input ports to the TDM hardware.</p>
  1191. <h3>Hardware</h3>
  1192. <p>TDM has been tested with this <a href="https://oshpark.com/shared_projects/2Yj6rFaW">
  1193. CS42448 Circuit Board</a>.
  1194. </p>
  1195. <table class=doc align=center cellpadding=3>
  1196. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  1197. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output, 11.3 MHz</td></tr>
  1198. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output, 22.6 MHz</td></tr>
  1199. <tr class=odd><td align=center>22</td><td>TX</td><td>Input, 11.3 Mbit/sec</td></tr>
  1200. <tr class=odd><td align=center>23</td><td>WS</td><td>Output</td></tr>
  1201. </table>
  1202. <p>Audio from
  1203. master mode TDM may be used in the same project as ADC, DAC and
  1204. PWM signals, because all remain in sync to Teensy's timing</p>
  1205. <!--<h3>Examples</h3>-->
  1206. <h3>Notes</h3>
  1207. <p>Only one TDM input and one TDM output object may be used. The
  1208. I2S hardware is used by TDM, so TDM objects may not be used
  1209. together with I2S, SPDIF or PT8211.</p>
  1210. <p>When used with TDM devices which receive 32 bit audio, the
  1211. even numbered channels are used for the top 16 bits.</p>
  1212. </script>
  1213. <script type="text/x-red" data-template-name="AudioOutputTDM">
  1214. <div class="form-row">
  1215. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1216. <input type="text" id="node-input-name" placeholder="Name">
  1217. </div>
  1218. </script>
  1219. <script type="text/x-red" data-help-name="AudioOutputUSB">
  1220. <h3>Summary</h3>
  1221. <div class=tooltipinfo>
  1222. <p>Send stereo audio to a PC or Mac. Teensy appears as a USB
  1223. sound device.</p>
  1224. <p align=center><img src="img/usbtype_audio_out.png"></p>
  1225. </div>
  1226. <h3>Audio Connections</h3>
  1227. <table class=doc align=center cellpadding=3>
  1228. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1229. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  1230. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  1231. </table>
  1232. <h3>Functions</h3>
  1233. <p>This object has no functions to call from the Arduino sketch. It
  1234. simply streams from it's 2 input ports to the USB.</p>
  1235. <!--
  1236. <h3>Hardware</h3>
  1237. -->
  1238. <h3>Examples</h3>
  1239. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WavFilePlayerUSB</p>
  1240. </p>
  1241. <h3>Notes</h3>
  1242. <p>Arduino's <b>Tools &gt; USB Type</b> menu must be set to <b>Audio</b>.
  1243. </p>
  1244. <p align=center><img src="img/usbtype_audio.png"></p>
  1245. <p>USB input &amp; output does not cause the Teensy Audio Library to
  1246. update. At least one non-USB input or output object must be
  1247. present for the entire library to update properly.</p>
  1248. <p>A known problem exists with USB audio from Macintosh computers.
  1249. 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
  1250. can be enabled by editing usb_audio.cpp</a>.
  1251. Find and uncomment "#define MACOSX_ADAPTIVE_LIMIT".</p>
  1252. </script>
  1253. <script type="text/x-red" data-template-name="AudioOutputUSB">
  1254. <div class="form-row">
  1255. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1256. <input type="text" id="node-input-name" placeholder="Name">
  1257. </div>
  1258. </script>
  1259. <script type="text/x-red" data-help-name="AudioMixer4">
  1260. <h3>Summary</h3>
  1261. <div class=tooltipinfo>
  1262. <p>Combine up to 4 audio signals together, each with adjustable gain.
  1263. All channels support signal attenuation or amplification.</p>
  1264. </div>
  1265. <h3>Audio Connections</h3>
  1266. <table class=doc align=center cellpadding=3>
  1267. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1268. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  1269. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  1270. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  1271. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  1272. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  1273. </table>
  1274. <h3>Functions</h3>
  1275. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  1276. <p class=desc>Adjust the amplification or attenuation. "channel" must
  1277. be 0 to 3. "level" may be any floating point number from 0 to 32767.0.
  1278. 1.0 passes the signal through directly. Level of 0 shuts the channel
  1279. off completely. Between 0 to 1.0 attenuates the signal, and above
  1280. 1.0 amplifies it. Negative numbers may also be used, to invert the
  1281. signal. All 4 channels have separate gain settings.
  1282. </p>
  1283. <h3>Examples</h3>
  1284. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  1285. </p>
  1286. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1287. </p>
  1288. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  1289. </p>
  1290. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  1291. </p>
  1292. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1293. </p>
  1294. <h3>Notes</h3>
  1295. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  1296. or when multiple signals add together to greater than 1.0.</p>
  1297. <p>More than 4 channels may be combined by connecting multiple mixers
  1298. in tandem. For example, a 16 channel mixer may be built using 5
  1299. mixers, where the fifth mixer combines the outputs of the first 4.
  1300. </p>
  1301. </script>
  1302. <script type="text/x-red" data-template-name="AudioMixer4">
  1303. <div class="form-row">
  1304. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1305. <input type="text" id="node-input-name" placeholder="Name">
  1306. </div>
  1307. </script>
  1308. <script type="text/x-red" data-help-name="AudioPlayMemory">
  1309. <h3>Summary</h3>
  1310. <div class=tooltipinfo>
  1311. <p>Play a short sound clip, stored directly in memory.
  1312. Data files are created with the
  1313. <a href="https://github.com/PaulStoffregen/Audio/tree/master/extras/wav2sketch" target="_blank">wav2sketch program</a>,
  1314. and copied to the sketch folder to become part of your sketch.</p>
  1315. </div>
  1316. <h3>Audio Connections</h3>
  1317. <table class=doc align=center cellpadding=3>
  1318. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1319. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1320. </table>
  1321. <h3>Functions</h3>
  1322. <p class=func><span class=keyword>play</span>(data);</p>
  1323. <p class=desc>Begin playing a sound clip. If already playing, the
  1324. currently playing clip is stopped and this new data begins
  1325. playing from the beginning.
  1326. </p>
  1327. <p class=func><span class=keyword>stop</span>();</p>
  1328. <p class=desc>Stop playing. If not playing, this function has no effect.
  1329. </p>
  1330. <p class=func><span class=keyword>isPlaying</span>();</p>
  1331. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1332. when not playing.
  1333. </p>
  1334. <p class=func><span class=keyword>positionMillis</span>();</p>
  1335. <p class=desc>While playing, return the current time offset, in
  1336. milliseconds. When not playing, the return from this function
  1337. is undefined.
  1338. </p>
  1339. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1340. <p class=desc>Return the total length of the current sound clip,
  1341. in milliseconds. When not playing, the return from this function
  1342. is undefined.
  1343. </p>
  1344. <h3>Examples</h3>
  1345. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  1346. </p>
  1347. <h3>Notes</h3>
  1348. <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>
  1349. running in Terminal on Macintosh.</p>
  1350. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  1351. <p>TODO: ulaw vs uncompressed encoding</p>
  1352. <p>Polyphonic playback can be built by creating multiple
  1353. objects, with their output combined by mixers.</p>
  1354. </script>
  1355. <script type="text/x-red" data-template-name="AudioPlayMemory">
  1356. <div class="form-row">
  1357. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1358. <input type="text" id="node-input-name" placeholder="Name">
  1359. </div>
  1360. </script>
  1361. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  1362. <h3>Summary</h3>
  1363. <div class=tooltipinfo>
  1364. <p>Play a WAV file, stored on a SD card.</p>
  1365. </div>
  1366. <h3>Audio Connections</h3>
  1367. <table class=doc align=center cellpadding=3>
  1368. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1369. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  1370. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  1371. </table>
  1372. <h3>Functions</h3>
  1373. <p class=func><span class=keyword>play</span>(filename);</p>
  1374. <p class=desc>Begin playing a WAV file. If a file is already playing,
  1375. it is stopped and this file starts playing from the beginning.
  1376. </p>
  1377. <p class=func><span class=keyword>stop</span>();</p>
  1378. <p class=desc>Stop playing. If not playing, this function has no effect.
  1379. </p>
  1380. <p class=func><span class=keyword>isPlaying</span>();</p>
  1381. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1382. when not playing. See the note below about delayed start.
  1383. </p>
  1384. <p class=func><span class=keyword>positionMillis</span>();</p>
  1385. <p class=desc>While playing, return the current time offset, in
  1386. milliseconds. When not playing, the return from this function
  1387. is undefined.
  1388. </p>
  1389. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1390. <p class=desc>Return the total length of the current sound clip,
  1391. in milliseconds. When not playing, the return from this function
  1392. is undefined.
  1393. </p>
  1394. <h3>Examples</h3>
  1395. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  1396. </p>
  1397. <h3>Notes</h3>
  1398. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  1399. files are played, both output ports transmit a copy of the
  1400. single sound. Of course, stereo WAV files play with the left
  1401. channel on port 0 and the right channel on port 1.
  1402. </p>
  1403. <p>A brief delay after calling play() will usually occur before
  1404. isPlaying() returns true and positionMillis() returns valid
  1405. time offset. WAV files have a header at the beginning of the
  1406. file, which the audio library must read and parse before
  1407. playing can begin.
  1408. </p>
  1409. <p>While playing, the audio library accesses the SD card automatically.
  1410. If card access is required, you must
  1411. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  1412. to prevent the library from accessing the SD card while you use it.
  1413. Disabling the audio library interrupt for too long may cause audible
  1414. dropouts or glitches.
  1415. </p>
  1416. <p>An experimental SD library optimization exists, which can remove these
  1417. SD library restrictions. It also allows reliable playback of more
  1418. files at the same time. To enable this special code, find and edit
  1419. the SD_t3.h file within your Arduino folder. See the comments within
  1420. that file for details.
  1421. </p>
  1422. </script>
  1423. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  1424. <div class="form-row">
  1425. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1426. <input type="text" id="node-input-name" placeholder="Name">
  1427. </div>
  1428. </script>
  1429. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  1430. <h3>Summary</h3>
  1431. <div class=tooltipinfo>
  1432. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  1433. than WAV and begins playing immediately, without parsing WAV file
  1434. header info.</p>
  1435. </div>
  1436. <h3>Audio Connections</h3>
  1437. <table class=doc align=center cellpadding=3>
  1438. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1439. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1440. </table>
  1441. <h3>Functions</h3>
  1442. <p class=func><span class=keyword>play</span>(filename);</p>
  1443. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  1444. it is stopped and this file starts playing from the beginning.
  1445. </p>
  1446. <p class=func><span class=keyword>stop</span>();</p>
  1447. <p class=desc>Stop playing. If not playing, this function has no effect.
  1448. </p>
  1449. <p class=func><span class=keyword>isPlaying</span>();</p>
  1450. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1451. when not playing.
  1452. </p>
  1453. <p class=func><span class=keyword>positionMillis</span>();</p>
  1454. <p class=desc>While playing, return the current time offset, in
  1455. milliseconds. When not playing, the return from this function
  1456. is undefined.
  1457. </p>
  1458. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1459. <p class=desc>Return the total length of the current sound clip,
  1460. in milliseconds. When not playing, the return from this function
  1461. is undefined.
  1462. </p>
  1463. <h3>Examples</h3>
  1464. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1465. </p>
  1466. <h3>Notes</h3>
  1467. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  1468. </p>
  1469. <p>While playing, the audio library accesses the SD card automatically.
  1470. If card access is required, you must
  1471. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1472. to prevent the library from accessing the SD card while you use it.
  1473. Disabling the audio library interrupt for too long may cause audible
  1474. dropouts or glitches.
  1475. </p>
  1476. </script>
  1477. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  1478. <div class="form-row">
  1479. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1480. <input type="text" id="node-input-name" placeholder="Name">
  1481. </div>
  1482. </script>
  1483. <script type="text/x-red" data-help-name="AudioPlaySerialflashRaw">
  1484. <h3>Summary</h3>
  1485. <div class=tooltipinfo>
  1486. <p>Play a RAW data file, stored on a Serial Flash chip. These chips
  1487. are far more efficient than SD cards, allowing many files to be
  1488. played simultaneously by copies of this object.
  1489. </p>
  1490. <p align=center><img src="img/w25q128fv.jpg"><br><small>W25Q128FV Serial Flash</small></p>
  1491. </div>
  1492. <h3>Audio Connections</h3>
  1493. <table class=doc align=center cellpadding=3>
  1494. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1495. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1496. </table>
  1497. <h3>Functions</h3>
  1498. <p class=func><span class=keyword>play</span>(filename);</p>
  1499. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  1500. it is stopped and this file starts playing from the beginning.
  1501. </p>
  1502. <p class=func><span class=keyword>stop</span>();</p>
  1503. <p class=desc>Stop playing. If not playing, this function has no effect.
  1504. </p>
  1505. <p class=func><span class=keyword>isPlaying</span>();</p>
  1506. <p class=desc>Return true (non-zero) if playing, or false (zero)
  1507. when not playing.
  1508. </p>
  1509. <p class=func><span class=keyword>positionMillis</span>();</p>
  1510. <p class=desc>While playing, return the current time offset, in
  1511. milliseconds. When not playing, the return from this function
  1512. is undefined.
  1513. </p>
  1514. <p class=func><span class=keyword>lengthMillis</span>();</p>
  1515. <p class=desc>Return the total length of the current sound clip,
  1516. in milliseconds. When not playing, the return from this function
  1517. is undefined.
  1518. </p>
  1519. <h3>Examples</h3>
  1520. <!--
  1521. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1522. -->
  1523. <p class=exam>TODO: play example needed....
  1524. </p>
  1525. <p class=exam>File &gt; Examples &gt; SerialFlash &gt; CopyFromSD
  1526. </p>
  1527. <h3>Notes</h3>
  1528. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  1529. </p>
  1530. <p>The <a href="https://github.com/PaulStoffregen/SerialFlash" target="_blank">SerialFlash library</a>
  1531. is used to access the flash chip. You can also use SerialFlash's functions
  1532. to access the stored files, or add data to the flash chip.
  1533. </p>
  1534. <p>File names are case sensitive with SerialFlash. If your sound does
  1535. not play, use <b>File &gt; Examples &gt; SerialFlash &gt; ListFiles</b> to
  1536. check the exact file names stored in the flash memory chip.
  1537. </script>
  1538. <script type="text/x-red" data-template-name="AudioPlaySerialflashRaw">
  1539. <div class="form-row">
  1540. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1541. <input type="text" id="node-input-name" placeholder="Name">
  1542. </div>
  1543. </script>
  1544. <script type="text/x-red" data-help-name="AudioPlayQueue">
  1545. <h3>Summary</h3>
  1546. <div class=tooltipinfo>
  1547. <p>Play audio data provided by the Arduino sketch. This object provides
  1548. functions to allow the sketch code to push data into the audio system.</p>
  1549. </div>
  1550. <h3>Audio Connections</h3>
  1551. <table class=doc align=center cellpadding=3>
  1552. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1553. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1554. </table>
  1555. <h3>Functions</h3>
  1556. <p class=func><span class=keyword>play</span>(int16);</p>
  1557. <p class=desc>not yet implemented
  1558. </p>
  1559. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  1560. <p class=desc>not yet implemented
  1561. </p>
  1562. <p class=func><span class=keyword>getBuffer</span>();</p>
  1563. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  1564. is within the audio library memory pool, providing the most efficient
  1565. way to input data to the audio system. The buffer is likely to be
  1566. populated by previously used data, so the entire 128 words should be
  1567. written before calling playBuffer(). Only a single buffer should be
  1568. requested at a time. This function may return NULL if no memory is
  1569. available.
  1570. </p>
  1571. <p class=func><span class=keyword>playBuffer</span>();</p>
  1572. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  1573. </p>
  1574. <h3>Examples</h3>
  1575. <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>
  1576. </p>
  1577. <!--
  1578. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1579. </p>
  1580. -->
  1581. <h3>Notes</h3>
  1582. <p>TODO: many caveats....</p>
  1583. <p>
  1584. </p>
  1585. </script>
  1586. <script type="text/x-red" data-template-name="AudioPlayQueue">
  1587. <div class="form-row">
  1588. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1589. <input type="text" id="node-input-name" placeholder="Name">
  1590. </div>
  1591. </script>
  1592. <script type="text/x-red" data-help-name="AudioRecordQueue">
  1593. <h3>Summary</h3>
  1594. <div class=tooltipinfo>
  1595. <p>Record audio data by sending to the Arduino sketch. This object allows
  1596. sketch code to receive audio packets.</p>
  1597. </div>
  1598. <h3>Audio Connections</h3>
  1599. <table class=doc align=center cellpadding=3>
  1600. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1601. <tr class=odd><td align=center>In 0</td><td>Sound To Access</td></tr>
  1602. </table>
  1603. <h3>Functions</h3>
  1604. <p class=func><span class=keyword>begin</span>();</p>
  1605. <p class=desc>Begin capturing incoming audio to the queue. After calling
  1606. begin, readBuffer() and freeBuffer(), or clear() must be used frequently
  1607. to prevent the queue from filling up.
  1608. </p>
  1609. <p class=func><span class=keyword>available</span>();</p>
  1610. <p class=desc>Returns the number of audio packets available to read.
  1611. </p>
  1612. <p class=func><span class=keyword>readBuffer</span>();</p>
  1613. <p class=desc>Read a single audio packet. A pointer to a 128 sample
  1614. array of 16 bit integers is returned. NULL is returned if no packets
  1615. are available.
  1616. </p>
  1617. <p class=func><span class=keyword>freeBuffer</span>();</p>
  1618. <p class=desc>Release the memory from the previously read packet returned
  1619. from readBuffer(). Only a single packet at a time may be read, and
  1620. each packet must be freed with this function, to return the memory to
  1621. the audio library.
  1622. </p>
  1623. <p class=func><span class=keyword>clear</span>();</p>
  1624. <p class=desc>Discard all audio held in the queue.
  1625. </p>
  1626. <p class=func><span class=keyword>end</span>();</p>
  1627. <p class=desc>Stop capturing incoming audio into the queue. Data already
  1628. captured remains in the queue and may be read with readBuffer().
  1629. </p>
  1630. <h3>Examples</h3>
  1631. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1632. </p>
  1633. <h3>Notes</h3>
  1634. <p>
  1635. Up to 52 packets may be queued by this object, which allows approximately
  1636. 150 ms of audio to be held in the queue, to allow time for the Arduino
  1637. sketch to write data to media or do other high-latency tasks.
  1638. The actual packets are taken
  1639. from the pool created by AudioMemory().
  1640. </p>
  1641. </script>
  1642. <script type="text/x-red" data-template-name="AudioRecordQueue">
  1643. <div class="form-row">
  1644. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1645. <input type="text" id="node-input-name" placeholder="Name">
  1646. </div>
  1647. </script>
  1648. <script type="text/x-red" data-help-name="AudioSynthSimpleDrum">
  1649. <h3>Summary</h3>
  1650. <div class=tooltipinfo>
  1651. <p>Generate a synthesised drum sound. Also useful for laser pistol and bursting
  1652. bubble sound effects.</p>
  1653. </div>
  1654. <h3>Audio Connections</h3>
  1655. <table class=doc align=center cellpadding=3>
  1656. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1657. <tr class=odd><td align=center>Out 0</td><td>Drum Tone Output</td></tr>
  1658. </table>
  1659. <h3>Functions</h3>
  1660. <p class=func><span class=keyword>noteOn</span>();</p>
  1661. <p class=desc>Trigger the drum.
  1662. </p>
  1663. <p class=func><span class=keyword>frequency</span>(frequency);</p>
  1664. <p class=desc>Set the base frequency of the drum.
  1665. </p>
  1666. <p class=func><span class=keyword>length</span>(milliseconds);</p>
  1667. <p class=desc>Set the duration of the envelope, in milliseconds.
  1668. </p>
  1669. <p class=func><span class=keyword>secondMix</span>(level);</p>
  1670. <p class=desc>Emulates a two-headed tom, by adding a second sine wave that is
  1671. harmonized a perfect fifth above
  1672. the base frequency. Using this involves a slight CPU penalty.
  1673. </p>
  1674. <p class=func><span class=keyword>pitchMod</span>(depth);</p>
  1675. <p class=desc>Set the depth of envelope of the pitch, by a maximum of two octaves.
  1676. Default is 0.5, with no modulation. Values above 0.5 cause the pitch to sweep
  1677. downwards, values lower than 0.5 cause the pitch to sweep upwards.
  1678. </p>
  1679. <h3>Examples</h3>
  1680. <p class=exam>File &gt; Examples &gt; Synthesis &gt; SimpleDrum
  1681. </p>
  1682. <h3>Notes</h3>
  1683. <p></p>
  1684. </script>
  1685. <script type="text/x-red" data-template-name="AudioSynthSimpleDrum">
  1686. <div class="form-row">
  1687. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1688. <input type="text" id="node-input-name" placeholder="Name">
  1689. </div>
  1690. </script>
  1691. <script type="text/x-red" data-help-name="AudioSynthKarplusStrong">
  1692. <h3>Summary</h3>
  1693. <div class=tooltipinfo>
  1694. <p>Synthesize a plucked string sound, such as a guitar string.
  1695. </p>
  1696. <p align=center><img src="img/touchguitar.jpg"></p>
  1697. </div>
  1698. <h3>Audio Connections</h3>
  1699. <table class=doc align=center cellpadding=3>
  1700. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1701. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1702. </table>
  1703. <h3>Functions</h3>
  1704. <p class=func><span class=keyword>noteOn</span>(frequency, velocity);</p>
  1705. <p class=desc>Begin a new string note. Velocity can be from 0 to 1.0,
  1706. indicating how hard the string is plucked.
  1707. </p>
  1708. <p class=func><span class=keyword>noteOff</span>(velocity);</p>
  1709. <p class=desc>Stop the sound output.
  1710. </p>
  1711. <h3>Examples</h3>
  1712. <p class=exam>File &gt; Examples &gt; Synthesis &gt; Guitar
  1713. </p>
  1714. <p class=exam><a href="https://github.com/PaulStoffregen/TouchGuitar" target="_blank">TouchGuitar</a>
  1715. </p>
  1716. <h3>Notes</h3>
  1717. <p></p>
  1718. </script>
  1719. <script type="text/x-red" data-template-name="AudioSynthSimpleDrum">
  1720. <div class="form-row">
  1721. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1722. <input type="text" id="node-input-name" placeholder="Name">
  1723. </div>
  1724. </script>
  1725. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  1726. <h3>Summary</h3>
  1727. <div class=tooltipinfo>
  1728. <p>Create a sine wave signal</p>
  1729. </div>
  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>Out 0</td><td>Sine Wave Output</td></tr>
  1734. </table>
  1735. <h3>Functions</h3>
  1736. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1737. <p class=desc>Set the amplitude, from 0 to 1.0.
  1738. </p>
  1739. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1740. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  1741. be used to create a LFO (Low Frequency Oscillator) for objects
  1742. with modulation signal inputs.
  1743. </p>
  1744. <p class=func><span class=keyword>phase</span>(angle);</p>
  1745. <p class=desc>
  1746. Cause the generated waveform to jump to a specific point within
  1747. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1748. are configured,
  1749. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1750. should be used to guarantee all new settings take effect together.
  1751. </p>
  1752. <h3>Examples</h3>
  1753. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1754. </p>
  1755. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  1756. </p>
  1757. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  1758. </p>
  1759. <h3>Notes</h3>
  1760. <p></p>
  1761. </script>
  1762. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  1763. <div class="form-row">
  1764. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1765. <input type="text" id="node-input-name" placeholder="Name">
  1766. </div>
  1767. </script>
  1768. <script type="text/x-red" data-help-name="AudioSynthWaveformSineHires">
  1769. <h3>Summary</h3>
  1770. <div class=tooltipinfo>
  1771. <p>Create a highly precise, low distortion sine wave signal.
  1772. Mainly useful for codec &amp; analog circuitry testing.</p>
  1773. </div>
  1774. <h3>Audio Connections</h3>
  1775. <table class=doc align=center cellpadding=3>
  1776. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1777. <tr class=odd><td align=center>Out 0</td><td>Sine Wave, upper bits</td></tr>
  1778. <tr class=odd><td align=center>Out 1</td><td>Sine Wave, lower bits</td></tr>
  1779. </table>
  1780. <h3>Functions</h3>
  1781. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1782. <p class=desc>Set the amplitude, from 0 to 1.0.
  1783. </p>
  1784. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1785. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  1786. be used to create a LFO (Low Frequency Oscillator) for objects
  1787. with modulation signal inputs.
  1788. </p>
  1789. <p class=func><span class=keyword>phase</span>(angle);</p>
  1790. <p class=desc>
  1791. Cause the generated waveform to jump to a specific point within
  1792. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1793. are configured,
  1794. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1795. should be used to guarantee all new settings take effect together.
  1796. </p>
  1797. <h3>Notes</h3>
  1798. <p>An 11th order Taylor series approximation is used to generate
  1799. a very accurate sine wave. At least the upper 25 bits are believe
  1800. to be perfect. This is mainly intended for testing 24 bit codec chips!</p>
  1801. </script>
  1802. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  1803. <div class="form-row">
  1804. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1805. <input type="text" id="node-input-name" placeholder="Name">
  1806. </div>
  1807. </script>
  1808. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  1809. <h3>Summary</h3>
  1810. <div class=tooltipinfo>
  1811. <p>Create a modulated sine wave, using any audio signal to continuously
  1812. modulate the sine wave frequency.</p>
  1813. </div>
  1814. <h3>Audio Connections</h3>
  1815. <table class=doc align=center cellpadding=3>
  1816. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1817. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  1818. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  1819. </table>
  1820. <h3>Functions</h3>
  1821. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1822. <p class=desc>Set the amplitude, from 0 to 1.0.
  1823. </p>
  1824. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1825. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  1826. be this center frequency when the input modulation signal is zero.
  1827. Modulation input 1.0 causes the frequency to double, and input -1.0
  1828. causes zero Hz (DC) output. For less modulation, attenuate the input
  1829. signal (perhaps with a mixer object) before it arrives here.
  1830. </p>
  1831. <p class=func><span class=keyword>phase</span>(angle);</p>
  1832. <p class=desc>
  1833. Cause the generated waveform to jump to a specific point within
  1834. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1835. are configured,
  1836. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1837. should be used to guarantee all new settings take effect together.
  1838. </p>
  1839. <!--
  1840. <h3>Examples</h3>
  1841. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1842. </p>
  1843. -->
  1844. <h3>Notes</h3>
  1845. <p></p>
  1846. </script>
  1847. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  1848. <div class="form-row">
  1849. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1850. <input type="text" id="node-input-name" placeholder="Name">
  1851. </div>
  1852. </script>
  1853. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  1854. <h3>Summary</h3>
  1855. <div class=tooltipinfo>
  1856. <p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</p>
  1857. </div>
  1858. <h3>Audio Connections</h3>
  1859. <table class=doc align=center cellpadding=3>
  1860. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1861. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  1862. </table>
  1863. <h3>Functions</h3>
  1864. <p class=func><span class=keyword>begin</span>(waveform);</p>
  1865. <p class=desc>Configure the waveform type to create.
  1866. </p>
  1867. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  1868. <p class=desc>Output a waveform, and set the amplitude and frequency.
  1869. </p>
  1870. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1871. <p class=desc>Change the frequency.
  1872. </p>
  1873. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1874. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  1875. </p>
  1876. <p class=func><span class=keyword>phase</span>(angle);</p>
  1877. <p class=desc>
  1878. Cause the generated waveform to jump to a specific point within
  1879. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1880. are configured,
  1881. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1882. should be used to guarantee all new settings take effect together.
  1883. </p>
  1884. <p class=func><span class=keyword>pulseWidth</span>(amount);</p>
  1885. <p class=desc>Change the width (duty cycle) of the pulse.</p>
  1886. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  1887. <p class=desc>
  1888. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  1889. must be an array of 256 samples. Currently, the data is used
  1890. without any filtering, which can cause aliasing with frequencies
  1891. above 172 Hz. For higher frequency output, you must bandwidth
  1892. limit your waveform data. Someday, "maxFreq" will be used to
  1893. do this automatically.
  1894. </p>
  1895. <h3>Examples</h3>
  1896. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1897. </p>
  1898. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1899. </p>
  1900. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  1901. </p>
  1902. <h3>Notes</h3>
  1903. <p>Supported Waveforms:<br>
  1904. <ul>
  1905. <li><span class=literal>WAVEFORM_SINE</span></li>
  1906. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  1907. <li><span class=literal>WAVEFORM_SAWTOOTH_REVERSE</span></li>
  1908. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  1909. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  1910. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  1911. <li><span class=literal>WAVEFORM_PULSE</span></li>
  1912. <li><span class=literal>WAVEFORM_SAMPLE_HOLD</span></li>
  1913. </ul>
  1914. </p>
  1915. </script>
  1916. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  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="AudioSynthWaveformPWM">
  1923. <h3>Summary</h3>
  1924. <div class=tooltipinfo>
  1925. <p>Create a Pulse Width Modulated waveform, with an audio signal
  1926. controlling the pulse width duty cycle.</p>
  1927. <p align=center><img src="img/pwm.png"></p>
  1928. </div>
  1929. <h3>Audio Connections</h3>
  1930. <table class=doc align=center cellpadding=3>
  1931. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1932. <tr class=odd><td align=center>In 0</td><td>Control Signal Output</td></tr>
  1933. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  1934. </table>
  1935. <p>The duty cycle is 50% when the control waveform is zero.
  1936. As the control input causes a linear changes in PWM duty
  1937. cycle, from nearly 0 to 100% over -1.0 to +1.0 range.
  1938. See the notes below for minimum and maximum limitations.
  1939. </p>
  1940. <h3>Functions</h3>
  1941. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1942. <p class=desc>Change the frequency.
  1943. </p>
  1944. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1945. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  1946. </p>
  1947. <h3>Examples</h3>
  1948. <p class=exam>TODO, examples needed
  1949. </p>
  1950. <h3>Notes</h3>
  1951. <p>The maximum duty cycle is 65536 samples high followed by
  1952. one sample low (99.9985%) and the minimum duty cycle is
  1953. 1 sample high followed by 65536 samples low (0.00153%).
  1954. </p>
  1955. </script>
  1956. <script type="text/x-red" data-template-name="AudioSynthWaveformPWM">
  1957. <div class="form-row">
  1958. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1959. <input type="text" id="node-input-name" placeholder="Name">
  1960. </div>
  1961. </script>
  1962. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  1963. <h3>Summary</h3>
  1964. <div class=tooltipinfo>
  1965. <p>Create a continuously varying (in frequency) sine wave</p>
  1966. </div>
  1967. <h3>Audio Connections</h3>
  1968. <table class=doc align=center cellpadding=3>
  1969. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1970. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  1971. </table>
  1972. <h3>Functions</h3>
  1973. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  1974. <p class=desc>Start generating frequency sweep output. The time is specified
  1975. in milliseconds. Level is 0 to 1.0.
  1976. </p>
  1977. <p class=func><span class=keyword>isPlaying</span>();</p>
  1978. <p class=desc>Returns true (non-zero) while the output is active.
  1979. </p>
  1980. <h3>Examples</h3>
  1981. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; ToneSweep
  1982. </p>
  1983. <h3>Notes</h3>
  1984. <p>Uses excessive CPU time</p>
  1985. </script>
  1986. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  1987. <div class="form-row">
  1988. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1989. <input type="text" id="node-input-name" placeholder="Name">
  1990. </div>
  1991. </script>
  1992. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  1993. <h3>Summary</h3>
  1994. <div class=tooltipinfo>
  1995. <p>Create constant (DC) signal, useful for control of objects that take
  1996. a modulation or control input signal. This constant level can be
  1997. used to modify other waveforms using mixer or multiplier objects</p>
  1998. </div>
  1999. <h3>Audio Connections</h3>
  2000. <table class=doc align=center cellpadding=3>
  2001. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2002. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  2003. </table>
  2004. <h3>Functions</h3>
  2005. <p class=func><span class=keyword>amplitude</span>(level);</p>
  2006. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  2007. changed immediately.
  2008. </p>
  2009. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  2010. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  2011. gradually changed over a "milliseconds" time period. Any time may
  2012. be specified, but periods longer than 1 second may be automatically
  2013. shortened for small level changes, due to numerical precision limits.
  2014. </p>
  2015. <p class=func><span class=keyword>read</span>();</p>
  2016. <p class=desc>Read the current level. Returns -1.0 to 1.0. This can be
  2017. useful for monitoring the amplitude after configuring a slow change.
  2018. </p>
  2019. <!--
  2020. <h3>Examples</h3>
  2021. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2022. </p>
  2023. -->
  2024. <h3>Notes</h3>
  2025. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  2026. to a pure digital stream of numerical values. But the term is widely
  2027. understood in audio applications, so hopefully it's not too confusing?</p>
  2028. </script>
  2029. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  2030. <div class="form-row">
  2031. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2032. <input type="text" id="node-input-name" placeholder="Name">
  2033. </div>
  2034. </script>
  2035. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  2036. <h3>Summary</h3>
  2037. <div class=tooltipinfo>
  2038. <p>Create white noise.
  2039. </p>
  2040. <p align=center><img src="img/whitenoise.png"></p>
  2041. </div>
  2042. <h3>Audio Connections</h3>
  2043. <table class=doc align=center cellpadding=3>
  2044. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2045. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  2046. </table>
  2047. <h3>Functions</h3>
  2048. <p class=func><span class=keyword>amplitude</span>(level);</p>
  2049. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  2050. The default is off. Noise is generated only after setting
  2051. to a non-zero level.
  2052. </p>
  2053. <h3>Examples</h3>
  2054. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2055. </p>
  2056. <h3>Notes</h3>
  2057. <p>Setting the amplitude to zero causes this object to stop using
  2058. CPU time to generate random numbers.
  2059. </p>
  2060. </script>
  2061. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  2062. <div class="form-row">
  2063. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2064. <input type="text" id="node-input-name" placeholder="Name">
  2065. </div>
  2066. </script>
  2067. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  2068. <h3>Summary</h3>
  2069. <div class=tooltipinfo>
  2070. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  2071. </p>
  2072. <!--
  2073. <p align=center><img src="img/whitenoise.png"></p>
  2074. -->
  2075. </div>
  2076. <h3>Audio Connections</h3>
  2077. <table class=doc align=center cellpadding=3>
  2078. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2079. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  2080. </table>
  2081. <h3>Functions</h3>
  2082. <p class=func><span class=keyword>amplitude</span>(level);</p>
  2083. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  2084. The default is off. Noise is generated only after setting
  2085. to a non-zero level.
  2086. </p>
  2087. <h3>Examples</h3>
  2088. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2089. </p>
  2090. <h3>Notes</h3>
  2091. <p>Setting the amplitude to zero causes this object to stop using
  2092. CPU time. CPU usage is approx 3% on Teensy 3.1.
  2093. </p>
  2094. <p>Stefan Stenzel's
  2095. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  2096. algorithm. Stefan's terms of use are "Use for any purpose. If used
  2097. in a commercial product, you should give me one."
  2098. </p>
  2099. </script>
  2100. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  2101. <div class="form-row">
  2102. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2103. <input type="text" id="node-input-name" placeholder="Name">
  2104. </div>
  2105. </script>
  2106. <script type="text/x-red" data-help-name="AudioEffectFade">
  2107. <h3>Summary</h3>
  2108. <div class=tooltipinfo>
  2109. <p>Gradually increase or decrease audio level.</p>
  2110. </div>
  2111. <h3>Audio Connections</h3>
  2112. <table class=doc align=center cellpadding=3>
  2113. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2114. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2115. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  2116. </table>
  2117. <h3>Functions</h3>
  2118. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  2119. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  2120. directly to the output) after "milliseconds" time.
  2121. </p>
  2122. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  2123. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  2124. after "milliseconds" time.
  2125. </p>
  2126. <!--
  2127. <h3>Examples</h3>
  2128. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2129. </p>
  2130. -->
  2131. <h3>Notes</h3>
  2132. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  2133. When one fade object is off (fully faded out) and the other on
  2134. (fully faded in), if both are started at the same moment for the
  2135. same time duration, their signal gains always add to 1.0. This
  2136. allows 2 fade objects to work together for a smooth transition
  2137. between a pair of signals.
  2138. </p>
  2139. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  2140. should be used when changing
  2141. settings on multiple objects, so all changes always take effect
  2142. at the same moment.
  2143. </p>
  2144. </script>
  2145. <script type="text/x-red" data-template-name="AudioEffectFade">
  2146. <div class="form-row">
  2147. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2148. <input type="text" id="node-input-name" placeholder="Name">
  2149. </div>
  2150. </script>
  2151. <script type="text/x-red" data-help-name="AudioEffectChorus">
  2152. <h3>Summary</h3>
  2153. <div class=tooltipinfo>
  2154. <p>The chorus effect simulates the richness of several nearly-identical
  2155. sound sources (like the way a choir sounds different to a single singer).
  2156. It does this by sampling from a delay line, so each voice is actually
  2157. the same but at a slightly different point in time. This is a type of
  2158. comb filtering.</p>
  2159. </div>
  2160. <p>Chorus combines one or more samples ranging from the most recent
  2161. sample back to about 50ms ago. The additional samples are evenly spread
  2162. through the supplied delay line, and there is no modulation.</p>
  2163. <p>If the number of voices is specified as 2, then the
  2164. effect combines the current sample and the oldest sample (the last one
  2165. in the delay line). If the number of voices is 3 then the effect combines
  2166. the most recent sample, the oldest sample and the sample in the middle of
  2167. the delay line.</p>
  2168. <p>For two voices the effect can be represented as:<br/>
  2169. result = (sample(0) + sample(dt))/2<br/>
  2170. where sample(0) represents the current sample and sample(dt)
  2171. is the sample in the delay line from dt milliseconds ago.</p>
  2172. <h3>Audio Connections</h3>
  2173. <table class=doc align=center cellpadding=3>
  2174. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  2175. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  2176. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  2177. </table>
  2178. <h3>Functions</h3>
  2179. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  2180. <p class=desc>Create a chorus by specifying the address of the delayline, the
  2181. total number of samples in the delay line (often done as an integer multiple of
  2182. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  2183. the original voice (so, 2 and up to get a chorus effect, although you can
  2184. specify 1 if you want).
  2185. </p>
  2186. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  2187. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  2188. </p>
  2189. <h3>Examples</h3>
  2190. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  2191. </p>
  2192. <h3>Notes</h3>
  2193. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  2194. </script>
  2195. <script type="text/x-red" data-template-name="AudioEffectChorus">
  2196. <div class="form-row">
  2197. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2198. <input type="text" id="node-input-name" placeholder="Name">
  2199. </div>
  2200. </script>
  2201. <script type="text/x-red" data-help-name="AudioEffectFlange">
  2202. <h3>Summary</h3>
  2203. <div class=tooltipinfo>
  2204. <p>Originally, flanging was produced by playing the same signal on two synchronized
  2205. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  2206. pressing on the flange of the reel (hence the name). This is a type of
  2207. comb filtering, and produces a harmonically-related series of peaks and notches
  2208. in the audio spectrum.</p>
  2209. </div>
  2210. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  2211. line, but the position of that sample varies sinusoidally.</p>
  2212. <p>The effect can be represented as:<br>
  2213. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  2214. <p>The value of the sine function is always a number from -1 to +1 and
  2215. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  2216. Thus, the delayed sample will be selected from the range (dt-depth) to
  2217. (dt+depth). This selection will vary at whatever rate is specified as the
  2218. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  2219. <h3>Audio Connections</h3>
  2220. <table class=doc align=center cellpadding=3>
  2221. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  2222. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  2223. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  2224. </table>
  2225. <h3>Functions</h3>
  2226. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  2227. <p class=desc>Create a flanger by specifying the address of the delayline, the
  2228. total number of samples in the delay line (often done as an integer multiple of
  2229. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  2230. the modulation depth (larger values give a greater variation) and the modulation
  2231. frequency, in Hertz.
  2232. </p>
  2233. <p class=func><span class=keyword>voices</span>(offset, depth, delayRate);</p>
  2234. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  2235. </p>
  2236. <h3>Examples</h3>
  2237. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  2238. </p>
  2239. <h3>Notes</h3>
  2240. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  2241. <p>Try these settings:<br>
  2242. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  2243. and<br>
  2244. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  2245. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  2246. double s_freq = 3;</p>
  2247. <p>The flange effect can also produce a chorus-like effect if a longer
  2248. delay line is used with a slower modulation rate, for example try:<br>
  2249. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  2250. and<br>
  2251. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  2252. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  2253. double s_freq = .0625;</p>
  2254. </script>
  2255. <script type="text/x-red" data-template-name="AudioEffectFlange">
  2256. <div class="form-row">
  2257. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2258. <input type="text" id="node-input-name" placeholder="Name">
  2259. </div>
  2260. </script>
  2261. <script type="text/x-red" data-help-name="AudioEffectReverb">
  2262. <h3>Summary</h3>
  2263. <div class=tooltipinfo>
  2264. <p>Reverb with adjustable reverberation time. Contributed by Joao Rossi FIlho.
  2265. </p>
  2266. </div>
  2267. <h3>Audio Connections</h3>
  2268. <table class=doc align=center cellpadding=3>
  2269. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  2270. <tr class="odd"><td align="center">In 0</td><td>Input</td></tr>
  2271. <tr class="odd"><td align="center">Out 0</td><td>Output</td></tr>
  2272. </table>
  2273. <h3>Functions</h3>
  2274. <p class=func><span class=keyword>reverbTime</span>(seconds);</p>
  2275. <p class=desc>Sets the amount of reverberation time.
  2276. </p>
  2277. <h3>Examples</h3>
  2278. <p><a href="https://twitter.com/joaorossifilho/status/779737126841753601">Video Demo</a>
  2279. </p>
  2280. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  2281. </p>-->
  2282. <h3>Notes</h3>
  2283. <p>This effect may have distortion problems with the input signal is more than 0.5.</p>
  2284. </script>
  2285. <script type="text/x-red" data-template-name="AudioEffectReverb">
  2286. <div class="form-row">
  2287. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2288. <input type="text" id="node-input-name" placeholder="Name">
  2289. </div>
  2290. </script>
  2291. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  2292. <h3>Summary</h3>
  2293. <div class=tooltipinfo>
  2294. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  2295. Release) envelope.
  2296. </p>
  2297. <p align=center><img src="img/dahdsr.png"></p>
  2298. </div>
  2299. <h3>Audio Connections</h3>
  2300. <table class=doc align=center cellpadding=3>
  2301. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2302. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2303. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  2304. </table>
  2305. <h3>Functions</h3>
  2306. <p class=func><span class=keyword>noteOn</span>();</p>
  2307. <p class=desc>Begin the delay to attack, or the attack phase is
  2308. delay is zero.
  2309. </p>
  2310. <p class=func><span class=keyword>noteOff</span>();</p>
  2311. <p class=desc>Begin the release phase.
  2312. </p>
  2313. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  2314. <p class=desc>Set the delay from noteOn to the attach phase. The
  2315. default is zero, for no delay.
  2316. </p>
  2317. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  2318. <p class=desc>Set the attack time. The default is 10.5 milliseconds.
  2319. </p>
  2320. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  2321. <p class=desc>Set the hold time. The default is 2.5 milliseconds.
  2322. </p>
  2323. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  2324. <p class=desc>Set the decay time. The default is 35 milliseconds.
  2325. </p>
  2326. <p class=func><span class=keyword>sustain</span>(level);</p>
  2327. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  2328. gain will be maintained at this level after the decay phase,
  2329. until noteOff() is called.
  2330. </p>
  2331. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  2332. <p class=desc>Set the release time. The default is 300 millisecond.
  2333. </p>
  2334. <p class=func><span class=keyword>releaseNoteOn</span>(milliseconds);</p>
  2335. <p class=desc>Set a quick release time to be used when a new note is
  2336. started while the envelop is in any state passing the signal.
  2337. This will add latency before your new attack phase begins, so
  2338. short times are recommended. Zero may be used to completely
  2339. disable this feature (never extra latency). Longer times help
  2340. reduce clicks or pops. The default is 5 millisecond.
  2341. </p>
  2342. <h3>Examples</h3>
  2343. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  2344. </p>
  2345. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  2346. </p>
  2347. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2348. </p>
  2349. <h3>Notes</h3>
  2350. <p>To achieve the more common ADSR shape, simply
  2351. set delay and hold to zero.</p>
  2352. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  2353. milliseconds. Up to 200 ms can be used, with somewhat reduced
  2354. accuracy</p>
  2355. </script>
  2356. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  2357. <div class="form-row">
  2358. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2359. <input type="text" id="node-input-name" placeholder="Name">
  2360. </div>
  2361. </script>
  2362. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  2363. <h3>Summary</h3>
  2364. <div class=tooltipinfo>
  2365. <p>Multiply two signals together, useful for amplitude modulation
  2366. or "voltage controlled amplification".
  2367. </p>
  2368. <p align=center><img src="img/multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  2369. </div>
  2370. <h3>Audio Connections</h3>
  2371. <table class=doc align=center cellpadding=3>
  2372. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2373. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2374. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  2375. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  2376. </table>
  2377. <h3>Functions</h3>
  2378. <p>There are no functions to call from the Arduino sketch.
  2379. This object simply multiplies the 2 signals to create
  2380. a continuous output
  2381. </p>
  2382. <!--
  2383. <h3>Examples</h3>
  2384. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2385. </p>
  2386. -->
  2387. <h3>Notes</h3>
  2388. <p>
  2389. </p>
  2390. </script>
  2391. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  2392. <div class="form-row">
  2393. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2394. <input type="text" id="node-input-name" placeholder="Name">
  2395. </div>
  2396. </script>
  2397. <script type="text/x-red" data-help-name="AudioEffectDelay">
  2398. <h3>Summary</h3>
  2399. <div class=tooltipinfo>
  2400. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  2401. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  2402. </div>
  2403. <h3>Audio Connections</h3>
  2404. <table class=doc align=center cellpadding=3>
  2405. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2406. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2407. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  2408. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  2409. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  2410. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  2411. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  2412. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  2413. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  2414. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  2415. </table>
  2416. <h3>Functions</h3>
  2417. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  2418. <p class=desc>Set output channel (0 to 7) to delay the signals by
  2419. milliseconds. The maximum delay is approx 425 ms. The actual delay
  2420. is rounded to the nearest sample. Each channel can be configured for
  2421. any delay. There is no requirement to configure the "taps" in increasing
  2422. delay order.
  2423. </p>
  2424. <p class=func><span class=keyword>disable</span>(channel);</p>
  2425. <p class=desc>Disable a channel. The output of this channel becomes
  2426. silent. If this channel is the longest delay, memory usage is
  2427. automatically reduced to accomodate only the remaining channels used.
  2428. </p>
  2429. <h3>Examples</h3>
  2430. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  2431. </p>
  2432. <h3>Notes</h3>
  2433. <p>Memory for the delayed signal is take from the memory pool allocated by
  2434. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  2435. Each block allows about 3 milliseconds of delay, so AudioMemory
  2436. should be increased to allow for the longest delay tap.
  2437. </p>
  2438. </script>
  2439. <script type="text/x-red" data-template-name="AudioEffectDelay">
  2440. <div class="form-row">
  2441. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2442. <input type="text" id="node-input-name" placeholder="Name">
  2443. </div>
  2444. </script>
  2445. <script type="text/x-red" data-help-name="AudioEffectDelayExternal">
  2446. <h3>Summary</h3>
  2447. <div class=tooltipinfo>
  2448. <p>Delay a signal, using external memory for longer delay times! Up to 8 separate delay taps can be used.</p>
  2449. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  2450. </div>
  2451. <h3>Audio Connections</h3>
  2452. <table class=doc align=center cellpadding=3>
  2453. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2454. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2455. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  2456. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  2457. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  2458. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  2459. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  2460. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  2461. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  2462. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  2463. </table>
  2464. <h3>Functions</h3>
  2465. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  2466. <p class=desc>Set output channel (0 to 7) to delay the signals by
  2467. milliseconds. The maximum delay is approx 1.5 seconds for each 23LC1024 chip.
  2468. The actual delay
  2469. is rounded to the nearest sample. Each channel can be configured for
  2470. any delay. There is no requirement to configure the "taps" in increasing
  2471. delay order.
  2472. </p>
  2473. <p class=func><span class=keyword>disable</span>(channel);</p>
  2474. <p class=desc>Disable a channel. The output of this channel becomes
  2475. silent. If this channel is the longest delay, memory usage is
  2476. automatically reduced to accomodate only the remaining channels used.
  2477. </p>
  2478. <h3>Hardware</h3>
  2479. <p>By default, or when <span class=literal>AUDIO_MEMORY_23LC1024</span> is used (see below),
  2480. a single 23LC1024 RAM chip is used, with these pins:
  2481. <table class=doc align=center cellpadding=3>
  2482. <tr class=top><th>Pin</th><th>Signal</th></tr>
  2483. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  2484. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  2485. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  2486. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  2487. </table>
  2488. </p>
  2489. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  2490. 23LC1024 chips are used.
  2491. </p>
  2492. <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>
  2493. <p>
  2494. <table class=doc align=center cellpadding=3>
  2495. <tr class=top><th>Pin</th><th>Signal</th></tr>
  2496. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  2497. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  2498. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  2499. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  2500. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  2501. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  2502. </table>
  2503. </p>
  2504. <p>
  2505. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  2506. must be used. See below for details. Each chip provides 1485 ms of delay
  2507. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  2508. exceed the amount of memory physically present.
  2509. </p>
  2510. <h3>Examples</h3>
  2511. <p>
  2512. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  2513. </p>
  2514. <!--
  2515. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  2516. </p>
  2517. -->
  2518. <p>
  2519. <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)
  2520. </p>
  2521. <h3>Notes</h3>
  2522. <p>External RAM allows for longer delays without consuming
  2523. limited internal RAM. However, SPI communication is required,
  2524. which consumes much more CPU time. The
  2525. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  2526. function may be used to monitor how much CPU time is consumed.
  2527. </p>
  2528. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  2529. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  2530. chips.
  2531. </p>
  2532. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  2533. </p>
  2534. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  2535. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  2536. channels of a stereo signal.
  2537. <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);
  2538. </p>
  2539. </script>
  2540. <script type="text/x-red" data-template-name="AudioEffectDelayExternal">
  2541. <div class="form-row">
  2542. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2543. <input type="text" id="node-input-name" placeholder="Name">
  2544. </div>
  2545. </script>
  2546. <script type="text/x-red" data-help-name="AudioEffectBitcrusher">
  2547. <h3>Summary</h3>
  2548. <div class=tooltipinfo>
  2549. <p>Reduce the samplerate and/or bitdepth of a source signal, resulting in
  2550. a distorted sound.</p>
  2551. </div>
  2552. <h3>Audio Connections</h3>
  2553. <table class=doc align=center cellpadding=3>
  2554. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2555. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2556. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  2557. </table>
  2558. <h3>Functions</h3>
  2559. <p class=func><span class=keyword>bits</span>(xcrushBits);</p>
  2560. <p class=desc>xcrushBits sets the bitdepth, from 1 to 16. A Value of 16
  2561. does not crush the bitdepth, and is effectively a passthru for this part
  2562. of the function.</p>
  2563. <p class=func><span class=keyword>sampleRate</span>(xsampleRate);</p>
  2564. <p class=desc>xsampleRate sets the frequency, from 1 to 44100Hz, however it
  2565. works in integer steps so you will only really get a handful of results from
  2566. the many samplerates you can pass. 44100 is passthru.</p>
  2567. <p class=desc>set xbitDepth to 16 and xsampleRate to 44100 to pass audio
  2568. through without any Bitcrush effect.</p>
  2569. <h3>Examples</h3>
  2570. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Bitcrusher
  2571. </p>
  2572. <h3>Notes</h3>
  2573. <p>Needs a lot of improvement. Options for anti-aliasing would be nice in
  2574. the future, but for now, it's rough, it's dirty and it sounds a bit like
  2575. Nine Inch Nails.
  2576. </p>
  2577. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  2578. should be used when changing
  2579. settings on multiple objects, so all changes always take effect
  2580. at the same moment.
  2581. </p>
  2582. </script>
  2583. <script type="text/x-red" data-template-name="AudioEffectBitcrusher">
  2584. <div class="form-row">
  2585. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2586. <input type="text" id="node-input-name" placeholder="Name">
  2587. </div>
  2588. </script>
  2589. <script type="text/x-red" data-help-name="AudioEffectMidSide">
  2590. <h3>Summary</h3>
  2591. <div class=tooltipinfo>
  2592. <p>Convert stereo signals to/from Mid-Side format.
  2593. Mid-Side encoding can be used to increase stereo width, make the lower
  2594. frequencies mono (to please your sub), or as the basis of audio compression.</p>
  2595. </div>
  2596. <h3>Audio Connections</h3>
  2597. <table class=doc align=center cellpadding=3>
  2598. <tr class=top><th>Port</th><th>While<br>Encoding</th><th>While<br>Decoding</th></tr>
  2599. <tr class=odd><td align=center>In 0</td><td>Left Input</td><td>Mid Output</td></tr>
  2600. <tr class=odd><td align=center>In 1</td><td>Right Input</td><td>Side Output</td></tr>
  2601. <tr class=odd><td align=center>Out 0</td><td>Mid Input</td><td>Left Output</td></tr>
  2602. <tr class=odd><td align=center>Out 1</td><td>Side Input</td><td>Right Output</td></tr>
  2603. </table>
  2604. <h3>Functions</h3>
  2605. <p class=func><span class=keyword>encode</span>();</p>
  2606. <p class=desc>Configure this object to encode from stereo to Mid-Side format.</p>
  2607. <p class=func><span class=keyword>decode</span>();</p>
  2608. <p class=desc>Configure this object to decode from Mid-Side format back to stereo signals.</p>
  2609. <h3>Examples</h3>
  2610. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>
  2611. <h3>Notes</h3>
  2612. <p>Many interesting stereo effects can be achieved by manipulating Mid-Side signals.</p>
  2613. <p>Normally a pair of these objects are used, one to encode, then additional
  2614. gain/attenuation or effects applied to the Mid-Side signals, and finally
  2615. decoding back to stereo signals</p>
  2616. <p>To prevent saturation, halving is done in the encoding, that is:</p>
  2617. <p>Mid = (left+right)/2</p>
  2618. <p>Side = (left-right)/2</p>
  2619. <p>And to decode:</p>
  2620. <p>Left = Mid+Side</p>
  2621. <p>Right = Mid-Side</p>
  2622. </script>
  2623. <script type="text/x-red" data-template-name="AudioEffectMidSide">
  2624. <div class="form-row">
  2625. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2626. <input type="text" id="node-input-name" placeholder="Name">
  2627. </div>
  2628. </script>
  2629. <script type="text/x-red" data-help-name="AudioEffectWaveshaper">
  2630. <h3>Summary</h3>
  2631. <div class=tooltipinfo>
  2632. <p>Modify the waveform shape of a signal.</p>
  2633. <p align=center><img src="img/waveshaper.png"></p>
  2634. <p>Useful for overdrive, distortion, fuzz,
  2635. clipping, expo converters, phase inversion, waveform modification &amp; adjustments.
  2636. </p>
  2637. </div>
  2638. <h3>Audio Connections</h3>
  2639. <table class=doc align=center cellpadding=3>
  2640. <tr class=top><th>Port</th><th>Signal</th></tr>
  2641. <tr class=odd><td align=center>In 0</td><td>Original Input Signal</td></tr>
  2642. <tr class=odd><td align=center>Out 0</td><td>Shaped Output</td></tr>
  2643. </table>
  2644. <h3>Functions</h3>
  2645. <p class=func><span class=keyword>shape</span>(array, length);</p>
  2646. <p class=desc>Configure the waveform shape. Array is a list of float
  2647. numbers, given in order. The first number maps to input -1.0. The
  2648. last maps to input +1.0. The numbers represent the desired output
  2649. level at each of these input levels. Length must be 2, 3, 5, 9, 17,
  2650. 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, or 32769.
  2651. </p>
  2652. <h3>Examples</h3>
  2653. <p class=exam>TODO: example needed</p>
  2654. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>-->
  2655. <h3>Notes</h3>
  2656. <p><a href="https://github.com/dxinteractive/TeensyAudioWaveshaper">More information</a>
  2657. </p>
  2658. </script>
  2659. <script type="text/x-red" data-template-name="AudioEffectWaveshaper">
  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="AudioFilterBiquad">
  2666. <h3>Summary</h3>
  2667. <div class=tooltipinfo>
  2668. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  2669. Up to 4 stages may be cascaded.
  2670. </p>
  2671. <p align=center><img src="img/biquad.png"></p>
  2672. </div>
  2673. <h3>Audio Connections</h3>
  2674. <table class=doc align=center cellpadding=3>
  2675. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2676. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2677. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2678. </table>
  2679. <h3>Functions</h3>
  2680. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  2681. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  2682. response, with the specified corner frequency and Q shape. If Q is
  2683. higher that 0.7071, be careful of filter gain (see below).
  2684. </p>
  2685. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  2686. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  2687. response, with the specified corner frequency and Q shape. If Q is
  2688. higher that 0.7071, be careful of filter gain (see below).
  2689. </p>
  2690. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  2691. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  2692. response. The filter has unity gain at the specified frequency. Q
  2693. controls the width of frequencies allowed to pass.
  2694. </p>
  2695. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  2696. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  2697. response. Q controls the width of rejected frequencies.
  2698. </p>
  2699. <p class=func><span class=keyword>setLowShelf</span>(stage, frequency, gain, slope);</p>
  2700. <p class=desc>Configure one stage of the filter (0 to 3) with low shelf response.
  2701. A low shelf filter attenuates or amplifies signals below the specified frequency.
  2702. Frequency controls the slope midpoint, gain is in dB and can be both
  2703. positive or negative. The slope parameter controls steepness of gain transition.
  2704. A slope of 1 yields maximum steepness without overshoot,
  2705. lower values yield a less steep slope. See the picture below for a visualization
  2706. of the slope parameter's effect.
  2707. Be careful with positive gains and slopes higher than 1 as they introduce gain
  2708. (see warning below).
  2709. </p>
  2710. </p>
  2711. <p class=func><span class=keyword>setHighShelf</span>(stage, frequency, gain, slope);</p>
  2712. <p class=desc>Configure one stage of the filter (0 to 3) with high shelf response.
  2713. A high shelf filter attenuates or amplifies signals above the specified frequency.
  2714. Frequency controls the slope midpoint, gain is in dB and can be both
  2715. positive or negative. The slope parameter controls steepness of gain transition.
  2716. A slope of 1 yields maximum steepness without overshoot,
  2717. lower values yield a less steep slope. See the picture below for a visualization
  2718. of the slope parameter's effect.
  2719. Be careful with positive gains and slopes higher than 1 as they introduce gain
  2720. (see warning below).
  2721. </p>
  2722. <p align=center><img src="img/shelf_filter.png"></p>
  2723. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  2724. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  2725. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  2726. Each coefficient must be less than 2.0 and greater than -2.0. The array
  2727. should be type double. Alternately, it may be type int, where 1.0 is
  2728. represented with 1073741824 (2<sup>30</sup>).
  2729. </p>
  2730. <h3>Examples</h3>
  2731. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  2732. </p>
  2733. <h3>Notes</h3>
  2734. <p>Filters can with gain must have their input signals attenuated, so the
  2735. signal does not exceed 1.0.
  2736. </p>
  2737. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  2738. not pass any signal.
  2739. </p>
  2740. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  2741. trouble with limited numerical precision, causing the filter to perform
  2742. poorly. For very low corner frequency, the State Variable (Chamberlin)
  2743. filter should be used.
  2744. </p>
  2745. </script>
  2746. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  2747. <div class="form-row">
  2748. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2749. <input type="text" id="node-input-name" placeholder="Name">
  2750. </div>
  2751. </script>
  2752. <script type="text/x-red" data-help-name="AudioFilterFIR">
  2753. <h3>Summary</h3>
  2754. <div class=tooltipinfo>
  2755. <p>Finite impulse response filter, useful for all sorts of filtering.
  2756. </p>
  2757. <p align=center><img src="img/fir_filter.png"></p>
  2758. </div>
  2759. <h3>Audio Connections</h3>
  2760. <table class=doc align=center cellpadding=3>
  2761. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2762. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2763. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2764. </table>
  2765. <h3>Functions</h3>
  2766. <p class=func><span class=keyword>begin</span>(array, length);</p>
  2767. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  2768. filter's impulse response), and
  2769. length indicates the number of points in the array. Array may also be
  2770. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  2771. filtering.
  2772. </p>
  2773. <p class=func><span class=keyword>end</span>();</p>
  2774. <p class=desc>Turn the filter off.
  2775. </p>
  2776. <h3>Examples</h3>
  2777. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  2778. </p>
  2779. <h3>Known Issues</h3>
  2780. <p>Your filter's impulse response array must have an even length. If you have
  2781. add odd number of taps, you must add an extra zero to increase the length
  2782. to an even number.
  2783. </p>
  2784. <p>The minimum number of taps is 4. If you use less, add extra zeros to increase
  2785. the length to 4.
  2786. </p>
  2787. <p>The impulse response must be given in reverse order. Many filters have
  2788. symetrical impluse response, making this a non-issue. If your filter has
  2789. a non-symetrical response, make sure the data is in reverse time order.
  2790. </p>
  2791. <h3>Notes</h3>
  2792. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  2793. implement filters with better phase response.
  2794. </p>
  2795. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  2796. supported filter length is 200 points.
  2797. </p>
  2798. <p>The free
  2799. <a href="http://t-filter.engineerjs.com/" target="_blank"> TFilter Design Tool</a>
  2800. can be used to create the impulse response array. Be sure to set the sampling
  2801. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  2802. </p>
  2803. <p>
  2804. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  2805. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  2806. and add "const" to avoid consuming extra RAM.
  2807. </p>
  2808. </script>
  2809. <script type="text/x-red" data-template-name="AudioFilterFIR">
  2810. <div class="form-row">
  2811. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2812. <input type="text" id="node-input-name" placeholder="Name">
  2813. </div>
  2814. </script>
  2815. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  2816. <h3>Summary</h3>
  2817. <div class=tooltipinfo>
  2818. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  2819. adjustable resonance, and optional signal control of corner
  2820. frequency.</p>
  2821. </div>
  2822. <h3>Audio Connections</h3>
  2823. <table class=doc align=center cellpadding=3>
  2824. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2825. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  2826. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  2827. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  2828. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  2829. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  2830. </table>
  2831. <h3>Functions</h3>
  2832. <p class=func><span class=keyword>frequency</span>(freq);</p>
  2833. <p class=desc>Set the filter's corner frequency. When a signal is
  2834. connected to the control input, the filter will implement this
  2835. frequency when the signal is zero.
  2836. </p>
  2837. <p class=func><span class=keyword>resonance</span>(Q);</p>
  2838. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  2839. Resonance greater than 0.707 will amplify the signal near the
  2840. corner frequency. You must attenuate the signal before input
  2841. to this filter, to prevent clipping.
  2842. </p>
  2843. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  2844. <p class=desc>Set how much (in octaves) the control signal can alter
  2845. the filter's corner freqency. Range is 0 to 7 octaves. For
  2846. example, when set to 2.5, a full scale positive signal (1.0) will
  2847. shift the filter frequency up 2.5 octaves, and a full scale negative
  2848. signal will shift it down 2.5 octaves.
  2849. </p>
  2850. <!--
  2851. <h3>Examples</h3>
  2852. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2853. </p>
  2854. -->
  2855. <h3>Notes</h3>
  2856. <p>
  2857. When controlled by a signal, the equation for the filter
  2858. frequency is:
  2859. </p>
  2860. <p>
  2861. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  2862. <br><small>If anyone knows how to do HTML equations, please
  2863. help me improve this.....</small>
  2864. </p>
  2865. <p>When operating with signal control of corner frequency, this
  2866. object uses approximately 4% of the CPU time on Teensy 3.1.
  2867. </p>
  2868. </script>
  2869. <script type="text/x-red" data-template-name="AudioFilterStateVariable">
  2870. <div class="form-row">
  2871. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2872. <input type="text" id="node-input-name" placeholder="Name">
  2873. </div>
  2874. </script>
  2875. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  2876. <h3>Summary</h3>
  2877. <div class=tooltipinfo>
  2878. <p>Track the signal peak amplitude. Very useful for simple
  2879. audio level response projects, and general troubleshooting.</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>In 0</td><td>Signal to analyze</td></tr>
  2885. </table>
  2886. <h3>Functions</h3>
  2887. <p class=func><span class=keyword>available</span>();</p>
  2888. <p class=desc>Returns true each time new peak data is available.
  2889. </p>
  2890. <p class=func><span class=keyword>read</span>();</p>
  2891. <p class=desc>Read the highest peak amplitude value since the last read.
  2892. Return is from 0.0 to 1.0.
  2893. </p>
  2894. <p class=func><span class=keyword>readPeakToPeak</span>();</p>
  2895. <p class=desc>Read the highest peak-to-peak amplitude since the last read.
  2896. Return is from 0.0 to 2.0.
  2897. </p>
  2898. <h3>Examples</h3>
  2899. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  2900. </p>
  2901. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  2902. </p>
  2903. <h3>Notes</h3>
  2904. <p></p>
  2905. </script>
  2906. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  2907. <div class="form-row">
  2908. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2909. <input type="text" id="node-input-name" placeholder="Name">
  2910. </div>
  2911. </script>
  2912. <script type="text/x-red" data-help-name="AudioAnalyzeRMS">
  2913. <h3>Summary</h3>
  2914. <div class=tooltipinfo>
  2915. <p>Track the signal RMS amplitude. Useful for
  2916. audio level response projects, and general troubleshooting.</p>
  2917. </div>
  2918. <h3>Audio Connections</h3>
  2919. <table class=doc align=center cellpadding=3>
  2920. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2921. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2922. </table>
  2923. <h3>Functions</h3>
  2924. <p class=func><span class=keyword>available</span>();</p>
  2925. <p class=desc>Returns true if new RMS data is available.
  2926. </p>
  2927. <p class=func><span class=keyword>read</span>();</p>
  2928. <p class=desc>Read the new RMS value.
  2929. Return is from 0.0 to 1.0.
  2930. </p>
  2931. <h3>Examples</h3>
  2932. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakAndRMSMeterStereo</p>
  2933. </p>
  2934. <h3>Notes</h3>
  2935. <p></p>
  2936. </script>
  2937. <script type="text/x-red" data-template-name="AudioAnalyzeRMS">
  2938. <div class="form-row">
  2939. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2940. <input type="text" id="node-input-name" placeholder="Name">
  2941. </div>
  2942. </script>
  2943. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  2944. <h3>Summary</h3>
  2945. <div class=tooltipinfo>
  2946. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  2947. with real value (magnitude) output. The frequency resolution is
  2948. 172 Hz, useful for simple audio visualization.</p>
  2949. </div>
  2950. <h3>Audio Connections</h3>
  2951. <table class=doc align=center cellpadding=3>
  2952. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2953. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2954. </table>
  2955. <h3>Functions</h3>
  2956. <p class=func><span class=keyword>available</span>();</p>
  2957. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2958. </p>
  2959. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2960. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  2961. so 1.0 represents a full scale sine wave.
  2962. </p>
  2963. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2964. <p class=desc>Read several frequency bins, returning their sum. The higher
  2965. audio octaves are represented by many bins, which are typically read
  2966. as a group for audio visualization.
  2967. </p>
  2968. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2969. <p class=desc>New data is produced very radidly, approximately 344 times
  2970. per second. Multiple outputs can be averaged together, so available()
  2971. returns true at a slower rate.
  2972. </p>
  2973. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2974. <p class=desc>Set the window function to be used. AudioWindowHanning256
  2975. is the default. Windowing may be disabled by NULL, but windowing
  2976. should be used for all non-periodic (music) signals, and all periodic
  2977. signals that are not exact integer division of the sample rate.
  2978. </p>
  2979. <h3>Examples</h3>
  2980. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2981. </p>
  2982. <h3>Notes</h3>
  2983. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2984. num is 0 to 127.</p>
  2985. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  2986. <p>Window Types:
  2987. <ul>
  2988. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  2989. <li><span class=literal>AudioWindowBartlett256</span></li>
  2990. <li><span class=literal>AudioWindowBlackman256</span></li>
  2991. <li><span class=literal>AudioWindowFlattop256</span></li>
  2992. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  2993. <li><span class=literal>AudioWindowNuttall256</span></li>
  2994. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  2995. <li><span class=literal>AudioWindowWelch256</span></li>
  2996. <li><span class=literal>AudioWindowHamming256</span></li>
  2997. <li><span class=literal>AudioWindowCosine256</span></li>
  2998. <li><span class=literal>AudioWindowTukey256</span></li>
  2999. </ul>
  3000. </p>
  3001. </script>
  3002. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  3003. <div class="form-row">
  3004. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3005. <input type="text" id="node-input-name" placeholder="Name">
  3006. </div>
  3007. </script>
  3008. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  3009. <h3>Summary</h3>
  3010. <div class=tooltipinfo>
  3011. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  3012. with real value (magnitude) output. The frequency resolution is
  3013. 43 Hz, useful detailed for audio visualization.</p>
  3014. </div>
  3015. <h3>Audio Connections</h3>
  3016. <table class=doc align=center cellpadding=3>
  3017. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3018. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  3019. </table>
  3020. <h3>Functions</h3>
  3021. <p class=func><span class=keyword>available</span>();</p>
  3022. <p class=desc>Returns true each time the FFT analysis produces new output data.
  3023. </p>
  3024. <p class=func><span class=keyword>read</span>(binNumber);</p>
  3025. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  3026. so 1.0 represents a full scale sine wave.
  3027. </p>
  3028. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  3029. <p class=desc>Read several frequency bins, returning their sum. The higher
  3030. audio octaves are represented by many bins, which are typically read
  3031. as a group for audio visualization.
  3032. </p>
  3033. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  3034. <p class=desc>This function does nothing. The 1024 point FFT always
  3035. updates at approximately 86 times per second.
  3036. </p>
  3037. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  3038. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  3039. is the default. Windowing may be disabled by NULL, but windowing
  3040. should be used for all non-periodic (music) signals, and all periodic
  3041. signals that are not exact integer division of the sample rate.
  3042. </p>
  3043. <h3>Examples</h3>
  3044. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  3045. </p>
  3046. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  3047. </p>
  3048. <h3>Notes</h3>
  3049. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  3050. num is 0 to 511.</p>
  3051. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  3052. <p>Window Types:
  3053. <ul>
  3054. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  3055. <li><span class=literal>AudioWindowBartlett1024</span></li>
  3056. <li><span class=literal>AudioWindowBlackman1024</span></li>
  3057. <li><span class=literal>AudioWindowFlattop1024</span></li>
  3058. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  3059. <li><span class=literal>AudioWindowNuttall1024</span></li>
  3060. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  3061. <li><span class=literal>AudioWindowWelch1024</span></li>
  3062. <li><span class=literal>AudioWindowHamming1024</span></li>
  3063. <li><span class=literal>AudioWindowCosine1024</span></li>
  3064. <li><span class=literal>AudioWindowTukey1024</span></li>
  3065. </ul>
  3066. </p>
  3067. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  3068. Average usage is much lower. Future versions might distribute the
  3069. load more evenly over time....
  3070. </p>
  3071. </script>
  3072. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  3073. <div class="form-row">
  3074. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3075. <input type="text" id="node-input-name" placeholder="Name">
  3076. </div>
  3077. </script>
  3078. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  3079. <h3>Summary</h3>
  3080. <div class=tooltipinfo>
  3081. <p>Detect the level of a single tone</p>
  3082. </div>
  3083. <h3>Audio Connections</h3>
  3084. <table class=doc align=center cellpadding=3>
  3085. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3086. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  3087. </table>
  3088. <h3>Functions</h3>
  3089. <p class=func><span class=keyword>frequency</span>(freq);</p>
  3090. <p class=desc>Set the frequency to detect. The default detection time
  3091. will be 10 cycles of this frequency.
  3092. </p>
  3093. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  3094. <p class=desc>Set the frequency to detect, and the number of cycles.
  3095. Longer detection time (more cycles) will give higher precision,
  3096. but of course slower response.
  3097. </p>
  3098. <p class=func><span class=keyword>available</span>();</p>
  3099. <p class=desc>Returns true (non-zero) each time a detection interval
  3100. (number of cycles) completed and a new level is detected.
  3101. </p>
  3102. <p class=func><span class=keyword>read</span>();</p>
  3103. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  3104. </p>
  3105. <p class=func><span class=keyword>threshold</span>(level);</p>
  3106. <p class=desc>Set a detection threshold, where the bool test operation
  3107. will return true if at or above this level, or false when below.
  3108. </p>
  3109. <p class=func>(bool)</p>
  3110. <p class=desc>By testing the object as a boolean value, you can respond
  3111. to detection of a tone.
  3112. </p>
  3113. <h3>Examples</h3>
  3114. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  3115. </p>
  3116. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  3117. </p>
  3118. <h3>Notes</h3>
  3119. <p>Low frequency detection has trouble with numerical precision.
  3120. Works really well for all 8 DTMF frequencies, but fails for
  3121. detecting "sub audible tones" used in some control applications.</p>
  3122. <p>The (bool) test continues to return true until the next detection
  3123. interval (the configured number of cycles). This behavior may
  3124. change in future versions, for a single true each time the signal
  3125. is detected, and then false for the remainder of that interval.</p>
  3126. </script>
  3127. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  3128. <div class="form-row">
  3129. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3130. <input type="text" id="node-input-name" placeholder="Name">
  3131. </div>
  3132. </script>
  3133. <script type="text/x-red" data-help-name="AudioAnalyzeNoteFrequency">
  3134. <h3>Summary</h3>
  3135. <div class=tooltipinfo>
  3136. <p>Detect with fairly good accuracy the fundamental frequency f<sub>o</sub>
  3137. of musical notes, such as electric guitar and bass.</p>
  3138. </div>
  3139. <p>Written By Collin Duffy</p>
  3140. <h3>Audio Connections</h3>
  3141. <table class=doc align=center cellpadding=3>
  3142. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3143. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  3144. </table>
  3145. <h3>Functions</h3>
  3146. <p class=func><span class=keyword>begin</span>(threshold);</p>
  3147. <p class=desc>Initialize and start detecting frequencies,
  3148. with an initial threshold (the amount of allowed uncertainty).
  3149. </p>
  3150. <p class=func><span class=keyword>available</span>();</p>
  3151. <p class=desc>Returns true (non-zero) when a valid
  3152. frequency is detected.
  3153. </p>
  3154. <p class=func><span class=keyword>read</span>();</p>
  3155. <p class=desc>Read the detected frequency.
  3156. </p>
  3157. <p class=func><span class=keyword>probability</span>();</p>
  3158. <p class=desc>Return the level of certainty, betweeo 0 to 1.0.
  3159. </p>
  3160. <p class=func><span class=keyword>threshold</span>(level);</p>
  3161. <p class=desc>Set the detection threshold, the amount of allowed uncertainty.
  3162. </p>
  3163. <h3>Examples</h3>
  3164. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; NoteFrequency
  3165. </p>
  3166. <h3>Notes</h3>
  3167. <p>The <a href="http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf">YIN algorithm</a> (PDF)
  3168. is used to detect frequencies, with many optimizations for
  3169. frequencies between 29-400Hz. This algorithm can be somewhat
  3170. memory and processor hungry but will allow you to detect with
  3171. fairly good accuracy the fundamental frequencies from
  3172. electric guitars and basses.</p>
  3173. <p>Within the code, AUDIO_GUITARTUNER_BLOCKS
  3174. may be edited to control low frequency range. The default
  3175. (24) allows measurement down to 29.14 Hz, or B(flat)0.</p>
  3176. <p>TODO: The usable upper range of this object is not well known.
  3177. Duff says "it should be good up to 1000Hz", but may have trouble
  3178. 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>
  3179. <p>This object was contributed by Collin Duffy from his
  3180. <a href="https://github.com/duff2013/AudioTuner">AudioTuner project</a>.
  3181. Additional details and documentation may be found there.</p>
  3182. </script>
  3183. <script type="text/x-red" data-template-name="AudioAnalyzeNoteFrequency">
  3184. <div class="form-row">
  3185. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3186. <input type="text" id="node-input-name" placeholder="Name">
  3187. </div>
  3188. </script>
  3189. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  3190. <h3>Summary</h3>
  3191. <div class=tooltipinfo>
  3192. <p>Print raw audio data to the Arduino Serial Monitor. This
  3193. object creates massive output quickly, and should not normally be used.</p>
  3194. </div>
  3195. <h3>Audio Connections</h3>
  3196. <table class=doc align=center cellpadding=3>
  3197. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3198. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  3199. </table>
  3200. <h3>Functions</h3>
  3201. <p class=func><span class=keyword>name</span>(string);</p>
  3202. <p class=desc>blah blah blah blah
  3203. </p>
  3204. <p class=func><span class=keyword>trigger</span>();</p>
  3205. <p class=desc>blah blah blah blah
  3206. </p>
  3207. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  3208. <p class=desc>blah blah blah blah
  3209. </p>
  3210. <p class=func><span class=keyword>delay</span>(samples);</p>
  3211. <p class=desc>blah blah blah blah
  3212. </p>
  3213. <p class=func><span class=keyword>length</span>(samples);</p>
  3214. <p class=desc>blah blah blah blah
  3215. </p>
  3216. <!--
  3217. <h3>Examples</h3>
  3218. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3219. </p>
  3220. -->
  3221. <h3>Notes</h3>
  3222. <p>This object doesn't work very well and probably should not be used.</p>
  3223. </script>
  3224. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  3225. <div class="form-row">
  3226. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3227. <input type="text" id="node-input-name" placeholder="Name">
  3228. </div>
  3229. </script>
  3230. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  3231. <h3>Summary</h3>
  3232. <div class=tooltipinfo>
  3233. <p>Control the SGTL5000 chip on the
  3234. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  3235. SGTL5000 is always used in slave mode, where Teensy controls
  3236. all I2S timing.
  3237. </p>
  3238. <p align=center><img src="img/sgtl5000closeup.jpg"></p>
  3239. </div>
  3240. <h3>Audio Connections</h3>
  3241. <p>This object has no audio inputs or outputs. Separate i2s objects
  3242. are used to send and receive audio data. I2S master mode objects
  3243. must be used, because this object configures the SGTL5000 in slave
  3244. mode, where it depends on Teensy to provide all I2S clocks.
  3245. This object controls
  3246. how the SGTL5000 will use those I2S audio streams.</p>
  3247. <h3>Functions</h3>
  3248. <p>These are the most commonly used SGTL5000 functions.</p>
  3249. <p class=func><span class=keyword>enable</span>();</p>
  3250. <p class=desc>Start the SGTL5000. This function should be called first.
  3251. </p>
  3252. <p class=func><span class=keyword>volume</span>(level);</p>
  3253. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  3254. 0.8 corresponds to the maximum undistorted output for a full scale
  3255. signal. Usually 0.5 is a comfortable listening level. The line
  3256. level outputs are <em>not</em> changed by this function.
  3257. </p>
  3258. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3259. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  3260. </p>
  3261. <p class=func><span class=keyword>micGain</span>(dB);</p>
  3262. <p class=desc>When using the microphone input, set the amplifier gain.
  3263. The input number is in decibels, from 0 to 63.
  3264. </p>
  3265. <h3>Signal Levels</h3>
  3266. <p>The default signal levels should be used for most applications,
  3267. but these functions allow you to customize the analog signals.</p>
  3268. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  3269. <p class=desc>Silence the headphone output.
  3270. </p>
  3271. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  3272. <p class=desc>Turn the headphone output on.
  3273. </p>
  3274. <p class=func><span class=keyword>muteLineout</span>();</p>
  3275. <p class=desc>Silence the line level outputs.
  3276. </p>
  3277. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  3278. <p class=desc>Turn the line level outputs on.
  3279. </p>
  3280. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  3281. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  3282. Fifteen settings are possible:
  3283. </p>
  3284. <pre class="desc">
  3285. 0: 3.12 Volts p-p
  3286. 1: 2.63 Volts p-p
  3287. 2: 2.22 Volts p-p
  3288. 3: 1.87 Volts p-p
  3289. 4: 1.58 Volts p-p
  3290. 5: 1.33 Volts p-p (default)
  3291. 6: 1.11 Volts p-p
  3292. 7: 0.94 Volts p-p
  3293. 8: 0.79 Volts p-p
  3294. 9: 0.67 Volts p-p
  3295. 10: 0.56 Volts p-p
  3296. 11: 0.48 Volts p-p
  3297. 12: 0.40 Volts p-p
  3298. 13: 0.34 Volts p-p
  3299. 14: 0.29 Volts p-p
  3300. 15: 0.24 Volts p-p
  3301. </pre>
  3302. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  3303. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  3304. settings for left and right. The same 15 settings are available.
  3305. </p>
  3306. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  3307. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  3308. voltage range. The following settings are possible:
  3309. </p>
  3310. <pre class="desc">
  3311. 13: 3.16 Volts p-p
  3312. 14: 2.98 Volts p-p
  3313. 15: 2.83 Volts p-p
  3314. 16: 2.67 Volts p-p
  3315. 17: 2.53 Volts p-p
  3316. 18: 2.39 Volts p-p
  3317. 19: 2.26 Volts p-p
  3318. 20: 2.14 Volts p-p
  3319. 21: 2.02 Volts p-p
  3320. 22: 1.91 Volts p-p
  3321. 23: 1.80 Volts p-p
  3322. 24: 1.71 Volts p-p
  3323. 25: 1.62 Volts p-p
  3324. 26: 1.53 Volts p-p
  3325. 27: 1.44 Volts p-p
  3326. 28: 1.37 Volts p-p
  3327. 29: 1.29 Volts p-p (default)
  3328. 30: 1.22 Volts p-p
  3329. 31: 1.16 Volts p-p
  3330. </pre>
  3331. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  3332. <p class=desc>Adjust the line level outout voltage range, with separate
  3333. settings for left and right. The same settings (13 to 31) are available.
  3334. </p>
  3335. <h3>Signal Conditioning</h3>
  3336. <p>Usually these digital signal conditioning features should be left at their
  3337. default settings.
  3338. </p>
  3339. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  3340. <p class=desc>By default, the analog input (either line-level inputs or mic)
  3341. is high-pass filtered, to remove any DC component. This function
  3342. freezes the filter, so the current DC component is still substracted, but
  3343. the filter stops tracking any DC or low frequency changes.
  3344. </p>
  3345. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  3346. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  3347. low frequencies are allowed to enter the digital signal. This
  3348. <a href="http://openaudio.blogspot.com/2017/03/teensy-audio-board-self-noise.html">may
  3349. reduce noise</a> in some cases.
  3350. </p>
  3351. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  3352. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  3353. allows it to resume tracking DC and low frequency changes, if
  3354. previously frozen. This is the default setting.
  3355. </p>
  3356. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  3357. <p class=desc>Normally output volume should be used with volume(), which
  3358. changes the analog gain in the headphone amplifier. This function
  3359. on the other hand controls digital attenuation before conversion to analog, which
  3360. reduces resolution, but allows another fine control of output
  3361. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  3362. at 1.0.
  3363. </p>
  3364. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and graceful
  3365. ramping is handled by the chip so that a new volume may be set directly in
  3366. a single call.
  3367. </p>
  3368. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  3369. <p class=desc>Adjust the digital output volume separately on left and
  3370. right channels.
  3371. </p>
  3372. <p class=func><span class=keyword>dacVolumeRamp</span>();</p>
  3373. <p class=desc>Enable graceful volume ramping. The dacVolume adjusts gradually using
  3374. an exponential curve. Pops or loud clicks are avoided when making large
  3375. changes in volume level.
  3376. </p>
  3377. <p class=func><span class=keyword>dacVolumeRampLinear</span>();</p>
  3378. <p class=desc>Enable faster volume ramping. A slight click may be heard during a
  3379. large volume change.
  3380. </p>
  3381. <p class=func><span class=keyword>dacVolumeRampDisable</span>();</p>
  3382. <p class=desc>Do not use any gradual ramping. The zero cross feature still helps
  3383. for small changes, but large volume changes may produce a pop or click.
  3384. </p>
  3385. <h3>Audio Processor</h3>
  3386. <p>The optional digital audio processor is capable of implementing
  3387. one or more of: automatic volume control, surround sound control,
  3388. bass enhancement, and tonal adjustments (either a
  3389. simple tone control, or a parametric equalizer, or a graphic equalizer),
  3390. in that order.
  3391. </p>
  3392. <p>These signal processing features are implemented in the SGTL5000 chip,
  3393. so they do not consume CPU time on Teensy. However, the order of
  3394. these processes is fixed in the hardware.
  3395. </p>
  3396. <p>It is good practice to mute the outputs before enabling or disabling
  3397. the Audio Processor, to avoid clicks or thumps.
  3398. </p>
  3399. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  3400. <p class=desc>Enable the audio processor to pre-process the input
  3401. (from either line-level inputs or microphone) before it's sent
  3402. to Teensy by I2S.
  3403. </p>
  3404. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  3405. <p class=desc>Enable the audio processor to post-process Teensy's
  3406. I2S output before it's turned into analog signals for the
  3407. headphones and/or line level outputs.
  3408. </p>
  3409. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  3410. <p class=desc>Disable the audio processor.
  3411. </p>
  3412. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  3413. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  3414. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  3415. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  3416. as 2. <em>response</em> controls the integration time for the compressor and can take
  3417. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  3418. over a longer time, allowing short-term peaks through.
  3419. </p>
  3420. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  3421. knee' compressor is used to progressively compress louder values which are near to or above the
  3422. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  3423. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  3424. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  3425. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  3426. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  3427. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  3428. </p>
  3429. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  3430. <p class=desc>Enables auto volume control, using the previously specified settings.
  3431. </p>
  3432. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  3433. <p class=desc>Disables auto volume control.
  3434. </p>
  3435. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  3436. <p class=desc>Enable virtual surround processing, to give a broader and
  3437. deeper stereo image (even with mono input).
  3438. </p>
  3439. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  3440. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  3441. the width to maximum to avoid pops.
  3442. </p>
  3443. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  3444. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  3445. </p>
  3446. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  3447. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  3448. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  3449. </p>
  3450. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  3451. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  3452. the original stereo signal has bass levels boosted and is then mixed back into
  3453. the stereo signal, which is then optionally high pass filtered (to remove
  3454. inaudible subsonic frequencies).
  3455. </p>
  3456. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  3457. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  3458. enhancement level to zero.
  3459. </p>
  3460. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  3461. <p class=desc>Configures the bass enhancement by setting the levels of the
  3462. original stereo signal and the bass-enhanced mono level which will be mixed together.
  3463. There is no high-pass filter.
  3464. </p>
  3465. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  3466. steps of 0.5dB, to avoid pops.
  3467. </p>
  3468. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  3469. <p class=desc>Configures the bass enhancement by setting the levels of the
  3470. original stereo signal and the bass-enhanced mono level which will be mixed together.
  3471. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  3472. as follows:
  3473. </p>
  3474. <pre class="desc">
  3475. value frequency
  3476. 0 80Hz
  3477. 1 100Hz
  3478. 2 125Hz
  3479. 3 150Hz
  3480. 4 175Hz
  3481. 5 200Hz
  3482. 6 225Hz
  3483. </pre>
  3484. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  3485. steps of 0.5dB, to avoid pops.
  3486. </p>
  3487. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  3488. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  3489. one of</p>
  3490. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  3491. Equalizers and tone controls disabled, flat frequency response.</p>
  3492. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  3493. Enables the 7-band parametric equalizer, thus disabling the
  3494. tone controls and graphic equalizer.</p>
  3495. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  3496. Enables bass and treble tone controls, disabling the parametric
  3497. equalization and graphic equalizer.</p>
  3498. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  3499. Enables the five-band graphic equalizer, disabling the parametric
  3500. equalization and tone controls.</p>
  3501. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  3502. <p class=desc>Configures bass and treble tone controls, which are
  3503. implemented as one second order low pass filter (bass) in parallel with
  3504. one second order high pass filter (treble).
  3505. </p>
  3506. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  3507. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  3508. </p>
  3509. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  3510. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  3511. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  3512. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  3513. </p>
  3514. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  3515. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  3516. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  3517. </p>
  3518. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  3519. to avoid pops.
  3520. </p>
  3521. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  3522. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  3523. is specified along with a pointer to an array of filter coefficients.
  3524. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  3525. filters whose frequencies, gain, and Q may be freely configured, but each filter
  3526. can only be specified as a set of filter coefficients.
  3527. </p>
  3528. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  3529. <p class=desc>Enables zero or more of the already enabled parametric filters.
  3530. </p>
  3531. <h3>Examples</h3>
  3532. <p>Nearly all of the library's examples use this object. These
  3533. examples demonstrate its special features.
  3534. </p>
  3535. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  3536. </p>
  3537. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  3538. </p>
  3539. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  3540. </p>
  3541. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  3542. </p>
  3543. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  3544. </p>
  3545. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  3546. </p>
  3547. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; VolumeRamp
  3548. </p>
  3549. <h3>Notes</h3>
  3550. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  3551. and surround enhancement while speech uses bandpass filtering and auto volume control
  3552. compression.
  3553. </p>
  3554. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  3555. </p>
  3556. </script>
  3557. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  3558. <div class="form-row">
  3559. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3560. <input type="text" id="node-input-name" placeholder="Name">
  3561. </div>
  3562. </script>
  3563. <script type="text/x-red" data-help-name="AudioControlWM8731">
  3564. <h3>Summary</h3>
  3565. <div class=tooltipinfo>
  3566. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  3567. </div>
  3568. <h3>Audio Connections</h3>
  3569. <p>This object has no audio inputs or outputs. Separate i2s objects
  3570. are used to send and receive audio data. I2S master mode objects
  3571. must be used, since this control object configures the WM8731 into
  3572. slave mode.
  3573. </p>
  3574. <h3>Functions</h3>
  3575. <p class=func><span class=keyword>enable</span>();</p>
  3576. <p class=desc>blah blah blah blah
  3577. </p>
  3578. <p class=func><span class=keyword>disable</span>();</p>
  3579. <p class=desc>not implemented
  3580. </p>
  3581. <p class=func><span class=keyword>volume</span>(level);</p>
  3582. <p class=desc>blah blah blah blah
  3583. </p>
  3584. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3585. <p class=desc>not implemented
  3586. </p>
  3587. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3588. <p class=desc>not implemented
  3589. </p>
  3590. <!--
  3591. <h3>Examples</h3>
  3592. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3593. </p>
  3594. -->
  3595. <h3>Notes</h3>
  3596. <p></p>
  3597. </script>
  3598. <script type="text/x-red" data-template-name="AudioControlWM8731">
  3599. <div class="form-row">
  3600. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3601. <input type="text" id="node-input-name" placeholder="Name">
  3602. </div>
  3603. </script>
  3604. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  3605. <h3>Summary</h3>
  3606. <div class=tooltipinfo>
  3607. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  3608. </div>
  3609. <h3>Audio Connections</h3>
  3610. <p>This object has no audio inputs or outputs. Separate i2s objects
  3611. are used to send and receive audio data. I2S slave mode objects
  3612. must be used, since this control object configures the WM8731 into
  3613. master mode.
  3614. </p>
  3615. <h3>Functions</h3>
  3616. <p class=func><span class=keyword>enable</span>();</p>
  3617. <p class=desc>blah blah blah blah
  3618. </p>
  3619. <p class=func><span class=keyword>disable</span>();</p>
  3620. <p class=desc>not implemented
  3621. </p>
  3622. <p class=func><span class=keyword>volume</span>(level);</p>
  3623. <p class=desc>blah blah blah blah
  3624. </p>
  3625. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3626. <p class=desc>not implemented
  3627. </p>
  3628. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3629. <p class=desc>not implemented
  3630. </p>
  3631. <h3>Examples</h3>
  3632. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  3633. </p>
  3634. <h3>Notes</h3>
  3635. <p></p>
  3636. </script>
  3637. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  3638. <div class="form-row">
  3639. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3640. <input type="text" id="node-input-name" placeholder="Name">
  3641. </div>
  3642. </script>
  3643. <script type="text/x-red" data-help-name="AudioControlAK4558">
  3644. <h3>Summary</h3>
  3645. <div class=tooltipinfo>
  3646. <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>
  3647. in slave mode, where the Teensy controls all I2S timing.</p>
  3648. </div>
  3649. <h3>Audio Connections</h3>
  3650. <p>This object has no audio inputs or outputs. Separate I2S objects
  3651. are used to send and receive audio data.
  3652. </p>
  3653. <h3>Functions</h3>
  3654. <p class=func><span class=keyword>enable</span>();</p>
  3655. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3656. </p>
  3657. <p class=func><span class=keyword>enableIn</span>();</p>
  3658. <p class=desc>Enables the ADC module.
  3659. </p>
  3660. <p class=func><span class=keyword>enableOut</span>();</p>
  3661. <p class=desc>Enables the DAC module.
  3662. </p>
  3663. <p class=func><span class=keyword>disable</span>();</p>
  3664. <p class=desc>Disables the ADC and the DAC modules.
  3665. </p>
  3666. <p class=func><span class=keyword>disableIn</span>();</p>
  3667. <p class=desc>Disable the ADC module.
  3668. </p>
  3669. <p class=func><span class=keyword>disableOut</span>();</p>
  3670. <p class=desc>Disable the DAC module.
  3671. </p>
  3672. <p class=func><span class=keyword>volume</span>(level);</p>
  3673. <p class=desc>Accepts a float in range 0.0-1.0 and sets the line output volume accordingly.
  3674. </p>
  3675. <p class=func><span class=keyword>volumeLeft</span>(level);</p>
  3676. <p class=desc>Accepts a float in range 0.0-1.0 and sets the left line output volume accordingly.
  3677. </p>
  3678. <p class=func><span class=keyword>volumeRight</span>(level);</p>
  3679. <p class=desc>Accepts a float in range 0.0-1.0 and sets the right line output volume accordingly.
  3680. </p>
  3681. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3682. <p class=desc>NOT SUPPORTED BY THE AK4558
  3683. </p>
  3684. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3685. <p class=desc>not implemented yet
  3686. </p>
  3687. <h3>Examples</h3>
  3688. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; PassthroughTest
  3689. </p>
  3690. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; SineOutTest
  3691. </p>
  3692. <h3>Notes</h3>
  3693. <p>TODO: Implement inputSelect() function to enable mono left, mono right, stereo operation.</p>
  3694. <p>TODO: Implement ADC and DAC filters control.</p>
  3695. <p>TODO: Implement DAC level attenuator attack rate modifier.</p>
  3696. </script>
  3697. <script type="text/x-red" data-template-name="AudioControlAK4558">
  3698. <div class="form-row">
  3699. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3700. <input type="text" id="node-input-name" placeholder="Name">
  3701. </div>
  3702. </script>
  3703. <script type="text/x-red" data-help-name="AudioControlCS4272">
  3704. <h3>Summary</h3>
  3705. <div class=tooltipinfo>
  3706. <p>Control the CS4272 chip on the <a href="https://hackaday.io/project/5912-teensy-super-audio-board" target="_blank">Super Audio Board</a>.
  3707. </p>
  3708. <p>TODO: does this control object put the CS4272 into I2S master or slave mode</p>
  3709. </div>
  3710. <h3>Audio Connections</h3>
  3711. <p>This object has no audio inputs or outputs. Separate I2S objects
  3712. are used to send and receive audio data.
  3713. </p>
  3714. <h3>Functions</h3>
  3715. <p class=func><span class=keyword>enable</span>();</p>
  3716. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3717. </p>
  3718. <p class=func><span class=keyword>volume</span>(vol);</p>
  3719. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3720. </p>
  3721. <p class=func><span class=keyword>volume</span>(left, right);</p>
  3722. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3723. </p>
  3724. <p class=func><span class=keyword>dacVolume</span>(vol);</p>
  3725. <p class=desc>Set the volume level. Range is 0 to 1.0. TODO: what's the
  3726. distinction between volume() and dacVolume()?
  3727. </p>
  3728. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  3729. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3730. </p>
  3731. <p class=func><span class=keyword>muteOutput</span>();</p>
  3732. <p class=desc>TODO: description
  3733. </p>
  3734. <p class=func><span class=keyword>unmuteOutput</span>();</p>
  3735. <p class=desc>TODO: description
  3736. </p>
  3737. <p class=func><span class=keyword>muteInput</span>();</p>
  3738. <p class=desc>TODO: description
  3739. </p>
  3740. <p class=func><span class=keyword>unmuteInput</span>();</p>
  3741. <p class=desc>TODO: description
  3742. </p>
  3743. <p class=func><span class=keyword>enableDither</span>();</p>
  3744. <p class=desc>TODO: description
  3745. </p>
  3746. <p class=func><span class=keyword>disableDither</span>();</p>
  3747. <p class=desc>TODO: description
  3748. </p>
  3749. <h3>Hardware</h3>
  3750. <p>Pin 2 must be connected to the CS4272 reset. SDA &amp; SCL are used for all control.
  3751. </p>
  3752. <h3>Notes</h3>
  3753. </script>
  3754. <script type="text/x-red" data-template-name="AudioControlCS4272">
  3755. <div class="form-row">
  3756. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3757. <input type="text" id="node-input-name" placeholder="Name">
  3758. </div>
  3759. </script>
  3760. <script type="text/x-red" data-help-name="AudioControlCS42448">
  3761. <h3>Summary</h3>
  3762. <div class=tooltipinfo>
  3763. <p>Control the CS42448 chip in TDM mode, for 6 inputs and 8 outputs.
  3764. </p>
  3765. <p align=center><img src="img/cs42448.jpg"></p>
  3766. </div>
  3767. </div>
  3768. <h3>Audio Connections</h3>
  3769. <p>This object has no audio inputs or outputs. Separate TDM objects
  3770. are used to send and receive audio data.
  3771. </p>
  3772. <h3>Functions</h3>
  3773. <p class=func><span class=keyword>enable</span>();</p>
  3774. <p class=desc>Enables the CS42448 to work in TDM mode.
  3775. </p>
  3776. <p class=func><span class=keyword>volume</span>(level);</p>
  3777. <p class=desc>Set the volume level for all output channels. Range is 0 to 1.0.
  3778. </p>
  3779. <p class=func><span class=keyword>volume</span>(channel, level);</p>
  3780. <p class=desc>Set the volume level for a single output. Channel is 1 to 8. Range is 0 to 1.0.
  3781. </p>
  3782. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3783. <p class=desc>Set the input gain level for all input channels. Range is 0 to 15.85.
  3784. </p>
  3785. <p class=func><span class=keyword>inputLevel</span>(channel, level);</p>
  3786. <p class=desc>Set the input gain level for a single input. Channel is 1 to 6. Range is 0 to 15.85.
  3787. </p>
  3788. <h3>Hardware</h3>
  3789. <p>Tested with this <a href="https://oshpark.com/shared_projects/2Yj6rFaW">
  3790. CS42448 Circuit Board</a>.
  3791. </p>
  3792. <p align=center><img src="img/tdm.jpg"></p>
  3793. </div>
  3794. <h3>Notes</h3>
  3795. </script>
  3796. <script type="text/x-red" data-template-name="AudioControlCS42448">
  3797. <div class="form-row">
  3798. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3799. <input type="text" id="node-input-name" placeholder="Name">
  3800. </div>
  3801. </script>
  3802. </body>
  3803. </html>