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

3939 satır
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_CY15B104</span> is used, a single
  2490. CY15B104 FRAM chip is used, with these pins:
  2491. <table class=doc align=center cellpadding=3>
  2492. <tr class=top><th>Pin</th><th>Signal</th></tr>
  2493. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  2494. <tr class=odd><td align=center>7</td><td>SI</td></tr>
  2495. <tr class=odd><td align=center>12</td><td>SO</td></tr>
  2496. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  2497. </table>
  2498. </p>
  2499. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  2500. 23LC1024 chips are used.
  2501. </p>
  2502. <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>
  2503. <p>
  2504. <table class=doc align=center cellpadding=3>
  2505. <tr class=top><th>Pin</th><th>Signal</th></tr>
  2506. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  2507. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  2508. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  2509. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  2510. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  2511. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  2512. </table>
  2513. </p>
  2514. <p>
  2515. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  2516. must be used. See below for details. Each chip provides 1485 ms of delay
  2517. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  2518. exceed the amount of memory physically present.
  2519. </p>
  2520. <h3>Examples</h3>
  2521. <p>
  2522. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  2523. </p>
  2524. <!--
  2525. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  2526. </p>
  2527. -->
  2528. <p>
  2529. <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)
  2530. </p>
  2531. <h3>Notes</h3>
  2532. <p>External RAM allows for longer delays without consuming
  2533. limited internal RAM. However, SPI communication is required,
  2534. which consumes much more CPU time. The
  2535. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  2536. function may be used to monitor how much CPU time is consumed.
  2537. </p>
  2538. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  2539. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  2540. chips.
  2541. </p>
  2542. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  2543. </p>
  2544. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  2545. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  2546. channels of a stereo signal.
  2547. <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);
  2548. </p>
  2549. <p>When using CY15B104, you
  2550. <a href="https://forum.pjrc.com/threads/45872-Memory-Chip-for-Audio-Adaptor-Board?p=151839&viewfull=1#post151839">may need to add a capacitor between 3.3V & GND</a>
  2551. to make the chip work.
  2552. </p>
  2553. </script>
  2554. <script type="text/x-red" data-template-name="AudioEffectDelayExternal">
  2555. <div class="form-row">
  2556. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2557. <input type="text" id="node-input-name" placeholder="Name">
  2558. </div>
  2559. </script>
  2560. <script type="text/x-red" data-help-name="AudioEffectBitcrusher">
  2561. <h3>Summary</h3>
  2562. <div class=tooltipinfo>
  2563. <p>Reduce the samplerate and/or bitdepth of a source signal, resulting in
  2564. a distorted sound.</p>
  2565. </div>
  2566. <h3>Audio Connections</h3>
  2567. <table class=doc align=center cellpadding=3>
  2568. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2569. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  2570. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  2571. </table>
  2572. <h3>Functions</h3>
  2573. <p class=func><span class=keyword>bits</span>(xcrushBits);</p>
  2574. <p class=desc>xcrushBits sets the bitdepth, from 1 to 16. A Value of 16
  2575. does not crush the bitdepth, and is effectively a passthru for this part
  2576. of the function.</p>
  2577. <p class=func><span class=keyword>sampleRate</span>(xsampleRate);</p>
  2578. <p class=desc>xsampleRate sets the frequency, from 1 to 44100Hz, however it
  2579. works in integer steps so you will only really get a handful of results from
  2580. the many samplerates you can pass. 44100 is passthru.</p>
  2581. <p class=desc>set xbitDepth to 16 and xsampleRate to 44100 to pass audio
  2582. through without any Bitcrush effect.</p>
  2583. <h3>Examples</h3>
  2584. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Bitcrusher
  2585. </p>
  2586. <h3>Notes</h3>
  2587. <p>Needs a lot of improvement. Options for anti-aliasing would be nice in
  2588. the future, but for now, it's rough, it's dirty and it sounds a bit like
  2589. Nine Inch Nails.
  2590. </p>
  2591. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  2592. should be used when changing
  2593. settings on multiple objects, so all changes always take effect
  2594. at the same moment.
  2595. </p>
  2596. </script>
  2597. <script type="text/x-red" data-template-name="AudioEffectBitcrusher">
  2598. <div class="form-row">
  2599. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2600. <input type="text" id="node-input-name" placeholder="Name">
  2601. </div>
  2602. </script>
  2603. <script type="text/x-red" data-help-name="AudioEffectMidSide">
  2604. <h3>Summary</h3>
  2605. <div class=tooltipinfo>
  2606. <p>Convert stereo signals to/from Mid-Side format.
  2607. Mid-Side encoding can be used to increase stereo width, make the lower
  2608. frequencies mono (to please your sub), or as the basis of audio compression.</p>
  2609. </div>
  2610. <h3>Audio Connections</h3>
  2611. <table class=doc align=center cellpadding=3>
  2612. <tr class=top><th>Port</th><th>While<br>Encoding</th><th>While<br>Decoding</th></tr>
  2613. <tr class=odd><td align=center>In 0</td><td>Left Input</td><td>Mid Output</td></tr>
  2614. <tr class=odd><td align=center>In 1</td><td>Right Input</td><td>Side Output</td></tr>
  2615. <tr class=odd><td align=center>Out 0</td><td>Mid Input</td><td>Left Output</td></tr>
  2616. <tr class=odd><td align=center>Out 1</td><td>Side Input</td><td>Right Output</td></tr>
  2617. </table>
  2618. <h3>Functions</h3>
  2619. <p class=func><span class=keyword>encode</span>();</p>
  2620. <p class=desc>Configure this object to encode from stereo to Mid-Side format.</p>
  2621. <p class=func><span class=keyword>decode</span>();</p>
  2622. <p class=desc>Configure this object to decode from Mid-Side format back to stereo signals.</p>
  2623. <h3>Examples</h3>
  2624. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>
  2625. <h3>Notes</h3>
  2626. <p>Many interesting stereo effects can be achieved by manipulating Mid-Side signals.</p>
  2627. <p>Normally a pair of these objects are used, one to encode, then additional
  2628. gain/attenuation or effects applied to the Mid-Side signals, and finally
  2629. decoding back to stereo signals</p>
  2630. <p>To prevent saturation, halving is done in the encoding, that is:</p>
  2631. <p>Mid = (left+right)/2</p>
  2632. <p>Side = (left-right)/2</p>
  2633. <p>And to decode:</p>
  2634. <p>Left = Mid+Side</p>
  2635. <p>Right = Mid-Side</p>
  2636. </script>
  2637. <script type="text/x-red" data-template-name="AudioEffectMidSide">
  2638. <div class="form-row">
  2639. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2640. <input type="text" id="node-input-name" placeholder="Name">
  2641. </div>
  2642. </script>
  2643. <script type="text/x-red" data-help-name="AudioEffectWaveshaper">
  2644. <h3>Summary</h3>
  2645. <div class=tooltipinfo>
  2646. <p>Modify the waveform shape of a signal.</p>
  2647. <p align=center><img src="img/waveshaper.png"></p>
  2648. <p>Useful for overdrive, distortion, fuzz,
  2649. clipping, expo converters, phase inversion, waveform modification &amp; adjustments.
  2650. </p>
  2651. </div>
  2652. <h3>Audio Connections</h3>
  2653. <table class=doc align=center cellpadding=3>
  2654. <tr class=top><th>Port</th><th>Signal</th></tr>
  2655. <tr class=odd><td align=center>In 0</td><td>Original Input Signal</td></tr>
  2656. <tr class=odd><td align=center>Out 0</td><td>Shaped Output</td></tr>
  2657. </table>
  2658. <h3>Functions</h3>
  2659. <p class=func><span class=keyword>shape</span>(array, length);</p>
  2660. <p class=desc>Configure the waveform shape. Array is a list of float
  2661. numbers, given in order. The first number maps to input -1.0. The
  2662. last maps to input +1.0. The numbers represent the desired output
  2663. level at each of these input levels. Length must be 2, 3, 5, 9, 17,
  2664. 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, or 32769.
  2665. </p>
  2666. <h3>Examples</h3>
  2667. <p class=exam>TODO: example needed</p>
  2668. <!--<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Mid_Side</p>-->
  2669. <h3>Notes</h3>
  2670. <p><a href="https://github.com/dxinteractive/TeensyAudioWaveshaper">More information</a>
  2671. </p>
  2672. </script>
  2673. <script type="text/x-red" data-template-name="AudioEffectWaveshaper">
  2674. <div class="form-row">
  2675. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2676. <input type="text" id="node-input-name" placeholder="Name">
  2677. </div>
  2678. </script>
  2679. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  2680. <h3>Summary</h3>
  2681. <div class=tooltipinfo>
  2682. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  2683. Up to 4 stages may be cascaded.
  2684. </p>
  2685. <p align=center><img src="img/biquad.png"></p>
  2686. </div>
  2687. <h3>Audio Connections</h3>
  2688. <table class=doc align=center cellpadding=3>
  2689. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2690. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2691. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2692. </table>
  2693. <h3>Functions</h3>
  2694. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  2695. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  2696. response, with the specified corner frequency and Q shape. If Q is
  2697. higher that 0.7071, be careful of filter gain (see below).
  2698. </p>
  2699. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  2700. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  2701. response, with the specified corner frequency and Q shape. If Q is
  2702. higher that 0.7071, be careful of filter gain (see below).
  2703. </p>
  2704. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  2705. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  2706. response. The filter has unity gain at the specified frequency. Q
  2707. controls the width of frequencies allowed to pass.
  2708. </p>
  2709. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  2710. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  2711. response. Q controls the width of rejected frequencies.
  2712. </p>
  2713. <p class=func><span class=keyword>setLowShelf</span>(stage, frequency, gain, slope);</p>
  2714. <p class=desc>Configure one stage of the filter (0 to 3) with low shelf response.
  2715. A low shelf filter attenuates or amplifies signals below the specified frequency.
  2716. Frequency controls the slope midpoint, gain is in dB and can be both
  2717. positive or negative. The slope parameter controls steepness of gain transition.
  2718. A slope of 1 yields maximum steepness without overshoot,
  2719. lower values yield a less steep slope. See the picture below for a visualization
  2720. of the slope parameter's effect.
  2721. Be careful with positive gains and slopes higher than 1 as they introduce gain
  2722. (see warning below).
  2723. </p>
  2724. </p>
  2725. <p class=func><span class=keyword>setHighShelf</span>(stage, frequency, gain, slope);</p>
  2726. <p class=desc>Configure one stage of the filter (0 to 3) with high shelf response.
  2727. A high shelf filter attenuates or amplifies signals above the specified frequency.
  2728. Frequency controls the slope midpoint, gain is in dB and can be both
  2729. positive or negative. The slope parameter controls steepness of gain transition.
  2730. A slope of 1 yields maximum steepness without overshoot,
  2731. lower values yield a less steep slope. See the picture below for a visualization
  2732. of the slope parameter's effect.
  2733. Be careful with positive gains and slopes higher than 1 as they introduce gain
  2734. (see warning below).
  2735. </p>
  2736. <p align=center><img src="img/shelf_filter.png"></p>
  2737. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  2738. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  2739. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  2740. Each coefficient must be less than 2.0 and greater than -2.0. The array
  2741. should be type double. Alternately, it may be type int, where 1.0 is
  2742. represented with 1073741824 (2<sup>30</sup>).
  2743. </p>
  2744. <h3>Examples</h3>
  2745. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  2746. </p>
  2747. <h3>Notes</h3>
  2748. <p>Filters can with gain must have their input signals attenuated, so the
  2749. signal does not exceed 1.0.
  2750. </p>
  2751. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  2752. not pass any signal.
  2753. </p>
  2754. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  2755. trouble with limited numerical precision, causing the filter to perform
  2756. poorly. For very low corner frequency, the State Variable (Chamberlin)
  2757. filter should be used.
  2758. </p>
  2759. </script>
  2760. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  2761. <div class="form-row">
  2762. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2763. <input type="text" id="node-input-name" placeholder="Name">
  2764. </div>
  2765. </script>
  2766. <script type="text/x-red" data-help-name="AudioFilterFIR">
  2767. <h3>Summary</h3>
  2768. <div class=tooltipinfo>
  2769. <p>Finite impulse response filter, useful for all sorts of filtering.
  2770. </p>
  2771. <p align=center><img src="img/fir_filter.png"></p>
  2772. </div>
  2773. <h3>Audio Connections</h3>
  2774. <table class=doc align=center cellpadding=3>
  2775. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2776. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  2777. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  2778. </table>
  2779. <h3>Functions</h3>
  2780. <p class=func><span class=keyword>begin</span>(array, length);</p>
  2781. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  2782. filter's impulse response), and
  2783. length indicates the number of points in the array. Array may also be
  2784. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  2785. filtering.
  2786. </p>
  2787. <p class=func><span class=keyword>end</span>();</p>
  2788. <p class=desc>Turn the filter off.
  2789. </p>
  2790. <h3>Examples</h3>
  2791. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  2792. </p>
  2793. <h3>Known Issues</h3>
  2794. <p>Your filter's impulse response array must have an even length. If you have
  2795. add odd number of taps, you must add an extra zero to increase the length
  2796. to an even number.
  2797. </p>
  2798. <p>The minimum number of taps is 4. If you use less, add extra zeros to increase
  2799. the length to 4.
  2800. </p>
  2801. <p>The impulse response must be given in reverse order. Many filters have
  2802. symetrical impluse response, making this a non-issue. If your filter has
  2803. a non-symetrical response, make sure the data is in reverse time order.
  2804. </p>
  2805. <h3>Notes</h3>
  2806. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  2807. implement filters with better phase response.
  2808. </p>
  2809. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  2810. supported filter length is 200 points.
  2811. </p>
  2812. <p>The free
  2813. <a href="http://t-filter.engineerjs.com/" target="_blank"> TFilter Design Tool</a>
  2814. can be used to create the impulse response array. Be sure to set the sampling
  2815. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  2816. </p>
  2817. <p>
  2818. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  2819. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  2820. and add "const" to avoid consuming extra RAM.
  2821. </p>
  2822. </script>
  2823. <script type="text/x-red" data-template-name="AudioFilterFIR">
  2824. <div class="form-row">
  2825. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2826. <input type="text" id="node-input-name" placeholder="Name">
  2827. </div>
  2828. </script>
  2829. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  2830. <h3>Summary</h3>
  2831. <div class=tooltipinfo>
  2832. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  2833. adjustable resonance, and optional signal control of corner
  2834. frequency.</p>
  2835. </div>
  2836. <h3>Audio Connections</h3>
  2837. <table class=doc align=center cellpadding=3>
  2838. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2839. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  2840. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  2841. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  2842. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  2843. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  2844. </table>
  2845. <h3>Functions</h3>
  2846. <p class=func><span class=keyword>frequency</span>(freq);</p>
  2847. <p class=desc>Set the filter's corner frequency. When a signal is
  2848. connected to the control input, the filter will implement this
  2849. frequency when the signal is zero.
  2850. </p>
  2851. <p class=func><span class=keyword>resonance</span>(Q);</p>
  2852. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  2853. Resonance greater than 0.707 will amplify the signal near the
  2854. corner frequency. You must attenuate the signal before input
  2855. to this filter, to prevent clipping.
  2856. </p>
  2857. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  2858. <p class=desc>Set how much (in octaves) the control signal can alter
  2859. the filter's corner freqency. Range is 0 to 7 octaves. For
  2860. example, when set to 2.5, a full scale positive signal (1.0) will
  2861. shift the filter frequency up 2.5 octaves, and a full scale negative
  2862. signal will shift it down 2.5 octaves.
  2863. </p>
  2864. <!--
  2865. <h3>Examples</h3>
  2866. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2867. </p>
  2868. -->
  2869. <h3>Notes</h3>
  2870. <p>
  2871. When controlled by a signal, the equation for the filter
  2872. frequency is:
  2873. </p>
  2874. <p>
  2875. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  2876. <br><small>If anyone knows how to do HTML equations, please
  2877. help me improve this.....</small>
  2878. </p>
  2879. <p>When operating with signal control of corner frequency, this
  2880. object uses approximately 4% of the CPU time on Teensy 3.1.
  2881. </p>
  2882. </script>
  2883. <script type="text/x-red" data-template-name="AudioFilterStateVariable">
  2884. <div class="form-row">
  2885. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2886. <input type="text" id="node-input-name" placeholder="Name">
  2887. </div>
  2888. </script>
  2889. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  2890. <h3>Summary</h3>
  2891. <div class=tooltipinfo>
  2892. <p>Track the signal peak amplitude. Very useful for simple
  2893. audio level response projects, and general troubleshooting.</p>
  2894. </div>
  2895. <h3>Audio Connections</h3>
  2896. <table class=doc align=center cellpadding=3>
  2897. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2898. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2899. </table>
  2900. <h3>Functions</h3>
  2901. <p class=func><span class=keyword>available</span>();</p>
  2902. <p class=desc>Returns true each time new peak data is available.
  2903. </p>
  2904. <p class=func><span class=keyword>read</span>();</p>
  2905. <p class=desc>Read the highest peak amplitude value since the last read.
  2906. Return is from 0.0 to 1.0.
  2907. </p>
  2908. <p class=func><span class=keyword>readPeakToPeak</span>();</p>
  2909. <p class=desc>Read the highest peak-to-peak amplitude since the last read.
  2910. Return is from 0.0 to 2.0.
  2911. </p>
  2912. <h3>Examples</h3>
  2913. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  2914. </p>
  2915. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  2916. </p>
  2917. <h3>Notes</h3>
  2918. <p></p>
  2919. </script>
  2920. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  2921. <div class="form-row">
  2922. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2923. <input type="text" id="node-input-name" placeholder="Name">
  2924. </div>
  2925. </script>
  2926. <script type="text/x-red" data-help-name="AudioAnalyzeRMS">
  2927. <h3>Summary</h3>
  2928. <div class=tooltipinfo>
  2929. <p>Track the signal RMS amplitude. Useful for
  2930. audio level response projects, and general troubleshooting.</p>
  2931. </div>
  2932. <h3>Audio Connections</h3>
  2933. <table class=doc align=center cellpadding=3>
  2934. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2935. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2936. </table>
  2937. <h3>Functions</h3>
  2938. <p class=func><span class=keyword>available</span>();</p>
  2939. <p class=desc>Returns true if new RMS data is available.
  2940. </p>
  2941. <p class=func><span class=keyword>read</span>();</p>
  2942. <p class=desc>Read the new RMS value.
  2943. Return is from 0.0 to 1.0.
  2944. </p>
  2945. <h3>Examples</h3>
  2946. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakAndRMSMeterStereo</p>
  2947. </p>
  2948. <h3>Notes</h3>
  2949. <p></p>
  2950. </script>
  2951. <script type="text/x-red" data-template-name="AudioAnalyzeRMS">
  2952. <div class="form-row">
  2953. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2954. <input type="text" id="node-input-name" placeholder="Name">
  2955. </div>
  2956. </script>
  2957. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  2958. <h3>Summary</h3>
  2959. <div class=tooltipinfo>
  2960. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  2961. with real value (magnitude) output. The frequency resolution is
  2962. 172 Hz, useful for simple audio visualization.</p>
  2963. </div>
  2964. <h3>Audio Connections</h3>
  2965. <table class=doc align=center cellpadding=3>
  2966. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2967. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2968. </table>
  2969. <h3>Functions</h3>
  2970. <p class=func><span class=keyword>available</span>();</p>
  2971. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2972. </p>
  2973. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2974. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  2975. so 1.0 represents a full scale sine wave.
  2976. </p>
  2977. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2978. <p class=desc>Read several frequency bins, returning their sum. The higher
  2979. audio octaves are represented by many bins, which are typically read
  2980. as a group for audio visualization.
  2981. </p>
  2982. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2983. <p class=desc>New data is produced very radidly, approximately 344 times
  2984. per second. Multiple outputs can be averaged together, so available()
  2985. returns true at a slower rate.
  2986. </p>
  2987. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2988. <p class=desc>Set the window function to be used. AudioWindowHanning256
  2989. is the default. Windowing may be disabled by NULL, but windowing
  2990. should be used for all non-periodic (music) signals, and all periodic
  2991. signals that are not exact integer division of the sample rate.
  2992. </p>
  2993. <h3>Examples</h3>
  2994. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2995. </p>
  2996. <h3>Notes</h3>
  2997. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2998. num is 0 to 127.</p>
  2999. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  3000. <p>Window Types:
  3001. <ul>
  3002. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  3003. <li><span class=literal>AudioWindowBartlett256</span></li>
  3004. <li><span class=literal>AudioWindowBlackman256</span></li>
  3005. <li><span class=literal>AudioWindowFlattop256</span></li>
  3006. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  3007. <li><span class=literal>AudioWindowNuttall256</span></li>
  3008. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  3009. <li><span class=literal>AudioWindowWelch256</span></li>
  3010. <li><span class=literal>AudioWindowHamming256</span></li>
  3011. <li><span class=literal>AudioWindowCosine256</span></li>
  3012. <li><span class=literal>AudioWindowTukey256</span></li>
  3013. </ul>
  3014. </p>
  3015. </script>
  3016. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  3017. <div class="form-row">
  3018. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3019. <input type="text" id="node-input-name" placeholder="Name">
  3020. </div>
  3021. </script>
  3022. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  3023. <h3>Summary</h3>
  3024. <div class=tooltipinfo>
  3025. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  3026. with real value (magnitude) output. The frequency resolution is
  3027. 43 Hz, useful detailed for audio visualization.</p>
  3028. </div>
  3029. <h3>Audio Connections</h3>
  3030. <table class=doc align=center cellpadding=3>
  3031. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3032. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  3033. </table>
  3034. <h3>Functions</h3>
  3035. <p class=func><span class=keyword>available</span>();</p>
  3036. <p class=desc>Returns true each time the FFT analysis produces new output data.
  3037. </p>
  3038. <p class=func><span class=keyword>read</span>(binNumber);</p>
  3039. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  3040. so 1.0 represents a full scale sine wave.
  3041. </p>
  3042. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  3043. <p class=desc>Read several frequency bins, returning their sum. The higher
  3044. audio octaves are represented by many bins, which are typically read
  3045. as a group for audio visualization.
  3046. </p>
  3047. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  3048. <p class=desc>This function does nothing. The 1024 point FFT always
  3049. updates at approximately 86 times per second.
  3050. </p>
  3051. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  3052. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  3053. is the default. Windowing may be disabled by NULL, but windowing
  3054. should be used for all non-periodic (music) signals, and all periodic
  3055. signals that are not exact integer division of the sample rate.
  3056. </p>
  3057. <h3>Examples</h3>
  3058. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  3059. </p>
  3060. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  3061. </p>
  3062. <h3>Notes</h3>
  3063. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  3064. num is 0 to 511.</p>
  3065. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  3066. <p>Window Types:
  3067. <ul>
  3068. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  3069. <li><span class=literal>AudioWindowBartlett1024</span></li>
  3070. <li><span class=literal>AudioWindowBlackman1024</span></li>
  3071. <li><span class=literal>AudioWindowFlattop1024</span></li>
  3072. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  3073. <li><span class=literal>AudioWindowNuttall1024</span></li>
  3074. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  3075. <li><span class=literal>AudioWindowWelch1024</span></li>
  3076. <li><span class=literal>AudioWindowHamming1024</span></li>
  3077. <li><span class=literal>AudioWindowCosine1024</span></li>
  3078. <li><span class=literal>AudioWindowTukey1024</span></li>
  3079. </ul>
  3080. </p>
  3081. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  3082. Average usage is much lower. Future versions might distribute the
  3083. load more evenly over time....
  3084. </p>
  3085. </script>
  3086. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  3087. <div class="form-row">
  3088. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3089. <input type="text" id="node-input-name" placeholder="Name">
  3090. </div>
  3091. </script>
  3092. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  3093. <h3>Summary</h3>
  3094. <div class=tooltipinfo>
  3095. <p>Detect the level of a single tone</p>
  3096. </div>
  3097. <h3>Audio Connections</h3>
  3098. <table class=doc align=center cellpadding=3>
  3099. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3100. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  3101. </table>
  3102. <h3>Functions</h3>
  3103. <p class=func><span class=keyword>frequency</span>(freq);</p>
  3104. <p class=desc>Set the frequency to detect. The default detection time
  3105. will be 10 cycles of this frequency.
  3106. </p>
  3107. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  3108. <p class=desc>Set the frequency to detect, and the number of cycles.
  3109. Longer detection time (more cycles) will give higher precision,
  3110. but of course slower response.
  3111. </p>
  3112. <p class=func><span class=keyword>available</span>();</p>
  3113. <p class=desc>Returns true (non-zero) each time a detection interval
  3114. (number of cycles) completed and a new level is detected.
  3115. </p>
  3116. <p class=func><span class=keyword>read</span>();</p>
  3117. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  3118. </p>
  3119. <p class=func><span class=keyword>threshold</span>(level);</p>
  3120. <p class=desc>Set a detection threshold, where the bool test operation
  3121. will return true if at or above this level, or false when below.
  3122. </p>
  3123. <p class=func>(bool)</p>
  3124. <p class=desc>By testing the object as a boolean value, you can respond
  3125. to detection of a tone.
  3126. </p>
  3127. <h3>Examples</h3>
  3128. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  3129. </p>
  3130. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  3131. </p>
  3132. <h3>Notes</h3>
  3133. <p>Low frequency detection has trouble with numerical precision.
  3134. Works really well for all 8 DTMF frequencies, but fails for
  3135. detecting "sub audible tones" used in some control applications.</p>
  3136. <p>The (bool) test continues to return true until the next detection
  3137. interval (the configured number of cycles). This behavior may
  3138. change in future versions, for a single true each time the signal
  3139. is detected, and then false for the remainder of that interval.</p>
  3140. </script>
  3141. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  3142. <div class="form-row">
  3143. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3144. <input type="text" id="node-input-name" placeholder="Name">
  3145. </div>
  3146. </script>
  3147. <script type="text/x-red" data-help-name="AudioAnalyzeNoteFrequency">
  3148. <h3>Summary</h3>
  3149. <div class=tooltipinfo>
  3150. <p>Detect with fairly good accuracy the fundamental frequency f<sub>o</sub>
  3151. of musical notes, such as electric guitar and bass.</p>
  3152. </div>
  3153. <p>Written By Collin Duffy</p>
  3154. <h3>Audio Connections</h3>
  3155. <table class=doc align=center cellpadding=3>
  3156. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3157. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  3158. </table>
  3159. <h3>Functions</h3>
  3160. <p class=func><span class=keyword>begin</span>(threshold);</p>
  3161. <p class=desc>Initialize and start detecting frequencies,
  3162. with an initial threshold (the amount of allowed uncertainty).
  3163. </p>
  3164. <p class=func><span class=keyword>available</span>();</p>
  3165. <p class=desc>Returns true (non-zero) when a valid
  3166. frequency is detected.
  3167. </p>
  3168. <p class=func><span class=keyword>read</span>();</p>
  3169. <p class=desc>Read the detected frequency.
  3170. </p>
  3171. <p class=func><span class=keyword>probability</span>();</p>
  3172. <p class=desc>Return the level of certainty, betweeo 0 to 1.0.
  3173. </p>
  3174. <p class=func><span class=keyword>threshold</span>(level);</p>
  3175. <p class=desc>Set the detection threshold, the amount of allowed uncertainty.
  3176. </p>
  3177. <h3>Examples</h3>
  3178. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; NoteFrequency
  3179. </p>
  3180. <h3>Notes</h3>
  3181. <p>The <a href="http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf">YIN algorithm</a> (PDF)
  3182. is used to detect frequencies, with many optimizations for
  3183. frequencies between 29-400Hz. This algorithm can be somewhat
  3184. memory and processor hungry but will allow you to detect with
  3185. fairly good accuracy the fundamental frequencies from
  3186. electric guitars and basses.</p>
  3187. <p>Within the code, AUDIO_GUITARTUNER_BLOCKS
  3188. may be edited to control low frequency range. The default
  3189. (24) allows measurement down to 29.14 Hz, or B(flat)0.</p>
  3190. <p>TODO: The usable upper range of this object is not well known.
  3191. Duff says "it should be good up to 1000Hz", but may have trouble
  3192. 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>
  3193. <p>This object was contributed by Collin Duffy from his
  3194. <a href="https://github.com/duff2013/AudioTuner">AudioTuner project</a>.
  3195. Additional details and documentation may be found there.</p>
  3196. </script>
  3197. <script type="text/x-red" data-template-name="AudioAnalyzeNoteFrequency">
  3198. <div class="form-row">
  3199. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3200. <input type="text" id="node-input-name" placeholder="Name">
  3201. </div>
  3202. </script>
  3203. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  3204. <h3>Summary</h3>
  3205. <div class=tooltipinfo>
  3206. <p>Print raw audio data to the Arduino Serial Monitor. This
  3207. object creates massive output quickly, and should not normally be used.</p>
  3208. </div>
  3209. <h3>Audio Connections</h3>
  3210. <table class=doc align=center cellpadding=3>
  3211. <tr class=top><th>Port</th><th>Purpose</th></tr>
  3212. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  3213. </table>
  3214. <h3>Functions</h3>
  3215. <p class=func><span class=keyword>name</span>(string);</p>
  3216. <p class=desc>blah blah blah blah
  3217. </p>
  3218. <p class=func><span class=keyword>trigger</span>();</p>
  3219. <p class=desc>blah blah blah blah
  3220. </p>
  3221. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  3222. <p class=desc>blah blah blah blah
  3223. </p>
  3224. <p class=func><span class=keyword>delay</span>(samples);</p>
  3225. <p class=desc>blah blah blah blah
  3226. </p>
  3227. <p class=func><span class=keyword>length</span>(samples);</p>
  3228. <p class=desc>blah blah blah blah
  3229. </p>
  3230. <!--
  3231. <h3>Examples</h3>
  3232. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3233. </p>
  3234. -->
  3235. <h3>Notes</h3>
  3236. <p>This object doesn't work very well and probably should not be used.</p>
  3237. </script>
  3238. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  3239. <div class="form-row">
  3240. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3241. <input type="text" id="node-input-name" placeholder="Name">
  3242. </div>
  3243. </script>
  3244. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  3245. <h3>Summary</h3>
  3246. <div class=tooltipinfo>
  3247. <p>Control the SGTL5000 chip on the
  3248. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  3249. SGTL5000 is always used in slave mode, where Teensy controls
  3250. all I2S timing.
  3251. </p>
  3252. <p align=center><img src="img/sgtl5000closeup.jpg"></p>
  3253. </div>
  3254. <h3>Audio Connections</h3>
  3255. <p>This object has no audio inputs or outputs. Separate i2s objects
  3256. are used to send and receive audio data. I2S master mode objects
  3257. must be used, because this object configures the SGTL5000 in slave
  3258. mode, where it depends on Teensy to provide all I2S clocks.
  3259. This object controls
  3260. how the SGTL5000 will use those I2S audio streams.</p>
  3261. <h3>Functions</h3>
  3262. <p>These are the most commonly used SGTL5000 functions.</p>
  3263. <p class=func><span class=keyword>enable</span>();</p>
  3264. <p class=desc>Start the SGTL5000. This function should be called first.
  3265. </p>
  3266. <p class=func><span class=keyword>volume</span>(level);</p>
  3267. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  3268. 0.8 corresponds to the maximum undistorted output for a full scale
  3269. signal. Usually 0.5 is a comfortable listening level. The line
  3270. level outputs are <em>not</em> changed by this function.
  3271. </p>
  3272. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3273. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  3274. </p>
  3275. <p class=func><span class=keyword>micGain</span>(dB);</p>
  3276. <p class=desc>When using the microphone input, set the amplifier gain.
  3277. The input number is in decibels, from 0 to 63.
  3278. </p>
  3279. <h3>Signal Levels</h3>
  3280. <p>The default signal levels should be used for most applications,
  3281. but these functions allow you to customize the analog signals.</p>
  3282. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  3283. <p class=desc>Silence the headphone output.
  3284. </p>
  3285. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  3286. <p class=desc>Turn the headphone output on.
  3287. </p>
  3288. <p class=func><span class=keyword>muteLineout</span>();</p>
  3289. <p class=desc>Silence the line level outputs.
  3290. </p>
  3291. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  3292. <p class=desc>Turn the line level outputs on.
  3293. </p>
  3294. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  3295. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  3296. Fifteen settings are possible:
  3297. </p>
  3298. <pre class="desc">
  3299. 0: 3.12 Volts p-p
  3300. 1: 2.63 Volts p-p
  3301. 2: 2.22 Volts p-p
  3302. 3: 1.87 Volts p-p
  3303. 4: 1.58 Volts p-p
  3304. 5: 1.33 Volts p-p (default)
  3305. 6: 1.11 Volts p-p
  3306. 7: 0.94 Volts p-p
  3307. 8: 0.79 Volts p-p
  3308. 9: 0.67 Volts p-p
  3309. 10: 0.56 Volts p-p
  3310. 11: 0.48 Volts p-p
  3311. 12: 0.40 Volts p-p
  3312. 13: 0.34 Volts p-p
  3313. 14: 0.29 Volts p-p
  3314. 15: 0.24 Volts p-p
  3315. </pre>
  3316. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  3317. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  3318. settings for left and right. The same 15 settings are available.
  3319. </p>
  3320. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  3321. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  3322. voltage range. The following settings are possible:
  3323. </p>
  3324. <pre class="desc">
  3325. 13: 3.16 Volts p-p
  3326. 14: 2.98 Volts p-p
  3327. 15: 2.83 Volts p-p
  3328. 16: 2.67 Volts p-p
  3329. 17: 2.53 Volts p-p
  3330. 18: 2.39 Volts p-p
  3331. 19: 2.26 Volts p-p
  3332. 20: 2.14 Volts p-p
  3333. 21: 2.02 Volts p-p
  3334. 22: 1.91 Volts p-p
  3335. 23: 1.80 Volts p-p
  3336. 24: 1.71 Volts p-p
  3337. 25: 1.62 Volts p-p
  3338. 26: 1.53 Volts p-p
  3339. 27: 1.44 Volts p-p
  3340. 28: 1.37 Volts p-p
  3341. 29: 1.29 Volts p-p (default)
  3342. 30: 1.22 Volts p-p
  3343. 31: 1.16 Volts p-p
  3344. </pre>
  3345. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  3346. <p class=desc>Adjust the line level outout voltage range, with separate
  3347. settings for left and right. The same settings (13 to 31) are available.
  3348. </p>
  3349. <h3>Signal Conditioning</h3>
  3350. <p>Usually these digital signal conditioning features should be left at their
  3351. default settings.
  3352. </p>
  3353. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  3354. <p class=desc>By default, the analog input (either line-level inputs or mic)
  3355. is high-pass filtered, to remove any DC component. This function
  3356. freezes the filter, so the current DC component is still substracted, but
  3357. the filter stops tracking any DC or low frequency changes.
  3358. </p>
  3359. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  3360. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  3361. low frequencies are allowed to enter the digital signal. This
  3362. <a href="http://openaudio.blogspot.com/2017/03/teensy-audio-board-self-noise.html">may
  3363. reduce noise</a> in some cases.
  3364. </p>
  3365. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  3366. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  3367. allows it to resume tracking DC and low frequency changes, if
  3368. previously frozen. This is the default setting.
  3369. </p>
  3370. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  3371. <p class=desc>Normally output volume should be used with volume(), which
  3372. changes the analog gain in the headphone amplifier. This function
  3373. on the other hand controls digital attenuation before conversion to analog, which
  3374. reduces resolution, but allows another fine control of output
  3375. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  3376. at 1.0.
  3377. </p>
  3378. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and graceful
  3379. ramping is handled by the chip so that a new volume may be set directly in
  3380. a single call.
  3381. </p>
  3382. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  3383. <p class=desc>Adjust the digital output volume separately on left and
  3384. right channels.
  3385. </p>
  3386. <p class=func><span class=keyword>dacVolumeRamp</span>();</p>
  3387. <p class=desc>Enable graceful volume ramping. The dacVolume adjusts gradually using
  3388. an exponential curve. Pops or loud clicks are avoided when making large
  3389. changes in volume level.
  3390. </p>
  3391. <p class=func><span class=keyword>dacVolumeRampLinear</span>();</p>
  3392. <p class=desc>Enable faster volume ramping. A slight click may be heard during a
  3393. large volume change.
  3394. </p>
  3395. <p class=func><span class=keyword>dacVolumeRampDisable</span>();</p>
  3396. <p class=desc>Do not use any gradual ramping. The zero cross feature still helps
  3397. for small changes, but large volume changes may produce a pop or click.
  3398. </p>
  3399. <h3>Audio Processor</h3>
  3400. <p>The optional digital audio processor is capable of implementing
  3401. one or more of: automatic volume control, surround sound control,
  3402. bass enhancement, and tonal adjustments (either a
  3403. simple tone control, or a parametric equalizer, or a graphic equalizer),
  3404. in that order.
  3405. </p>
  3406. <p>These signal processing features are implemented in the SGTL5000 chip,
  3407. so they do not consume CPU time on Teensy. However, the order of
  3408. these processes is fixed in the hardware.
  3409. </p>
  3410. <p>It is good practice to mute the outputs before enabling or disabling
  3411. the Audio Processor, to avoid clicks or thumps.
  3412. </p>
  3413. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  3414. <p class=desc>Enable the audio processor to pre-process the input
  3415. (from either line-level inputs or microphone) before it's sent
  3416. to Teensy by I2S.
  3417. </p>
  3418. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  3419. <p class=desc>Enable the audio processor to post-process Teensy's
  3420. I2S output before it's turned into analog signals for the
  3421. headphones and/or line level outputs.
  3422. </p>
  3423. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  3424. <p class=desc>Disable the audio processor.
  3425. </p>
  3426. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  3427. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  3428. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  3429. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  3430. as 2. <em>response</em> controls the integration time for the compressor and can take
  3431. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  3432. over a longer time, allowing short-term peaks through.
  3433. </p>
  3434. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  3435. knee' compressor is used to progressively compress louder values which are near to or above the
  3436. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  3437. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  3438. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  3439. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  3440. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  3441. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  3442. </p>
  3443. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  3444. <p class=desc>Enables auto volume control, using the previously specified settings.
  3445. </p>
  3446. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  3447. <p class=desc>Disables auto volume control.
  3448. </p>
  3449. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  3450. <p class=desc>Enable virtual surround processing, to give a broader and
  3451. deeper stereo image (even with mono input).
  3452. </p>
  3453. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  3454. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  3455. the width to maximum to avoid pops.
  3456. </p>
  3457. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  3458. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  3459. </p>
  3460. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  3461. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  3462. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  3463. </p>
  3464. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  3465. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  3466. the original stereo signal has bass levels boosted and is then mixed back into
  3467. the stereo signal, which is then optionally high pass filtered (to remove
  3468. inaudible subsonic frequencies).
  3469. </p>
  3470. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  3471. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  3472. enhancement level to zero.
  3473. </p>
  3474. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  3475. <p class=desc>Configures the bass enhancement by setting the levels of the
  3476. original stereo signal and the bass-enhanced mono level which will be mixed together.
  3477. There is no high-pass filter.
  3478. </p>
  3479. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  3480. steps of 0.5dB, to avoid pops.
  3481. </p>
  3482. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  3483. <p class=desc>Configures the bass enhancement by setting the levels of the
  3484. original stereo signal and the bass-enhanced mono level which will be mixed together.
  3485. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  3486. as follows:
  3487. </p>
  3488. <pre class="desc">
  3489. value frequency
  3490. 0 80Hz
  3491. 1 100Hz
  3492. 2 125Hz
  3493. 3 150Hz
  3494. 4 175Hz
  3495. 5 200Hz
  3496. 6 225Hz
  3497. </pre>
  3498. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  3499. steps of 0.5dB, to avoid pops.
  3500. </p>
  3501. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  3502. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  3503. one of</p>
  3504. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  3505. Equalizers and tone controls disabled, flat frequency response.</p>
  3506. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  3507. Enables the 7-band parametric equalizer, thus disabling the
  3508. tone controls and graphic equalizer.</p>
  3509. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  3510. Enables bass and treble tone controls, disabling the parametric
  3511. equalization and graphic equalizer.</p>
  3512. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  3513. Enables the five-band graphic equalizer, disabling the parametric
  3514. equalization and tone controls.</p>
  3515. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  3516. <p class=desc>Configures bass and treble tone controls, which are
  3517. implemented as one second order low pass filter (bass) in parallel with
  3518. one second order high pass filter (treble).
  3519. </p>
  3520. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  3521. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  3522. </p>
  3523. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  3524. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  3525. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  3526. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  3527. </p>
  3528. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  3529. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  3530. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  3531. </p>
  3532. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  3533. to avoid pops.
  3534. </p>
  3535. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  3536. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  3537. is specified along with a pointer to an array of filter coefficients.
  3538. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  3539. filters whose frequencies, gain, and Q may be freely configured, but each filter
  3540. can only be specified as a set of filter coefficients.
  3541. </p>
  3542. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  3543. <p class=desc>Enables zero or more of the already enabled parametric filters.
  3544. </p>
  3545. <h3>Examples</h3>
  3546. <p>Nearly all of the library's examples use this object. These
  3547. examples demonstrate its special features.
  3548. </p>
  3549. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  3550. </p>
  3551. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  3552. </p>
  3553. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  3554. </p>
  3555. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  3556. </p>
  3557. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  3558. </p>
  3559. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  3560. </p>
  3561. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; VolumeRamp
  3562. </p>
  3563. <h3>Notes</h3>
  3564. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  3565. and surround enhancement while speech uses bandpass filtering and auto volume control
  3566. compression.
  3567. </p>
  3568. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  3569. </p>
  3570. </script>
  3571. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  3572. <div class="form-row">
  3573. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3574. <input type="text" id="node-input-name" placeholder="Name">
  3575. </div>
  3576. </script>
  3577. <script type="text/x-red" data-help-name="AudioControlWM8731">
  3578. <h3>Summary</h3>
  3579. <div class=tooltipinfo>
  3580. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  3581. </div>
  3582. <h3>Audio Connections</h3>
  3583. <p>This object has no audio inputs or outputs. Separate i2s objects
  3584. are used to send and receive audio data. I2S master mode objects
  3585. must be used, since this control object configures the WM8731 into
  3586. slave mode.
  3587. </p>
  3588. <h3>Functions</h3>
  3589. <p class=func><span class=keyword>enable</span>();</p>
  3590. <p class=desc>blah blah blah blah
  3591. </p>
  3592. <p class=func><span class=keyword>disable</span>();</p>
  3593. <p class=desc>not implemented
  3594. </p>
  3595. <p class=func><span class=keyword>volume</span>(level);</p>
  3596. <p class=desc>blah blah blah blah
  3597. </p>
  3598. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3599. <p class=desc>not implemented
  3600. </p>
  3601. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3602. <p class=desc>not implemented
  3603. </p>
  3604. <!--
  3605. <h3>Examples</h3>
  3606. <p class=exam>File &gt; Examples &gt; Audio &gt;
  3607. </p>
  3608. -->
  3609. <h3>Notes</h3>
  3610. <p></p>
  3611. </script>
  3612. <script type="text/x-red" data-template-name="AudioControlWM8731">
  3613. <div class="form-row">
  3614. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3615. <input type="text" id="node-input-name" placeholder="Name">
  3616. </div>
  3617. </script>
  3618. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  3619. <h3>Summary</h3>
  3620. <div class=tooltipinfo>
  3621. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  3622. </div>
  3623. <h3>Audio Connections</h3>
  3624. <p>This object has no audio inputs or outputs. Separate i2s objects
  3625. are used to send and receive audio data. I2S slave mode objects
  3626. must be used, since this control object configures the WM8731 into
  3627. master mode.
  3628. </p>
  3629. <h3>Functions</h3>
  3630. <p class=func><span class=keyword>enable</span>();</p>
  3631. <p class=desc>blah blah blah blah
  3632. </p>
  3633. <p class=func><span class=keyword>disable</span>();</p>
  3634. <p class=desc>not implemented
  3635. </p>
  3636. <p class=func><span class=keyword>volume</span>(level);</p>
  3637. <p class=desc>blah blah blah blah
  3638. </p>
  3639. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3640. <p class=desc>not implemented
  3641. </p>
  3642. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3643. <p class=desc>not implemented
  3644. </p>
  3645. <h3>Examples</h3>
  3646. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  3647. </p>
  3648. <h3>Notes</h3>
  3649. <p></p>
  3650. </script>
  3651. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  3652. <div class="form-row">
  3653. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3654. <input type="text" id="node-input-name" placeholder="Name">
  3655. </div>
  3656. </script>
  3657. <script type="text/x-red" data-help-name="AudioControlAK4558">
  3658. <h3>Summary</h3>
  3659. <div class=tooltipinfo>
  3660. <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>
  3661. in slave mode, where the Teensy controls all I2S timing.</p>
  3662. </div>
  3663. <h3>Audio Connections</h3>
  3664. <p>This object has no audio inputs or outputs. Separate I2S objects
  3665. are used to send and receive audio data.
  3666. </p>
  3667. <h3>Functions</h3>
  3668. <p class=func><span class=keyword>enable</span>();</p>
  3669. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3670. </p>
  3671. <p class=func><span class=keyword>enableIn</span>();</p>
  3672. <p class=desc>Enables the ADC module.
  3673. </p>
  3674. <p class=func><span class=keyword>enableOut</span>();</p>
  3675. <p class=desc>Enables the DAC module.
  3676. </p>
  3677. <p class=func><span class=keyword>disable</span>();</p>
  3678. <p class=desc>Disables the ADC and the DAC modules.
  3679. </p>
  3680. <p class=func><span class=keyword>disableIn</span>();</p>
  3681. <p class=desc>Disable the ADC module.
  3682. </p>
  3683. <p class=func><span class=keyword>disableOut</span>();</p>
  3684. <p class=desc>Disable the DAC module.
  3685. </p>
  3686. <p class=func><span class=keyword>volume</span>(level);</p>
  3687. <p class=desc>Accepts a float in range 0.0-1.0 and sets the line output volume accordingly.
  3688. </p>
  3689. <p class=func><span class=keyword>volumeLeft</span>(level);</p>
  3690. <p class=desc>Accepts a float in range 0.0-1.0 and sets the left line output volume accordingly.
  3691. </p>
  3692. <p class=func><span class=keyword>volumeRight</span>(level);</p>
  3693. <p class=desc>Accepts a float in range 0.0-1.0 and sets the right line output volume accordingly.
  3694. </p>
  3695. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3696. <p class=desc>NOT SUPPORTED BY THE AK4558
  3697. </p>
  3698. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  3699. <p class=desc>not implemented yet
  3700. </p>
  3701. <h3>Examples</h3>
  3702. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; PassthroughTest
  3703. </p>
  3704. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; AK4558 &gt; SineOutTest
  3705. </p>
  3706. <h3>Notes</h3>
  3707. <p>TODO: Implement inputSelect() function to enable mono left, mono right, stereo operation.</p>
  3708. <p>TODO: Implement ADC and DAC filters control.</p>
  3709. <p>TODO: Implement DAC level attenuator attack rate modifier.</p>
  3710. </script>
  3711. <script type="text/x-red" data-template-name="AudioControlAK4558">
  3712. <div class="form-row">
  3713. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3714. <input type="text" id="node-input-name" placeholder="Name">
  3715. </div>
  3716. </script>
  3717. <script type="text/x-red" data-help-name="AudioControlCS4272">
  3718. <h3>Summary</h3>
  3719. <div class=tooltipinfo>
  3720. <p>Control the CS4272 chip on the <a href="https://hackaday.io/project/5912-teensy-super-audio-board" target="_blank">Super Audio Board</a>.
  3721. </p>
  3722. <p>TODO: does this control object put the CS4272 into I2S master or slave mode</p>
  3723. </div>
  3724. <h3>Audio Connections</h3>
  3725. <p>This object has no audio inputs or outputs. Separate I2S objects
  3726. are used to send and receive audio data.
  3727. </p>
  3728. <h3>Functions</h3>
  3729. <p class=func><span class=keyword>enable</span>();</p>
  3730. <p class=desc>Enables the CODEC to work with 44.1 KHz - 16 bit data. This function does not enable the ADC/DAC modules.
  3731. </p>
  3732. <p class=func><span class=keyword>volume</span>(vol);</p>
  3733. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3734. </p>
  3735. <p class=func><span class=keyword>volume</span>(left, right);</p>
  3736. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3737. </p>
  3738. <p class=func><span class=keyword>dacVolume</span>(vol);</p>
  3739. <p class=desc>Set the volume level. Range is 0 to 1.0. TODO: what's the
  3740. distinction between volume() and dacVolume()?
  3741. </p>
  3742. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  3743. <p class=desc>Set the volume level. Range is 0 to 1.0.
  3744. </p>
  3745. <p class=func><span class=keyword>muteOutput</span>();</p>
  3746. <p class=desc>TODO: description
  3747. </p>
  3748. <p class=func><span class=keyword>unmuteOutput</span>();</p>
  3749. <p class=desc>TODO: description
  3750. </p>
  3751. <p class=func><span class=keyword>muteInput</span>();</p>
  3752. <p class=desc>TODO: description
  3753. </p>
  3754. <p class=func><span class=keyword>unmuteInput</span>();</p>
  3755. <p class=desc>TODO: description
  3756. </p>
  3757. <p class=func><span class=keyword>enableDither</span>();</p>
  3758. <p class=desc>TODO: description
  3759. </p>
  3760. <p class=func><span class=keyword>disableDither</span>();</p>
  3761. <p class=desc>TODO: description
  3762. </p>
  3763. <h3>Hardware</h3>
  3764. <p>Pin 2 must be connected to the CS4272 reset. SDA &amp; SCL are used for all control.
  3765. </p>
  3766. <h3>Notes</h3>
  3767. </script>
  3768. <script type="text/x-red" data-template-name="AudioControlCS4272">
  3769. <div class="form-row">
  3770. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3771. <input type="text" id="node-input-name" placeholder="Name">
  3772. </div>
  3773. </script>
  3774. <script type="text/x-red" data-help-name="AudioControlCS42448">
  3775. <h3>Summary</h3>
  3776. <div class=tooltipinfo>
  3777. <p>Control the CS42448 chip in TDM mode, for 6 inputs and 8 outputs.
  3778. </p>
  3779. <p align=center><img src="img/cs42448.jpg"></p>
  3780. </div>
  3781. </div>
  3782. <h3>Audio Connections</h3>
  3783. <p>This object has no audio inputs or outputs. Separate TDM objects
  3784. are used to send and receive audio data.
  3785. </p>
  3786. <h3>Functions</h3>
  3787. <p class=func><span class=keyword>enable</span>();</p>
  3788. <p class=desc>Enables the CS42448 to work in TDM mode.
  3789. </p>
  3790. <p class=func><span class=keyword>volume</span>(level);</p>
  3791. <p class=desc>Set the volume level for all output channels. Range is 0 to 1.0.
  3792. </p>
  3793. <p class=func><span class=keyword>volume</span>(channel, level);</p>
  3794. <p class=desc>Set the volume level for a single output. Channel is 1 to 8. Range is 0 to 1.0.
  3795. </p>
  3796. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  3797. <p class=desc>Set the input gain level for all input channels. Range is 0 to 15.85.
  3798. </p>
  3799. <p class=func><span class=keyword>inputLevel</span>(channel, level);</p>
  3800. <p class=desc>Set the input gain level for a single input. Channel is 1 to 6. Range is 0 to 15.85.
  3801. </p>
  3802. <h3>Hardware</h3>
  3803. <p>Tested with this <a href="https://oshpark.com/shared_projects/2Yj6rFaW">
  3804. CS42448 Circuit Board</a>.
  3805. </p>
  3806. <p align=center><img src="img/tdm.jpg"></p>
  3807. </div>
  3808. <h3>Notes</h3>
  3809. </script>
  3810. <script type="text/x-red" data-template-name="AudioControlCS42448">
  3811. <div class="form-row">
  3812. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  3813. <input type="text" id="node-input-name" placeholder="Name">
  3814. </div>
  3815. </script>
  3816. </body>
  3817. </html>