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.

4188 lines
188KB

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