No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

4187 líneas
187KB

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