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

3299 lines
145KB

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