Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

2728 linhas
121KB

  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-help" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="node-help-label" aria-hidden="true">
  154. <div class="modal-header">
  155. <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>
  156. </div>
  157. <div class="modal-body">
  158. <table>
  159. <tr>
  160. <td><span class="help-key">?</span></td><td>Help</td>
  161. <td><span class="help-key">Ctrl</span> <span class="help-key">a</span></td><td>Select all nodes</td>
  162. </tr>
  163. <tr>
  164. <td><span class="help-key">Ctrl</span> <span class="help-key">Space</span></td><td>Toggle sidebar</td>
  165. <td><span class="help-key">Shift</span> <span class="help-key">Click</span></td><td>Select all connected nodes</td>
  166. </tr>
  167. <tr>
  168. <td><span class="help-key">Ctrl</span> <span class="help-key">z</span></td><td>Undo</td>
  169. <td><span class="help-key">Ctrl</span> <span class="help-key">Click</span></td><td>Add/remove node from selection</td>
  170. </tr>
  171. <tr>
  172. <td></td><td></td>
  173. <td><span class="help-key">Delete</span></td><td>Delete selected nodes or link</td>
  174. </tr>
  175. <tr>
  176. <td><span class="help-key">Ctrl</span> <span class="help-key">x</span></td><td>Cut selected nodes</td>
  177. <td></td><td></td>
  178. </tr>
  179. <tr>
  180. <td><span class="help-key">Ctrl</span> <span class="help-key">c</span></td><td>Copy selected nodes</td>
  181. <td><span class="help-key">Ctrl</span> <span class="help-key">v</span></td><td>Paste nodes</td>
  182. </tr>
  183. <tr>
  184. <td><span class="help-key">Ctrl</span> <span class="help-key">i</span></td><td>Import nodes</td>
  185. <td><span class="help-key">Ctrl</span> <span class="help-key">e</span></td><td>Export selected nodes</td>
  186. </tr>
  187. <tr>
  188. <td colspan="2"></td>
  189. </tr>
  190. <tr>
  191. <td><span class="help-key">Ctrl</span> <span class="help-key">+</span></td><td>Zoom in</td>
  192. <td><span class="help-key">Ctrl</span> <span class="help-key">-</span></td><td>Zoom out</td>
  193. </tr>
  194. </table>
  195. </div>
  196. <div class="modal-footer">
  197. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  198. </div>
  199. </div>
  200. <div id="node-dialog-library-save-confirm" class="hide">
  201. <form class="form-horizontal">
  202. <div style="text-align: center; padding-top: 30px;">
  203. A <span id="node-dialog-library-save-type"></span> called <span id="node-dialog-library-save-name"></span> already exists. Overwrite?
  204. </div>
  205. </form>
  206. </div>
  207. <div id="node-dialog-library-save" class="hide">
  208. <form class="form-horizontal">
  209. <div class="form-row">
  210. <label for="node-dialog-library-save-folder"><i class="icon-folder-open"></i> Folder</label>
  211. <input type="text" id="node-dialog-library-save-folder" placeholder="Folder">
  212. </div>
  213. <div class="form-row">
  214. <label for="node-dialog-library-save-filename"><i class="icon-file"></i> Filename</label>
  215. <input type="text" id="node-dialog-library-save-filename" placeholder="Filename">
  216. </div>
  217. </form>
  218. </div>
  219. <div id="node-dialog-library-lookup" class="hide">
  220. <form class="form-horizontal">
  221. <div class="form-row">
  222. <ul id="node-dialog-library-breadcrumbs" class="breadcrumb">
  223. <li class="active"><a href="#">Library</a></li>
  224. </ul>
  225. </div>
  226. <div class="form-row">
  227. <div style="vertical-align: top; display: inline-block; height: 100%; width: 30%; padding-right: 20px;">
  228. <div id="node-select-library" style="border: 1px solid #999; width: 100%; height: 100%; overflow:scroll;"><ul></ul></div>
  229. </div>
  230. <div style="vertical-align: top; display: inline-block;width: 65%; height: 100%;">
  231. <div style="height: 100%; width: 95%;" class="node-text-editor" id="node-select-library-text" ></div>
  232. </div>
  233. </div>
  234. </form>
  235. </div>
  236. <div id="node-dialog-rename-workspace" class="hide">
  237. <form class="form-horizontal">
  238. <div class="form-row">
  239. <label for="node-input-workspace-name" ><i class="icon-tag"></i> Name:</label>
  240. <input type="text" id="node-input-workspace-name">
  241. </div>
  242. </form>
  243. </div>
  244. <div id="node-dialog-delete-workspace" class="hide">
  245. <form class="form-horizontal">
  246. <div style="text-align: center; padding-top: 30px;">
  247. Are you sure you want to delete '<span id="node-dialog-delete-workspace-name"></span>'?
  248. </div>
  249. </form>
  250. </div>
  251. <script type="text/x-red" data-template-name="export-clipboard-dialog">
  252. <div class="form-row">
  253. <label for="node-input-export" style="display: block; width:100%;"><i class="icon-share"></i> Source Code:</label>
  254. <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>
  255. </div>
  256. <div class="form-tips">
  257. Select the text above and copy to the clipboard with Ctrl-A Ctrl-C.
  258. </div>
  259. </script>
  260. <script type="text/x-red" data-template-name="export-library-dialog">
  261. <div class="form-row">
  262. <label for="node-input-filename" ><i class="icon-tag"></i> Filename:</label>
  263. <input type="text" id="node-input-filename" placeholder="Filename">
  264. </div>
  265. </script>
  266. <script type="text/x-red" data-template-name="import-dialog">
  267. <div class="form-row">
  268. <label for="node-input-import"><i class="icon-share"></i>Nodes:</label>
  269. <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>
  270. </div>
  271. <div class="form-tips">
  272. <label for="node-input-arduino" style="font-size: 13px; padding: 2px 0px 0px 4px;">
  273. <input style="margin-bottom: 4px; margin-right: 4px;" type="checkbox" id="node-input-arduino" checked="checked" class="input-block-level" />
  274. &nbsp;Import copied code from the Arduino IDE
  275. </label>
  276. </div>
  277. </script>
  278. <script src="jquery/js/jquery-1.9.1.js"></script>
  279. <script src="bootstrap/js/bootstrap.min.js"></script>
  280. <script src="jquery/js/jquery-ui-1.10.3.custom.min.js"></script>
  281. <script src="jquery/js/jquery.ui.touch-punch.min.js"></script>
  282. <script src="orion/built-editor.min.js"></script>
  283. <script src="red/d3/d3.v3.min.js"></script>
  284. <script src="red/main.js"></script>
  285. <script src="red/ui/state.js"></script>
  286. <script src="red/nodes.js"></script>
  287. <script src="red/storage.js"></script>
  288. <script src="red/history.js"></script>
  289. <script src="red/ui/keyboard.js"></script>
  290. <script src="red/ui/tabs.js"></script>
  291. <script src="red/ui/view.js"></script>
  292. <script src="red/ui/sidebar.js"></script>
  293. <script src="red/ui/palette.js"></script>
  294. <script src="red/ui/tab-info.js"></script>
  295. <script src="red/ui/tab-config.js"></script>
  296. <script src="red/ui/editor.js"></script>
  297. <script src="red/ui/library.js"></script>
  298. <script src="red/ui/notifications.js"></script>
  299. <script src="red/ui/touch/radialMenu.js"></script>
  300. <!--
  301. TODO: generate some or all of this automatically from the C++ source
  302. -->
  303. <!--
  304. TODO: add a field for maximum instance count
  305. -->
  306. <!--
  307. TODO: add a field for exclusive to other objects (not allowed if they're used)
  308. -->
  309. <!--
  310. TODO: add "parameters" fields, to replace the form html stuff
  311. -->
  312. <script type="text/x-red" data-container-name="NodeDefinitions">
  313. {"nodes":[
  314. {"type":"AudioInputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  315. {"type":"AudioInputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"adc","inputs":0,"outputs":1,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  316. {"type":"AudioInputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2ss","inputs":0,"outputs":2,"category":"input-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  317. {"type":"AudioOutputI2S","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2s","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  318. {"type":"AudioOutputSPDIF","data":{"defaults":{"name":{"value":"new"}},"shortName":"spdif","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  319. {"type":"AudioOutputAnalog","data":{"defaults":{"name":{"value":"new"}},"shortName":"dac","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  320. {"type":"AudioOutputPWM","data":{"defaults":{"name":{"value":"new"}},"shortName":"pwm","inputs":1,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  321. {"type":"AudioOutputI2Sslave","data":{"defaults":{"name":{"value":"new"}},"shortName":"i2ss","inputs":2,"outputs":0,"category":"output-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  322. {"type":"AudioMixer4","data":{"defaults":{"name":{"value":"new"}},"shortName":"mixer","inputs":4,"outputs":1,"category":"mixer-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  323. {"type":"AudioPlayMemory","data":{"defaults":{"name":{"value":"new"}},"shortName":"playMem","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  324. {"type":"AudioPlaySdWav","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdWav","inputs":0,"outputs":2,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  325. {"type":"AudioPlaySdRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playSdRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  326. {"type":"AudioPlaySerialflashRaw","data":{"defaults":{"name":{"value":"new"}},"shortName":"playFlashRaw","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  327. {"type":"AudioPlayQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":0,"outputs":1,"category":"play-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  328. {"type":"AudioRecordQueue","data":{"defaults":{"name":{"value":"new"}},"shortName":"queue","inputs":1,"outputs":0,"category":"record-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  329. {"type":"AudioSynthWaveformSine","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  330. {"type":"AudioSynthWaveformSineModulated","data":{"defaults":{"name":{"value":"new"}},"shortName":"sine_fm","inputs":1,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  331. {"type":"AudioSynthWaveform","data":{"defaults":{"name":{"value":"new"}},"shortName":"waveform","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  332. {"type":"AudioSynthToneSweep","data":{"defaults":{"name":{"value":"new"}},"shortName":"tonesweep","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  333. {"type":"AudioSynthWaveformDc","data":{"defaults":{"name":{"value":"new"}},"shortName":"dc","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  334. {"type":"AudioSynthNoiseWhite","data":{"defaults":{"name":{"value":"new"}},"shortName":"noise","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  335. {"type":"AudioSynthNoisePink","data":{"defaults":{"name":{"value":"new"}},"shortName":"pink","inputs":0,"outputs":1,"category":"synth-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  336. {"type":"AudioEffectFade","data":{"defaults":{"name":{"value":"new"}},"shortName":"fade","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  337. {"type":"AudioEffectChorus","data":{"defaults":{"name":{"value":"new"}},"shortName":"chorus","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  338. {"type":"AudioEffectFlange","data":{"defaults":{"name":{"value":"new"}},"shortName":"flange","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  339. {"type":"AudioEffectEnvelope","data":{"defaults":{"name":{"value":"new"}},"shortName":"envelope","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  340. {"type":"AudioEffectMultiply","data":{"defaults":{"name":{"value":"new"}},"shortName":"multiply","inputs":2,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  341. {"type":"AudioEffectDelay","data":{"defaults":{"name":{"value":"new"}},"shortName":"delay","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  342. {"type":"AudioEffectDelayExternal","data":{"defaults":{"name":{"value":"new"}},"shortName":"delayExt","inputs":1,"outputs":8,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  343. {"type":"AudioEffectBitcrusher","data":{"shortName":"bitcrusher","inputs":1,"outputs":1,"category":"effect-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  344. {"type":"AudioFilterBiquad","data":{"defaults":{"name":{"value":"new"}},"shortName":"biquad","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  345. {"type":"AudioFilterFIR","data":{"defaults":{"name":{"value":"new"}},"shortName":"fir","inputs":1,"outputs":1,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  346. {"type":"AudioFilterStateVariable","data":{"defaults":{"name":{"value":"new"}},"shortName":"filter","inputs":2,"outputs":3,"category":"filter-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  347. {"type":"AudioAnalyzePeak","data":{"defaults":{"name":{"value":"new"}},"shortName":"peak","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  348. {"type":"AudioAnalyzeFFT256","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft256","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  349. {"type":"AudioAnalyzeFFT1024","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft1024","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  350. {"type":"AudioAnalyzeToneDetect","data":{"defaults":{"name":{"value":"new"}},"shortName":"tone","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  351. {"type":"AudioAnalyzePrint","data":{"defaults":{"name":{"value":"new"}},"shortName":"print","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  352. {"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  353. {"type":"AudioControlWM8731","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
  354. {"type":"AudioControlWM8731master","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731m","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}}
  355. ]}
  356. </script>
  357. <script type="text/x-red" data-help-name="AudioInputI2S">
  358. <h3>Summary</h3>
  359. <p>Receive 16 bit stereo audio from the
  360. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  361. or another I2S device, using I2S master mode.</p>
  362. <p align=center><img src="img/audioshield_inputs.jpg"></p>
  363. <h3>Audio Connections</h3>
  364. <table class=doc align=center cellpadding=3>
  365. <tr class=top><th>Port</th><th>Purpose</th></tr>
  366. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  367. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  368. </table>
  369. <h3>Functions</h3>
  370. <p>This object has no functions to call from the Arduino sketch. It
  371. simply streams data from the I2S hardware to its 2 output ports.</p>
  372. <h3>Hardware</h3>
  373. <p align=center><img src="img/audioshield_backside.jpg"></p>
  374. <p>The I2S signals are used in "master" mode, where Teensy creates
  375. all 3 clock signals and controls all data timing.</p>
  376. <table class=doc align=center cellpadding=3>
  377. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  378. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  379. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  380. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  381. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  382. </table>
  383. <p>Audio from
  384. master mode I2S may be used in the same project as ADC, DAC and
  385. PWM signals, because all remain in sync to Teensy's timing</p>
  386. <h3>Examples</h3>
  387. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  388. </p>
  389. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  390. </p>
  391. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  392. </p>
  393. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  394. </p>
  395. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  396. </p>
  397. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  398. </p>
  399. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  400. </p>
  401. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  402. </p>
  403. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  404. </p>
  405. <h3>Notes</h3>
  406. <p>Normally, this object is used with the Audio Shield, which
  407. is controlled separately by the "sgtl5000" object.</p>
  408. <p>Only one I2S input and one I2S output object may be used. Master
  409. and slave modes may not be mixed (both must be of the same type).
  410. </p>
  411. <p>I2S master objects can be used together with non-I2S input and output
  412. objects, for simultaneous audio streaming on different hardware.</p>
  413. </script><
  414. <script type="text/x-red" data-template-name="AudioInputI2S">
  415. <div class="form-row">
  416. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  417. <input type="text" id="node-input-name" placeholder="Name">
  418. </div>
  419. </script>
  420. <script type="text/x-red" data-help-name="AudioInputAnalog">
  421. <h3>Summary</h3>
  422. <p>Receive audio using the built-in analog to digital converter.</p>
  423. <h3>Audio Connections</h3>
  424. <table class=doc align=center cellpadding=3>
  425. <tr class=top><th>Port</th><th>Purpose</th></tr>
  426. <tr class=odd><td align=center>Out 0</td><td>Audio Channel</td></tr>
  427. </table>
  428. <h3>Functions</h3>
  429. <p>This object has no functions to call from the Arduino sketch. It
  430. simply streams data from the ADC to its output port.</p>
  431. <h3>Hardware</h3>
  432. <p>Pin A2 is used for audio input. This circuitry is recommended.</p>
  433. <p align=center><img src="img/adccircuit.png"></p>
  434. <p>Signal range is 0 to 1.2V</p>
  435. <h3>Examples</h3>
  436. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  437. </p>
  438. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  439. </p>
  440. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  441. </p>
  442. <h3>Notes</h3>
  443. <p>A different pin may be used, but adding it as an parameter
  444. to the AudioInputAnalog object definition.
  445. </p>
  446. <p>For example, to use pin A3:
  447. </p>
  448. <p class=desc><span class=keyword>AudioInputAnalog</span> adc1(<span class=literal>A3</span>);
  449. </p>
  450. <p>Noise due to high source impedance, which allows rapidly switching digital signals
  451. to capacitively couple... avoiding higher analog impedance is the solution.</p>
  452. <p>Power Supply rejection issue with simple DC bias (bigger capacitor may be needed if 3.3V has low frequency noise)</p>
  453. <p>Algorithm for automatic DC bias tracking</p>
  454. <p>TODO: actual noise measurements with different input circuitry
  455. (it's not as quiet as the audio shield)</p>
  456. </script>
  457. <script type="text/x-red" data-template-name="AudioInputAnalog">
  458. <div class="form-row">
  459. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  460. <input type="text" id="node-input-name" placeholder="Name">
  461. </div>
  462. </script>
  463. <script type="text/x-red" data-help-name="AudioInputI2Sslave">
  464. <h3>Summary</h3>
  465. <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p>
  466. <h3>Audio Connections</h3>
  467. <table class=doc align=center cellpadding=3>
  468. <tr class=top><th>Port</th><th>Purpose</th></tr>
  469. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  470. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  471. </table>
  472. <h3>Functions</h3>
  473. <p>This object has no functions to call from the Arduino sketch. It
  474. simply streams data from the I2S hardware to its 2 output ports.</p>
  475. <h3>Hardware</h3>
  476. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  477. data timing.</p>
  478. <table class=doc align=center cellpadding=3>
  479. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  480. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  481. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  482. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  483. </table>
  484. <!--
  485. <h3>Examples</h3>
  486. <p class=exam>File &gt; Examples &gt; Audio &gt;
  487. </p>
  488. -->
  489. <h3>Notes</h3>
  490. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  491. PWM</b> signals. Differences in timing between the I2S device and
  492. Teensy's clock can cause occasional audio glitches when I2S slave mode
  493. is used together with other input or output objects based on Teensy's
  494. timing.</p>
  495. <p>Only one I2S input and one I2S output object may be used. Master
  496. and slave modes may not be mixed (both must be of the same type).
  497. </p>
  498. </script>
  499. <script type="text/x-red" data-template-name="AudioInputI2Sslave">
  500. <div class="form-row">
  501. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  502. <input type="text" id="node-input-name" placeholder="Name">
  503. </div>
  504. </script>
  505. <script type="text/x-red" data-help-name="AudioOutputI2S">
  506. <h3>Summary</h3>
  507. <p>Transmit 16 bit stereo audio to the
  508. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  509. or another I2S device, using I2S master mode.</p>
  510. <p align=center><img src="img/audioshield_outputs.jpg"></p>
  511. <h3>Audio Connections</h3>
  512. <table class=doc align=center cellpadding=3>
  513. <tr class=top><th>Port</th><th>Purpose</th></tr>
  514. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  515. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  516. </table>
  517. <h3>Functions</h3>
  518. <p>This object has no functions to call from the Arduino sketch. It
  519. simply streams data from its 2 input ports to the I2S hardware.</p>
  520. <h3>Hardware</h3>
  521. <p align=center><img src="img/audioshield_backside.jpg"></p>
  522. <p>The I2S signals are used in "master" mode, where Teensy creates
  523. all 3 clock signals and controls all data timing.</p>
  524. <table class=doc align=center cellpadding=3>
  525. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  526. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  527. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  528. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  529. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  530. </table>
  531. <p>Audio from
  532. master mode I2S may be used in the same project as ADC, DAC and
  533. PWM signals, because all remain in sync to Teensy's timing</p>
  534. <h3>Examples</h3>
  535. <p>Nearly all the examples use this object. Here are some of the highlights:</p>
  536. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  537. </p>
  538. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  539. </p>
  540. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  541. </p>
  542. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  543. </p>
  544. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  545. </p>
  546. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  547. </p>
  548. <h3>Notes</h3>
  549. <p>Normally, this object is used with the Audio Shield, which
  550. is controlled separately by the "sgtl5000" object.</p>
  551. <p>Only one I2S input and one I2S output object may be used. Master
  552. and slave modes may not be mixed (both must be of the same type).
  553. </p>
  554. </script>
  555. <script type="text/x-red" data-template-name="AudioOutputI2S">
  556. <div class="form-row">
  557. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  558. <input type="text" id="node-input-name" placeholder="Name">
  559. </div>
  560. </script>
  561. <script type="text/x-red" data-help-name="AudioOutputSPDIF">
  562. <h3>Summary</h3>
  563. <p>Transmit 16 bit stereo audio as Digital S/PDIF.</p>
  564. <p align=center><img src="img/spdif_proto.jpg"></p>
  565. <h3>Audio Connections</h3>
  566. <table class=doc align=center cellpadding=3>
  567. <tr class=top><th>Port</th><th>Purpose</th></tr>
  568. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  569. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  570. </table>
  571. <h3>Functions</h3>
  572. <p>This object has no functions to call from the Arduino sketch. It
  573. simply streams data from its 2 input ports S/PDIF encoded digital
  574. audio on pin 22.</p>
  575. <h3>Hardware</h3>
  576. <p>The S/PDIF output signal can be used to drive an optical TOSLINK
  577. cable, or a standard (usually orange) RCA jack.</p>
  578. <table class=doc align=center cellpadding=3>
  579. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  580. <tr class=odd><td align=center>22</td><td>S/PDIF</td><td>Output</td></tr>
  581. </table>
  582. <p>For optical TOSLINK output, this
  583. <a href="https://www.oshpark.com/shared_projects/KcDBKHta" target="_blank">OSH Park board</a>
  584. can be used with the inexpensive Everlight PLT133/T6A connector, available
  585. at Digikey, 1080-1434-ND.
  586. </p>
  587. <h3>Examples</h3>
  588. <p>The AudioOutputSPDIF object can be used in place of the AudioOutputI2S object,
  589. <p>used in nearly all the examples. The WavFilePlayer shows how to substitute
  590. output objects for different hardware types.
  591. </p>
  592. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  593. </p>
  594. <h3>Credits</h3>
  595. <p><a href="https://github.com/FrankBoesing" target="_blank">Frank Boesing</a>
  596. developed the AudioOutputSPDIF code. The original
  597. <a href="https://forum.pjrc.com/threads/28639-S-pdif" target="_blank">forum disussion</a>
  598. included valuable input and code from "kpc".
  599. <h3>Notes</h3>
  600. <p>S/PDIF output uses the I2S hardware. This object can not be used
  601. together with any of the I2S objects, because it requires the I2S
  602. hardware with different internal settings.</p>
  603. </p>
  604. </script>
  605. <script type="text/x-red" data-template-name="AudioOutputSPDIF">
  606. <div class="form-row">
  607. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  608. <input type="text" id="node-input-name" placeholder="Name">
  609. </div>
  610. </script>
  611. <script type="text/x-red" data-help-name="AudioOutputAnalog">
  612. <h3>Summary</h3>
  613. <p>Transmit 12 bit audio using Teensy 3.1's built-in digital to analog converter.</p>
  614. <h3>Audio Connections</h3>
  615. <table class=doc align=center cellpadding=3>
  616. <tr class=top><th>Port</th><th>Purpose</th></tr>
  617. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  618. </table>
  619. <h3>Functions</h3>
  620. <p>This object has no functions to call from the Arduino sketch. It
  621. simply streams data from the ADC to its output port.</p>
  622. <h3>Hardware</h3>
  623. <p align=center><img src="img/dacpin.jpg"></p>
  624. <p>Signal range is 0 to 1.2V</p>
  625. <p>Most applications require at least a 10&micro;F DC-blocking capacitor.</p>
  626. <p>TODO: photo of Teensy 3.1 with 10&micro;F capacitor and 3.5mm jack.</p>
  627. <h3>Examples</h3>
  628. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  629. </p>
  630. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  631. </p>
  632. <h3>Notes</h3>
  633. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  634. not filtered. This may not
  635. be an issue for many uses, but care should be used if amplified and driven
  636. to high power tweeters.</p>
  637. </script>
  638. <script type="text/x-red" data-template-name="AudioOutputAnalog">
  639. <div class="form-row">
  640. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  641. <input type="text" id="node-input-name" placeholder="Name">
  642. </div>
  643. </script>
  644. <script type="text/x-red" data-help-name="AudioOutputPWM">
  645. <h3>Summary</h3>
  646. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  647. used for coarse and fine pulses, to be combined by scaled
  648. resistors.</p>
  649. <h3>Audio Connections</h3>
  650. <table class=doc align=center cellpadding=3>
  651. <tr class=top><th>Port</th><th>Purpose</th></tr>
  652. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  653. </table>
  654. <h3>Functions</h3>
  655. <p>This object has no functions to call from the Arduino sketch. It
  656. simply streams data from the its input port to the PWM pins.</p>
  657. <h3>Hardware</h3>
  658. <p>The following circuit is recommended.</p>
  659. <p align=center><img src="img/pwmdualcircuit.jpg"></p>
  660. <p>Signal range is approx 1.55 Vp-p.</p>
  661. <p>These resistor values assume approx 20 ohms output impedance
  662. on the digital pins. The 127K resistor may be adjusted or
  663. trimmed for variation in output drive and tolerance on the
  664. 475 ohm resistor.</p>
  665. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  666. C0G/NPO ceramic capacitor should be used for filtering. Low
  667. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  668. <h3>Examples</h3>
  669. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughMono
  670. </p>
  671. <h3>Notes</h3>
  672. <p>This object only works properly when Tools > CPU_Speed is set to
  673. 48 or 96 MHz. Other speeds aren't supported and will likely fail
  674. in strange ways.</p>
  675. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  676. will only slightly filter the carrier. Extra filtering will be
  677. required for a clean signal without the ultrasonic PWM carrier.
  678. </p>
  679. <p>Analog signals created by filtering PWM waveforms use the digital
  680. power supply as their reference voltage. Any noise on the digital
  681. power line can directly couple to the output signal. The built-in DAC or
  682. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  683. should be used when higher quality signals are needed.</p>
  684. </script>
  685. <script type="text/x-red" data-template-name="AudioOutputPWM">
  686. <div class="form-row">
  687. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  688. <input type="text" id="node-input-name" placeholder="Name">
  689. </div>
  690. </script>
  691. <script type="text/x-red" data-help-name="AudioOutputI2Sslave">
  692. <h3>Summary</h3>
  693. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p>
  694. <h3>Audio Connections</h3>
  695. <table class=doc align=center cellpadding=3>
  696. <tr class=top><th>Port</th><th>Purpose</th></tr>
  697. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  698. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  699. </table>
  700. <h3>Functions</h3>
  701. <p>This object has no functions to call from the Arduino sketch. It
  702. simply streams data from its 2 input ports to the I2S hardware.</p>
  703. <h3>Hardware</h3>
  704. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  705. data timing.</p>
  706. <table class=doc align=center cellpadding=3>
  707. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  708. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  709. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  710. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  711. </table>
  712. <h3>Examples</h3>
  713. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  714. </p>
  715. <h3>Notes</h3>
  716. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  717. PWM</b> signals. Differences in timing between the I2S device and
  718. Teensy's clock can cause occasional audio glitches when I2S slave mode
  719. is used together with other input or output objects based on Teensy's
  720. timing.</p>
  721. <p>Only one I2S input and one I2S output object may be used. Master
  722. and slave modes may not be mixed (both must be of the same type).
  723. </p>
  724. </script>
  725. <script type="text/x-red" data-template-name="AudioOutputI2Sslave">
  726. <div class="form-row">
  727. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  728. <input type="text" id="node-input-name" placeholder="Name">
  729. </div>
  730. </script>
  731. <script type="text/x-red" data-help-name="AudioMixer4">
  732. <h3>Summary</h3>
  733. <p>Combine up to 4 audio signals together, each with adjustable gain.
  734. All channels support signal attenuation or amplification.</p>
  735. <h3>Audio Connections</h3>
  736. <table class=doc align=center cellpadding=3>
  737. <tr class=top><th>Port</th><th>Purpose</th></tr>
  738. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  739. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  740. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  741. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  742. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  743. </table>
  744. <h3>Functions</h3>
  745. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  746. <p class=desc>Adjust the amplification or attenuation. "channel" must
  747. be 0 to 3. "level" may be any floating point number from 0 to 32767.
  748. 1.0 passes the signal through directly. Level of 0 shuts the channel
  749. off completely. Between 0 to 1.0 attenuates the signal, and above
  750. 1.0 amplifies it. All 4 channels have separate settings.
  751. </p>
  752. <h3>Examples</h3>
  753. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  754. </p>
  755. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  756. </p>
  757. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  758. </p>
  759. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  760. </p>
  761. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  762. </p>
  763. <h3>Notes</h3>
  764. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  765. or when multiple signals add together to greater than 1.0.</p>
  766. <p>More than 4 channels may be combined by connecting multiple mixers
  767. in tandem. For example, a 16 channel mixer may be built using 5
  768. mixers, where the fifth mixer combines the outputs of the first 4.
  769. </p>
  770. </script>
  771. <script type="text/x-red" data-template-name="AudioMixer4">
  772. <div class="form-row">
  773. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  774. <input type="text" id="node-input-name" placeholder="Name">
  775. </div>
  776. </script>
  777. <script type="text/x-red" data-help-name="AudioPlayMemory">
  778. <h3>Summary</h3>
  779. <p>Play a short sound clip, stored directly in memory.
  780. Data files are created with the
  781. <a href="https://github.com/PaulStoffregen/Audio/tree/master/examples/SamplePlayer/wav2sketch" target="_blank">wav2sketch program</a>,
  782. and copied to the sketch folder to become part of your sketch.</p>
  783. <h3>Audio Connections</h3>
  784. <table class=doc align=center cellpadding=3>
  785. <tr class=top><th>Port</th><th>Purpose</th></tr>
  786. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  787. </table>
  788. <h3>Functions</h3>
  789. <p class=func><span class=keyword>play</span>(data);</p>
  790. <p class=desc>Begin playing a sound clip. If already playing, the
  791. currently playing clip is stopped and this new data begins
  792. playing from the beginning.
  793. </p>
  794. <p class=func><span class=keyword>stop</span>();</p>
  795. <p class=desc>Stop playing. If not playing, this function has no effect.
  796. </p>
  797. <p class=func><span class=keyword>isPlaying</span>();</p>
  798. <p class=desc>Return true (non-zero) if playing, or false (zero)
  799. when not playing.
  800. </p>
  801. <p class=func><span class=keyword>positionMillis</span>();</p>
  802. <p class=desc>While playing, return the current time offset, in
  803. milliseconds. When not playing, the return from this function
  804. is undefined.
  805. </p>
  806. <p class=func><span class=keyword>lengthMillis</span>();</p>
  807. <p class=desc>Return the total length of the current sound clip,
  808. in milliseconds. When not playing, the return from this function
  809. is undefined.
  810. </p>
  811. <h3>Examples</h3>
  812. <p class=exam>File &gt; Examples &gt; Audio &gt; SamplePlayer
  813. </p>
  814. <h3>Notes</h3>
  815. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  816. <p>TODO: ulaw vs uncompressed encoding</p>
  817. <p>Polyphonic playback can be built by creating multiple
  818. objects, with their output combined by mixers.</p>
  819. </script>
  820. <script type="text/x-red" data-template-name="AudioPlayMemory">
  821. <div class="form-row">
  822. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  823. <input type="text" id="node-input-name" placeholder="Name">
  824. </div>
  825. </script>
  826. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  827. <h3>Summary</h3>
  828. <p>Play a WAV file, stored on a SD card.</p>
  829. <h3>Audio Connections</h3>
  830. <table class=doc align=center cellpadding=3>
  831. <tr class=top><th>Port</th><th>Purpose</th></tr>
  832. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  833. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  834. </table>
  835. <h3>Functions</h3>
  836. <p class=func><span class=keyword>play</span>(filename);</p>
  837. <p class=desc>Begin playing a WAV file. If a file is already playing,
  838. it is stopped and this file starts playing from the beginning.
  839. </p>
  840. <p class=func><span class=keyword>stop</span>();</p>
  841. <p class=desc>Stop playing. If not playing, this function has no effect.
  842. </p>
  843. <p class=func><span class=keyword>isPlaying</span>();</p>
  844. <p class=desc>Return true (non-zero) if playing, or false (zero)
  845. when not playing. See the note below about delayed start.
  846. </p>
  847. <p class=func><span class=keyword>positionMillis</span>();</p>
  848. <p class=desc>While playing, return the current time offset, in
  849. milliseconds. When not playing, the return from this function
  850. is undefined.
  851. </p>
  852. <p class=func><span class=keyword>lengthMillis</span>();</p>
  853. <p class=desc>Return the total length of the current sound clip,
  854. in milliseconds. When not playing, the return from this function
  855. is undefined.
  856. </p>
  857. <h3>Examples</h3>
  858. <p class=exam>File &gt; Examples &gt; Audio &gt; WavFilePlayer
  859. </p>
  860. <h3>Notes</h3>
  861. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  862. files are played, both output ports transmit a copy of the
  863. single sound. Of course, stereo WAV files play with the left
  864. channel on port 0 and the right channel on port 1.
  865. </p>
  866. <p>A brief delay after calling play() will usually occur before
  867. isPlaying() returns true and positionMillis() returns valid
  868. time offset. WAV files have a header at the beginning of the
  869. file, which the audio library must read and parse before
  870. playing can begin.
  871. </p>
  872. <p>While playing, the audio library accesses the SD card automatically.
  873. If card access is required, you must
  874. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  875. to prevent the library from accessing the SD card while you use it.
  876. Disabling the audio library interrupt for too long may cause audible
  877. dropouts or glitches.
  878. </p>
  879. </script>
  880. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  881. <div class="form-row">
  882. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  883. <input type="text" id="node-input-name" placeholder="Name">
  884. </div>
  885. </script>
  886. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  887. <h3>Summary</h3>
  888. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  889. than WAV and begins playing immediately, without parsing WAV file
  890. header info.</p>
  891. <h3>Audio Connections</h3>
  892. <table class=doc align=center cellpadding=3>
  893. <tr class=top><th>Port</th><th>Purpose</th></tr>
  894. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  895. </table>
  896. <h3>Functions</h3>
  897. <p class=func><span class=keyword>play</span>(filename);</p>
  898. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  899. it is stopped and this file starts playing from the beginning.
  900. </p>
  901. <p class=func><span class=keyword>stop</span>();</p>
  902. <p class=desc>Stop playing. If not playing, this function has no effect.
  903. </p>
  904. <p class=func><span class=keyword>isPlaying</span>();</p>
  905. <p class=desc>Return true (non-zero) if playing, or false (zero)
  906. when not playing.
  907. </p>
  908. <p class=func><span class=keyword>positionMillis</span>();</p>
  909. <p class=desc>While playing, return the current time offset, in
  910. milliseconds. When not playing, the return from this function
  911. is undefined.
  912. </p>
  913. <p class=func><span class=keyword>lengthMillis</span>();</p>
  914. <p class=desc>Return the total length of the current sound clip,
  915. in milliseconds. When not playing, the return from this function
  916. is undefined.
  917. </p>
  918. <h3>Examples</h3>
  919. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  920. </p>
  921. <h3>Notes</h3>
  922. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  923. </p>
  924. <p>While playing, the audio library accesses the SD card automatically.
  925. If card access is required, you must
  926. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  927. to prevent the library from accessing the SD card while you use it.
  928. Disabling the audio library interrupt for too long may cause audible
  929. dropouts or glitches.
  930. </p>
  931. </script>
  932. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  933. <div class="form-row">
  934. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  935. <input type="text" id="node-input-name" placeholder="Name">
  936. </div>
  937. </script>
  938. <script type="text/x-red" data-help-name="AudioPlaySerialflashRaw">
  939. <h3>Summary</h3>
  940. <div>
  941. <p>Play a RAW data file, stored on a Serial Flash chip. These chips
  942. are far more efficient than SD cards, allowing many files to be
  943. played simultaneously by copies of this object.
  944. </p>
  945. <p align=center><img src="img/w25q128fv.jpg"><br><small>W25Q128FV Serial Flash</small></p>
  946. </div>
  947. <h3>Audio Connections</h3>
  948. <table class=doc align=center cellpadding=3>
  949. <tr class=top><th>Port</th><th>Purpose</th></tr>
  950. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  951. </table>
  952. <h3>Functions</h3>
  953. <p class=func><span class=keyword>play</span>(filename);</p>
  954. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  955. it is stopped and this file starts playing from the beginning.
  956. </p>
  957. <p class=func><span class=keyword>stop</span>();</p>
  958. <p class=desc>Stop playing. If not playing, this function has no effect.
  959. </p>
  960. <p class=func><span class=keyword>isPlaying</span>();</p>
  961. <p class=desc>Return true (non-zero) if playing, or false (zero)
  962. when not playing.
  963. </p>
  964. <p class=func><span class=keyword>positionMillis</span>();</p>
  965. <p class=desc>While playing, return the current time offset, in
  966. milliseconds. When not playing, the return from this function
  967. is undefined.
  968. </p>
  969. <p class=func><span class=keyword>lengthMillis</span>();</p>
  970. <p class=desc>Return the total length of the current sound clip,
  971. in milliseconds. When not playing, the return from this function
  972. is undefined.
  973. </p>
  974. <h3>Examples</h3>
  975. <!--
  976. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  977. -->
  978. <p class=exam>TODO: play example needed....
  979. </p>
  980. <p class=exam>File &gt; Examples &gt; SerialFlash &gt; CopyFromSD
  981. </p>
  982. <h3>Notes</h3>
  983. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  984. </p>
  985. <p>The <a href="https://github.com/PaulStoffregen/SerialFlash" target="_blank">SerialFlash library</a>
  986. is used to access the flash chip. You can also use SerialFlash's functions
  987. to access the stored files, or add data to the flash chip.
  988. </p>
  989. <p>File names are case sensitive with SerialFlash. If your sound does
  990. not play, use <b>File &gt; Examples &gt; SerialFlash &gt; ListFiles</b> to
  991. check the exact file names stored in the flash memory chip.
  992. </script>
  993. <script type="text/x-red" data-template-name="AudioPlaySerialflashRaw">
  994. <div class="form-row">
  995. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  996. <input type="text" id="node-input-name" placeholder="Name">
  997. </div>
  998. </script>
  999. <script type="text/x-red" data-help-name="AudioPlayQueue">
  1000. <h3>Summary</h3>
  1001. <p>Play audio data provided by the Arduino sketch. This object provides
  1002. functions to allow the sketch code to push data into the audio system.</p>
  1003. <h3>Audio Connections</h3>
  1004. <table class=doc align=center cellpadding=3>
  1005. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1006. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  1007. </table>
  1008. <h3>Functions</h3>
  1009. <p class=func><span class=keyword>play</span>(int16);</p>
  1010. <p class=desc>not yet implemented
  1011. </p>
  1012. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  1013. <p class=desc>not yet implemented
  1014. </p>
  1015. <p class=func><span class=keyword>getBuffer</span>();</p>
  1016. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  1017. is within the audio library memory pool, providing the most efficient
  1018. way to input data to the audio system. The buffer is likely to be
  1019. populated by previously used data, so the entire 128 words should be
  1020. written before calling playBuffer(). Only a single buffer should be
  1021. requested at a time. This function may return NULL if no memory is
  1022. available.
  1023. </p>
  1024. <p class=func><span class=keyword>playBuffer</span>();</p>
  1025. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  1026. </p>
  1027. <h3>Examples</h3>
  1028. <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>
  1029. </p>
  1030. <!--
  1031. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1032. </p>
  1033. -->
  1034. <h3>Notes</h3>
  1035. <p>TODO: many caveats....</p>
  1036. <p>
  1037. </p>
  1038. </script>
  1039. <script type="text/x-red" data-template-name="AudioPlayQueue">
  1040. <div class="form-row">
  1041. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1042. <input type="text" id="node-input-name" placeholder="Name">
  1043. </div>
  1044. </script>
  1045. <script type="text/x-red" data-help-name="AudioRecordQueue">
  1046. <h3>Summary</h3>
  1047. <p>Record audio data by sending to the Arduino sketch. This object allows
  1048. sketch code to receive audio packets.</p>
  1049. <h3>Audio Connections</h3>
  1050. <table class=doc align=center cellpadding=3>
  1051. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1052. <tr class=odd><td align=center>In 0</td><td>Sound To Access</td></tr>
  1053. </table>
  1054. <h3>Functions</h3>
  1055. <p class=func><span class=keyword>begin</span>();</p>
  1056. <p class=desc>Begin capturing incoming audio to the queue. After calling
  1057. begin, readBuffer() and freeBuffer(), or clear() must be used frequently
  1058. to prevent the queue from filling up.
  1059. </p>
  1060. <p class=func><span class=keyword>available</span>();</p>
  1061. <p class=desc>Returns the number of audio packets available to read.
  1062. </p>
  1063. <p class=func><span class=keyword>readBuffer</span>();</p>
  1064. <p class=desc>Read a single audio packet. A pointer to a 128 sample
  1065. array of 16 bit integers is returned. NULL is returned if no packets
  1066. are available.
  1067. </p>
  1068. <p class=func><span class=keyword>freeBuffer</span>();</p>
  1069. <p class=desc>Release the memory from the previously read packet returned
  1070. from readBuffer(). Only a single packet at a time may be read, and
  1071. each packet must be freed with this function, to return the memory to
  1072. the audio library.
  1073. </p>
  1074. <p class=func><span class=keyword>clear</span>();</p>
  1075. <p class=desc>Discard all audio held in the queue.
  1076. </p>
  1077. <p class=func><span class=keyword>end</span>();</p>
  1078. <p class=desc>Stop capturing incoming audio into the queue. Data already
  1079. captured remains in the queue and may be read with readBuffer().
  1080. </p>
  1081. <h3>Examples</h3>
  1082. <p class=exam>File &gt; Examples &gt; Audio &gt; Recorder
  1083. </p>
  1084. <h3>Notes</h3>
  1085. <p>
  1086. Up to 52 packets may be queued by this object, which allows approximately
  1087. 150 ms of audio to be held in the queue, to allow time for the Arduino
  1088. sketch to write data to media or do other high-latency tasks.
  1089. The actual packets are taken
  1090. from the pool created by AudioMemory().
  1091. </p>
  1092. </script>
  1093. <script type="text/x-red" data-template-name="AudioRecordQueue">
  1094. <div class="form-row">
  1095. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1096. <input type="text" id="node-input-name" placeholder="Name">
  1097. </div>
  1098. </script>
  1099. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  1100. <h3>Summary</h3>
  1101. <p>Create a sine wave signal</p>
  1102. <h3>Audio Connections</h3>
  1103. <table class=doc align=center cellpadding=3>
  1104. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1105. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  1106. </table>
  1107. <h3>Functions</h3>
  1108. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1109. <p class=desc>Set the amplitude, from 0 to 1.0.
  1110. </p>
  1111. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1112. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  1113. be used to create a LFO (Low Frequency Oscillator) for objects
  1114. with modulation signal inputs.
  1115. </p>
  1116. <p class=func><span class=keyword>phase</span>(angle);</p>
  1117. <p class=desc>
  1118. Cause the generated waveform to jump to a specific point within
  1119. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1120. are configured,
  1121. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1122. should be used to guarantee all new settings take effect together.
  1123. </p>
  1124. <h3>Examples</h3>
  1125. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1126. </p>
  1127. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  1128. </p>
  1129. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  1130. </p>
  1131. <h3>Notes</h3>
  1132. <p></p>
  1133. </script>
  1134. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  1135. <div class="form-row">
  1136. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1137. <input type="text" id="node-input-name" placeholder="Name">
  1138. </div>
  1139. </script>
  1140. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  1141. <h3>Summary</h3>
  1142. <p>Create a modulated sine wave, using any audio signal to continuously
  1143. modulate the sine wave frequency.</p>
  1144. <h3>Audio Connections</h3>
  1145. <table class=doc align=center cellpadding=3>
  1146. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1147. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  1148. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  1149. </table>
  1150. <h3>Functions</h3>
  1151. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1152. <p class=desc>Set the amplitude, from 0 to 1.0.
  1153. </p>
  1154. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1155. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  1156. be this center frequency when the input modulation signal is zero.
  1157. Modulation input 1.0 causes the frequency to double, and input -1.0
  1158. causes zero Hz (DC) output. For less modulation, attenuate the input
  1159. signal (perhaps with a mixer object) before it arrives here.
  1160. </p>
  1161. <p class=func><span class=keyword>phase</span>(angle);</p>
  1162. <p class=desc>
  1163. Cause the generated waveform to jump to a specific point within
  1164. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1165. are configured,
  1166. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1167. should be used to guarantee all new settings take effect together.
  1168. </p>
  1169. <!--
  1170. <h3>Examples</h3>
  1171. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1172. </p>
  1173. -->
  1174. <h3>Notes</h3>
  1175. <p></p>
  1176. </script>
  1177. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  1178. <div class="form-row">
  1179. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1180. <input type="text" id="node-input-name" placeholder="Name">
  1181. </div>
  1182. </script>
  1183. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  1184. <h3>Summary</h3>
  1185. <p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</p>
  1186. <h3>Audio Connections</h3>
  1187. <table class=doc align=center cellpadding=3>
  1188. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1189. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  1190. </table>
  1191. <h3>Functions</h3>
  1192. <p class=func><span class=keyword>begin</span>(waveform);</p>
  1193. <p class=desc>Configure the waveform type to create.
  1194. </p>
  1195. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  1196. <p class=desc>Output a waveform, and set the amplitude and frequency.
  1197. </p>
  1198. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1199. <p class=desc>Change the frequency.
  1200. </p>
  1201. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1202. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  1203. </p>
  1204. <p class=func><span class=keyword>phase</span>(angle);</p>
  1205. <p class=desc>
  1206. Cause the generated waveform to jump to a specific point within
  1207. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  1208. are configured,
  1209. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1210. should be used to guarantee all new settings take effect together.
  1211. </p>
  1212. <p class=func><span class=keyword>pulseWidth</span>(amount);</p>
  1213. <p class=desc>Change the width (duty cycle) of the pulse.</p>
  1214. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  1215. <p class=desc>
  1216. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  1217. must be an array of 256 samples. Currently, the data is used
  1218. without any filtering, which can cause aliasing with frequencies
  1219. above 172 Hz. For higher frequency output, you must bandwidth
  1220. limit your waveform data. Someday, "maxFreq" will be used to
  1221. do this automatically.
  1222. </p>
  1223. <h3>Examples</h3>
  1224. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1225. </p>
  1226. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1227. </p>
  1228. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  1229. </p>
  1230. <h3>Notes</h3>
  1231. <p>Supported Waveforms:<br>
  1232. <ul>
  1233. <li><span class=literal>WAVEFORM_SINE</span></li>
  1234. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  1235. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  1236. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  1237. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  1238. <li><span class=literal>WAVEFORM_PULSE</span></li>
  1239. </ul>
  1240. </p>
  1241. </script>
  1242. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  1243. <div class="form-row">
  1244. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1245. <input type="text" id="node-input-name" placeholder="Name">
  1246. </div>
  1247. </script>
  1248. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  1249. <h3>Summary</h3>
  1250. <p>Create a continuously varying (in frequency) sine wave</p>
  1251. <h3>Audio Connections</h3>
  1252. <table class=doc align=center cellpadding=3>
  1253. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1254. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  1255. </table>
  1256. <h3>Functions</h3>
  1257. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  1258. <p class=desc>Start generating frequency sweep output. The time is specified
  1259. in milliseconds. Level is 0 to 1.0.
  1260. </p>
  1261. <p class=func><span class=keyword>isPlaying</span>();</p>
  1262. <p class=desc>Returns true (non-zero) while the output is active.
  1263. </p>
  1264. <h3>Examples</h3>
  1265. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; ToneSweep
  1266. </p>
  1267. <h3>Notes</h3>
  1268. <p>Uses excessive CPU time</p>
  1269. </script>
  1270. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  1271. <div class="form-row">
  1272. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1273. <input type="text" id="node-input-name" placeholder="Name">
  1274. </div>
  1275. </script>
  1276. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  1277. <h3>Summary</h3>
  1278. <p>Create constant (DC) signal, useful for control of objects that take
  1279. a modulation or control input signal. This constant level can be
  1280. used to modify other waveforms using mixer or multiplier objects</p>
  1281. <h3>Audio Connections</h3>
  1282. <table class=doc align=center cellpadding=3>
  1283. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1284. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  1285. </table>
  1286. <h3>Functions</h3>
  1287. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1288. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1289. changed immediately.
  1290. </p>
  1291. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  1292. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  1293. gradually changed over a "milliseconds" time period. Any time may
  1294. be specified, but periods longer than 1 second may be automatically
  1295. shortened for small level changes, due to numerical precision limits.
  1296. </p>
  1297. <!--
  1298. <h3>Examples</h3>
  1299. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1300. </p>
  1301. -->
  1302. <h3>Notes</h3>
  1303. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  1304. to a pure digital stream of numerical values. But the term is widely
  1305. understood in audio applications, so hopefully it's not too confusing?</p>
  1306. </script>
  1307. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  1308. <div class="form-row">
  1309. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1310. <input type="text" id="node-input-name" placeholder="Name">
  1311. </div>
  1312. </script>
  1313. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  1314. <h3>Summary</h3>
  1315. <div>
  1316. <p>Create white noise.
  1317. </p>
  1318. <p align=center><img src="img/whitenoise.png"></p>
  1319. </div>
  1320. <h3>Audio Connections</h3>
  1321. <table class=doc align=center cellpadding=3>
  1322. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1323. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  1324. </table>
  1325. <h3>Functions</h3>
  1326. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1327. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1328. The default is off. Noise is generated only after setting
  1329. to a non-zero level.
  1330. </p>
  1331. <h3>Examples</h3>
  1332. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1333. </p>
  1334. <h3>Notes</h3>
  1335. <p>Setting the amplitude to zero causes this object to stop using
  1336. CPU time to generate random numbers.
  1337. </p>
  1338. </script>
  1339. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  1340. <div class="form-row">
  1341. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1342. <input type="text" id="node-input-name" placeholder="Name">
  1343. </div>
  1344. </script>
  1345. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  1346. <h3>Summary</h3>
  1347. <div>
  1348. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  1349. </p>
  1350. <!--
  1351. <p align=center><img src="img/whitenoise.png"></p>
  1352. -->
  1353. </div>
  1354. <h3>Audio Connections</h3>
  1355. <table class=doc align=center cellpadding=3>
  1356. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1357. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  1358. </table>
  1359. <h3>Functions</h3>
  1360. <p class=func><span class=keyword>amplitude</span>(level);</p>
  1361. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  1362. The default is off. Noise is generated only after setting
  1363. to a non-zero level.
  1364. </p>
  1365. <h3>Examples</h3>
  1366. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1367. </p>
  1368. <h3>Notes</h3>
  1369. <p>Setting the amplitude to zero causes this object to stop using
  1370. CPU time. CPU usage is approx 3% on Teensy 3.1.
  1371. </p>
  1372. <p>Stefan Stenzel's
  1373. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  1374. algorithm. Stefan's terms of use are "Use for any purpose. If used
  1375. in a commercial product, you should give me one."
  1376. </p>
  1377. </script>
  1378. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  1379. <div class="form-row">
  1380. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1381. <input type="text" id="node-input-name" placeholder="Name">
  1382. </div>
  1383. </script>
  1384. <script type="text/x-red" data-help-name="AudioEffectFade">
  1385. <h3>Summary</h3>
  1386. <p>Gradually increase or decrease audio level.</p>
  1387. <h3>Audio Connections</h3>
  1388. <table class=doc align=center cellpadding=3>
  1389. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1390. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1391. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1392. </table>
  1393. <h3>Functions</h3>
  1394. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  1395. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  1396. directly to the output) after "milliseconds" time.
  1397. </p>
  1398. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  1399. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  1400. after "milliseconds" time.
  1401. </p>
  1402. <!--
  1403. <h3>Examples</h3>
  1404. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1405. </p>
  1406. -->
  1407. <h3>Notes</h3>
  1408. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  1409. When one fade object is off (fully faded out) and the other on
  1410. (fully faded in), if both are started at the same moment for the
  1411. same time duration, their signal gains always add to 1.0. This
  1412. allows 2 fade objects to work together for a smooth transition
  1413. between a pair of signals.
  1414. </p>
  1415. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1416. should be used when changing
  1417. settings on multiple objects, so all changes always take effect
  1418. at the same moment.
  1419. </p>
  1420. </script>
  1421. <script type="text/x-red" data-template-name="AudioEffectFade">
  1422. <div class="form-row">
  1423. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1424. <input type="text" id="node-input-name" placeholder="Name">
  1425. </div>
  1426. </script>
  1427. <script type="text/x-red" data-help-name="AudioEffectChorus">
  1428. <h3>Summary</h3>
  1429. <p>The chorus effect simulates the richness of several nearly-identical
  1430. sound sources (like the way a choir sounds different to a single singer).
  1431. It does this by sampling from a delay line, so each voice is actually
  1432. the same but at a slightly different point in time. This is a type of
  1433. comb filtering.</p>
  1434. <p>Chorus combines one or more samples ranging from the most recent
  1435. sample back to about 50ms ago. The additional samples are evenly spread
  1436. through the supplied delay line, and there is no modulation.</p>
  1437. <p>If the number of voices is specified as 2, then the
  1438. effect combines the current sample and the oldest sample (the last one
  1439. in the delay line). If the number of voices is 3 then the effect combines
  1440. the most recent sample, the oldest sample and the sample in the middle of
  1441. the delay line.</p>
  1442. <p>For two voices the effect can be represented as:<br/>
  1443. result = (sample(0) + sample(dt))/2<br/>
  1444. where sample(0) represents the current sample and sample(dt)
  1445. is the sample in the delay line from dt milliseconds ago.</p>
  1446. <h3>Audio Connections</h3>
  1447. <table class=doc align=center cellpadding=3>
  1448. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1449. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1450. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  1451. </table>
  1452. <h3>Functions</h3>
  1453. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  1454. <p class=desc>Create a chorus by specifying the address of the delayline, the
  1455. total number of samples in the delay line (often done as an integer multiple of
  1456. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  1457. the original voice (so, 2 and up to get a chorus effect, although you can
  1458. specify 1 if you want).
  1459. </p>
  1460. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  1461. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  1462. </p>
  1463. <h3>Examples</h3>
  1464. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Chorus
  1465. </p>
  1466. <h3>Notes</h3>
  1467. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  1468. </script>
  1469. <script type="text/x-red" data-template-name="AudioEffectChorus">
  1470. <div class="form-row">
  1471. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1472. <input type="text" id="node-input-name" placeholder="Name">
  1473. </div>
  1474. </script>
  1475. <script type="text/x-red" data-help-name="AudioEffectFlange">
  1476. <h3>Summary</h3>
  1477. <p>Originally, flanging was produced by playing the same signal on two synchronized
  1478. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  1479. pressing on the flange of the reel (hence the name). This is a type of
  1480. comb filtering, and produces a harmonically-related series of peaks and notches
  1481. in the audio spectrum.</p>
  1482. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  1483. line, but the position of that sample varies sinusoidally.</p>
  1484. <p>The effect can be represented as:<br>
  1485. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  1486. <p>The value of the sine function is always a number from -1 to +1 and
  1487. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  1488. Thus, the delayed sample will be selected from the range (dt-depth) to
  1489. (dt+depth). This selection will vary at whatever rate is specified as the
  1490. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  1491. <h3>Audio Connections</h3>
  1492. <table class=doc align=center cellpadding=3>
  1493. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1494. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1495. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  1496. </table>
  1497. <h3>Functions</h3>
  1498. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  1499. <p class=desc>Create a flanger by specifying the address of the delayline, the
  1500. total number of samples in the delay line (often done as an integer multiple of
  1501. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  1502. the modulation depth (larger values give a greater variation) and the modulation
  1503. frequency, in Hertz.
  1504. </p>
  1505. <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p>
  1506. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  1507. </p>
  1508. <h3>Examples</h3>
  1509. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Flange
  1510. </p>
  1511. <h3>Notes</h3>
  1512. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  1513. <p>Try these settings:<br>
  1514. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  1515. and<br>
  1516. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  1517. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  1518. double s_freq = 3;</p>
  1519. <p>The flange effect can also produce a chorus-like effect if a longer
  1520. delay line is used with a slower modulation rate, for example try:<br>
  1521. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  1522. and<br>
  1523. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  1524. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  1525. double s_freq = .0625;</p>
  1526. </script>
  1527. <script type="text/x-red" data-template-name="AudioEffectFlange">
  1528. <div class="form-row">
  1529. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1530. <input type="text" id="node-input-name" placeholder="Name">
  1531. </div>
  1532. </script>
  1533. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  1534. <h3>Summary</h3>
  1535. <div>
  1536. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  1537. Release) envelope.
  1538. </p>
  1539. <p align=center><img src="img/dahdsr.png"></p>
  1540. </div>
  1541. <h3>Audio Connections</h3>
  1542. <table class=doc align=center cellpadding=3>
  1543. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1544. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1545. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1546. </table>
  1547. <h3>Functions</h3>
  1548. <p class=func><span class=keyword>noteOn</span>();</p>
  1549. <p class=desc>Begin the delay to attack, or the attack phase is
  1550. delay is zero.
  1551. </p>
  1552. <p class=func><span class=keyword>noteOff</span>();</p>
  1553. <p class=desc>Begin the release phase.
  1554. </p>
  1555. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  1556. <p class=desc>Set the delay from noteOn to the attach phase. The
  1557. default is zero, for no delay.
  1558. </p>
  1559. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  1560. <p class=desc>Set the attack time. The default is 1.5 milliseconds.
  1561. </p>
  1562. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  1563. <p class=desc>Set the hold time. The default is 0.5 milliseconds.
  1564. </p>
  1565. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  1566. <p class=desc>Set the decay time. The default is 15 milliseconds.
  1567. </p>
  1568. <p class=func><span class=keyword>sustain</span>(level);</p>
  1569. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  1570. gain will be maintained at this level after the decay phase,
  1571. until noteOff() is called.
  1572. </p>
  1573. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  1574. <p class=desc>Set the release time. The default is 30 millisecond.
  1575. </p>
  1576. <h3>Examples</h3>
  1577. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
  1578. </p>
  1579. <p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; pulseWidth
  1580. </p>
  1581. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  1582. </p>
  1583. <h3>Notes</h3>
  1584. <p>To achieve the more common ADSR shape, simply
  1585. set delay and hold to zero.</p>
  1586. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  1587. milliseconds. Up to 200 ms can be used, with somewhat reduced
  1588. accuracy</p>
  1589. </script>
  1590. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  1591. <div class="form-row">
  1592. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1593. <input type="text" id="node-input-name" placeholder="Name">
  1594. </div>
  1595. </script>
  1596. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  1597. <h3>Summary</h3>
  1598. <div>
  1599. <p>Multiply two signals together, useful for amplitude modulation
  1600. or "voltage controlled amplification".
  1601. </p>
  1602. <p align=center><img src="img/multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  1603. </div>
  1604. <h3>Audio Connections</h3>
  1605. <table class=doc align=center cellpadding=3>
  1606. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1607. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1608. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  1609. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1610. </table>
  1611. <h3>Functions</h3>
  1612. <p>There are no functions to call from the Arduino sketch.
  1613. This object simply multiplies the 2 signals to create
  1614. a continuous output
  1615. </p>
  1616. <!--
  1617. <h3>Examples</h3>
  1618. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1619. </p>
  1620. -->
  1621. <h3>Notes</h3>
  1622. <p>
  1623. </p>
  1624. </script>
  1625. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  1626. <div class="form-row">
  1627. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1628. <input type="text" id="node-input-name" placeholder="Name">
  1629. </div>
  1630. </script>
  1631. <script type="text/x-red" data-help-name="AudioEffectDelay">
  1632. <h3>Summary</h3>
  1633. <div>
  1634. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  1635. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1636. </div>
  1637. <h3>Audio Connections</h3>
  1638. <table class=doc align=center cellpadding=3>
  1639. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1640. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1641. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1642. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1643. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1644. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1645. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1646. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1647. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1648. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1649. </table>
  1650. <h3>Functions</h3>
  1651. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1652. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1653. milliseconds. The maximum delay is approx 333 ms. The actual delay
  1654. is rounded to the nearest sample. Each channel can be configured for
  1655. any delay. There is no requirement to configure the "taps" in increasing
  1656. delay order.
  1657. </p>
  1658. <p class=func><span class=keyword>disable</span>(channel);</p>
  1659. <p class=desc>Disable a channel. The output of this channel becomes
  1660. silent. If this channel is the longest delay, memory usage is
  1661. automatically reduced to accomodate only the remaining channels used.
  1662. </p>
  1663. <h3>Examples</h3>
  1664. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  1665. </p>
  1666. <h3>Notes</h3>
  1667. <p>Memory for the delayed signal is take from the memory pool allocated by
  1668. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  1669. Each block allows about 3 milliseconds of delay, so AudioMemory
  1670. should be increased to allow for the longest delay tap.
  1671. </p>
  1672. </script>
  1673. <script type="text/x-red" data-template-name="AudioEffectDelay">
  1674. <div class="form-row">
  1675. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1676. <input type="text" id="node-input-name" placeholder="Name">
  1677. </div>
  1678. </script>
  1679. <script type="text/x-red" data-help-name="AudioEffectDelayExternal">
  1680. <h3>Summary</h3>
  1681. <div>
  1682. <p>Delay a signal, using external memory for longer delay times! Up to 8 separate delay taps can be used.</p>
  1683. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1684. </div>
  1685. <h3>Audio Connections</h3>
  1686. <table class=doc align=center cellpadding=3>
  1687. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1688. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1689. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1690. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1691. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1692. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1693. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1694. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1695. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1696. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1697. </table>
  1698. <h3>Functions</h3>
  1699. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1700. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1701. milliseconds. The maximum delay is approx 333 ms. The actual delay
  1702. is rounded to the nearest sample. Each channel can be configured for
  1703. any delay. There is no requirement to configure the "taps" in increasing
  1704. delay order.
  1705. </p>
  1706. <p class=func><span class=keyword>disable</span>(channel);</p>
  1707. <p class=desc>Disable a channel. The output of this channel becomes
  1708. silent. If this channel is the longest delay, memory usage is
  1709. automatically reduced to accomodate only the remaining channels used.
  1710. </p>
  1711. <h3>Hardware</h3>
  1712. <p>By default, or when <span class=literal>AUDIO_MEMORY_23LC1024</span> is used (see below),
  1713. a single 23LC1024 RAM chip is used, with these pins:
  1714. <table class=doc align=center cellpadding=3>
  1715. <tr class=top><th>Pin</th><th>Signal</th></tr>
  1716. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  1717. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  1718. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  1719. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  1720. </table>
  1721. </p>
  1722. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  1723. 23LC1024 chips are used.
  1724. </p>
  1725. <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>
  1726. <p>
  1727. <table class=doc align=center cellpadding=3>
  1728. <tr class=top><th>Pin</th><th>Signal</th></tr>
  1729. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  1730. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  1731. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  1732. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  1733. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  1734. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  1735. </table>
  1736. </p>
  1737. <p>
  1738. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  1739. must be used. See below for details. Each chip provides 1485 ms of delay
  1740. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  1741. exceed the amount of memory physically present.
  1742. </p>
  1743. <h3>Examples</h3>
  1744. <p>
  1745. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  1746. </p>
  1747. <!--
  1748. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  1749. </p>
  1750. -->
  1751. <p>
  1752. <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)
  1753. </p>
  1754. <h3>Notes</h3>
  1755. <p>External RAM allows for longer delays without consuming
  1756. limited internal RAM. However, SPI communication is required,
  1757. which consumes much more CPU time. The
  1758. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  1759. function may be used to monitor how much CPU time is consumed.
  1760. </p>
  1761. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  1762. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  1763. chips.
  1764. </p>
  1765. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  1766. </p>
  1767. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  1768. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  1769. channels of a stereo signal.
  1770. <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);
  1771. </p>
  1772. </script>
  1773. <script type="text/x-red" data-template-name="AudioEffectDelayExternal">
  1774. <div class="form-row">
  1775. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1776. <input type="text" id="node-input-name" placeholder="Name">
  1777. </div>
  1778. </script>
  1779. <script type="text/x-red" data-help-name="AudioEffectBitcrusher">
  1780. <h3>Summary</h3>
  1781. <p>Reduce the samplerate and/or bitdepth of a source signal, resulting in
  1782. a distorted sound.</p>
  1783. <h3>Audio Connections</h3>
  1784. <table class=doc align=center cellpadding=3>
  1785. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1786. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1787. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1788. </table>
  1789. <h3>Parameters</h3>
  1790. <p class=func><span class=keyword>bits</span>(xcrushBits);</p>
  1791. <p class=desc>xcrushBits sets the bitdepth, from 1 to 16. A Value of 16
  1792. does not crush the bitdepth, and is effectively a passthru for this part
  1793. of the function.</p>
  1794. <p class=func><span class=keyword>sampleRate</span>(xsampleRate);</p>
  1795. <p class=desc>xsampleRate sets the frequency, from 1 to 44100Hz, however it
  1796. works in integer steps so you will only really get a handful of results from
  1797. the many samplerates you can pass. 44100 is passthru.</p>
  1798. <p class=desc>set xbitDepth to 16 and xsampleRate to 44100 to pass audio
  1799. through without any Bitcrush effect.</p>
  1800. <h3>Examples</h3>
  1801. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Bitcrusher
  1802. </p>
  1803. <h3>Notes</h3>
  1804. <p>Needs a lot of improvement. Options for anti-aliasing would be nice in
  1805. the future, but for now, it's rough, it's dirty and it sounds a bit like
  1806. Nine Inch Nails.
  1807. </p>
  1808. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1809. should be used when changing
  1810. settings on multiple objects, so all changes always take effect
  1811. at the same moment.
  1812. </p>
  1813. </script>
  1814. <script type="text/x-red" data-template-name="AudioEffectBitcrusher">
  1815. <div class="form-row">
  1816. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1817. <input type="text" id="node-input-name" placeholder="Name">
  1818. </div>
  1819. </script>
  1820. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  1821. <h3>Summary</h3>
  1822. <div>
  1823. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  1824. Up to 4 stages may be cascaded.
  1825. </p>
  1826. <p align=center><img src="img/biquad.png"></p>
  1827. </div>
  1828. <h3>Audio Connections</h3>
  1829. <table class=doc align=center cellpadding=3>
  1830. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1831. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1832. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1833. </table>
  1834. <h3>Functions</h3>
  1835. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  1836. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  1837. response, with the specified corner frequency and Q shape. If Q is
  1838. higher that 0.7071, be careful of filter gain (see below).
  1839. </p>
  1840. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  1841. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  1842. response, with the specified corner frequency and Q shape. If Q is
  1843. higher that 0.7071, be careful of filter gain (see below).
  1844. </p>
  1845. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  1846. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  1847. response. The filter has unity gain at the specified frequency. Q
  1848. controls the width of frequencies allowed to pass.
  1849. </p>
  1850. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  1851. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  1852. response. Q controls the width of rejected frequencies.
  1853. </p>
  1854. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  1855. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  1856. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  1857. Each coefficient must be less than 2.0 and greater than -2.0. The array
  1858. should be type double. Alternately, it may be type int, where 1.0 is
  1859. represented with 1073741824 (2<sup>30</sup>).
  1860. </p>
  1861. <h3>Examples</h3>
  1862. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter
  1863. </p>
  1864. <h3>Notes</h3>
  1865. <p>Filters can with gain must have their input signals attenuated, so the
  1866. signal does not exceed 1.0.
  1867. </p>
  1868. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  1869. not pass any signal.
  1870. </p>
  1871. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  1872. trouble with limited numerical precision, causing the filter to perform
  1873. poorly. For very low corner frequency, the State Variable (Chamberlin)
  1874. filter should be used.
  1875. </p>
  1876. </script>
  1877. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  1878. <div class="form-row">
  1879. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1880. <input type="text" id="node-input-name" placeholder="Name">
  1881. </div>
  1882. </script>
  1883. <script type="text/x-red" data-help-name="AudioFilterFIR">
  1884. <h3>Summary</h3>
  1885. <div>
  1886. <p>Finite impulse response filter, useful for all sorts of filtering.
  1887. </p>
  1888. <p align=center><img src="img/fir_filter.png"></p>
  1889. </div>
  1890. <h3>Audio Connections</h3>
  1891. <table class=doc align=center cellpadding=3>
  1892. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1893. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1894. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1895. </table>
  1896. <h3>Functions</h3>
  1897. <p class=func><span class=keyword>begin</span>(array, length);</p>
  1898. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  1899. filter's impulse response), and
  1900. length indicates the number of points in the array. Array may also be
  1901. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  1902. filtering.
  1903. </p>
  1904. <p class=func><span class=keyword>end</span>();</p>
  1905. <p class=desc>Turn the filter off.
  1906. </p>
  1907. <h3>Examples</h3>
  1908. <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
  1909. </p>
  1910. <h3>Notes</h3>
  1911. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  1912. implement filters with better phase response.
  1913. </p>
  1914. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  1915. supported filter length is 200 points.
  1916. </p>
  1917. <p>The free
  1918. <a href="http://t-filter.appspot.com/fir/index.html" target="_blank"> TFilter Design Tool</a>
  1919. can be used to create the impulse response array. Be sure to set the sampling
  1920. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  1921. </p>
  1922. <p>
  1923. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  1924. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  1925. and add "const" to avoid consuming extra RAM.
  1926. </p>
  1927. </script>
  1928. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1929. <div class="form-row">
  1930. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1931. <input type="text" id="node-input-name" placeholder="Name">
  1932. </div>
  1933. </script>
  1934. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  1935. <h3>Summary</h3>
  1936. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  1937. adjustable resonance, and optional signal control of corner
  1938. frequency.</p>
  1939. <h3>Audio Connections</h3>
  1940. <table class=doc align=center cellpadding=3>
  1941. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1942. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  1943. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  1944. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  1945. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  1946. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  1947. </table>
  1948. <h3>Functions</h3>
  1949. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1950. <p class=desc>Set the filter's corner frequency. When a signal is
  1951. connected to the control input, the filter will implement this
  1952. frequency when the signal is zero.
  1953. </p>
  1954. <p class=func><span class=keyword>resonance</span>(Q);</p>
  1955. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  1956. Resonance greater than 0.707 will amplify the signal near the
  1957. corner frequency. You must attenuate the signal before input
  1958. to this filter, to prevent clipping.
  1959. </p>
  1960. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  1961. <p class=desc>Set how much (in octaves) the control signal can alter
  1962. the filter's corner freqency. Range is 0 to 7 octaves. For
  1963. example, when set to 2.5, a full scale positive signal (1.0) will
  1964. shift the filter frequency up 2.5 octaves, and a full scale negative
  1965. signal will shift it down 2.5 octaves.
  1966. </p>
  1967. <!--
  1968. <h3>Examples</h3>
  1969. <p class=exam>File &gt; Examples &gt; Audio &gt;
  1970. </p>
  1971. -->
  1972. <h3>Notes</h3>
  1973. <p>
  1974. When controlled by a signal, the equation for the filter
  1975. frequency is:
  1976. </p>
  1977. <p>
  1978. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  1979. <br><small>If anyone knows how to do HTML equations, please
  1980. help me improve this.....</small>
  1981. </p>
  1982. <p>When operating with signal control of corner frequency, this
  1983. object uses approximately 4% of the CPU time on Teensy 3.1.
  1984. </p>
  1985. </script>
  1986. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1987. <div class="form-row">
  1988. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1989. <input type="text" id="node-input-name" placeholder="Name">
  1990. </div>
  1991. </script>
  1992. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  1993. <h3>Summary</h3>
  1994. <p>Track the signal peak amplitude. Very useful for simple
  1995. audio level response projects, and general troubleshooting.</p>
  1996. <h3>Audio Connections</h3>
  1997. <table class=doc align=center cellpadding=3>
  1998. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1999. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2000. </table>
  2001. <h3>Functions</h3>
  2002. <p class=func><span class=keyword>available</span>();</p>
  2003. <p class=desc>Returns true each time new peak data is available.
  2004. </p>
  2005. <p class=func><span class=keyword>read</span>();</p>
  2006. <p class=desc>Read the highest peak value since the last read.
  2007. Return is from 0.0 to 1.0.
  2008. </p>
  2009. <h3>Examples</h3>
  2010. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
  2011. </p>
  2012. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterStereo
  2013. </p>
  2014. <h3>Notes</h3>
  2015. <p></p>
  2016. </script>
  2017. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  2018. <div class="form-row">
  2019. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2020. <input type="text" id="node-input-name" placeholder="Name">
  2021. </div>
  2022. </script>
  2023. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  2024. <h3>Summary</h3>
  2025. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  2026. with real value (magnitude) output. The frequency resolution is
  2027. 172 Hz, useful for simple audio visualization.</p>
  2028. <h3>Audio Connections</h3>
  2029. <table class=doc align=center cellpadding=3>
  2030. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2031. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2032. </table>
  2033. <h3>Functions</h3>
  2034. <p class=func><span class=keyword>available</span>();</p>
  2035. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2036. </p>
  2037. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2038. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  2039. so 1.0 represents a full scale sine wave.
  2040. </p>
  2041. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2042. <p class=desc>Read several frequency bins, returning their sum. The higher
  2043. audio octaves are represented by many bins, which are typically read
  2044. as a group for audio visualization.
  2045. </p>
  2046. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2047. <p class=desc>New data is produced very radidly, approximately 344 times
  2048. per second. Multiple outputs can be averaged together, so available()
  2049. returns true at a slower rate.
  2050. </p>
  2051. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2052. <p class=desc>Set the window function to be used. AudioWindowHanning256
  2053. is the default. Windowing may be disabled by NULL, but windowing
  2054. should be used for all non-periodic (music) signals, and all periodic
  2055. signals that are not exact integer division of the sample rate.
  2056. </p>
  2057. <h3>Examples</h3>
  2058. <p class=exam>File &gt; Examples &gt; Audio &gt; MemoryAndCpuUsage
  2059. </p>
  2060. <h3>Notes</h3>
  2061. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2062. num is 0 to 127.</p>
  2063. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  2064. <p>Window Types:
  2065. <ul>
  2066. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  2067. <li><span class=literal>AudioWindowBartlett256</span></li>
  2068. <li><span class=literal>AudioWindowBlackman256</span></li>
  2069. <li><span class=literal>AudioWindowFlattop256</span></li>
  2070. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  2071. <li><span class=literal>AudioWindowNuttall256</span></li>
  2072. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  2073. <li><span class=literal>AudioWindowWelch256</span></li>
  2074. <li><span class=literal>AudioWindowHamming256</span></li>
  2075. <li><span class=literal>AudioWindowCosine256</span></li>
  2076. <li><span class=literal>AudioWindowTukey256</span></li>
  2077. </ul>
  2078. </p>
  2079. </script>
  2080. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  2081. <div class="form-row">
  2082. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2083. <input type="text" id="node-input-name" placeholder="Name">
  2084. </div>
  2085. </script>
  2086. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  2087. <h3>Summary</h3>
  2088. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  2089. with real value (magnitude) output. The frequency resolution is
  2090. 43 Hz, useful detailed for audio visualization.</p>
  2091. <h3>Audio Connections</h3>
  2092. <table class=doc align=center cellpadding=3>
  2093. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2094. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  2095. </table>
  2096. <h3>Functions</h3>
  2097. <p class=func><span class=keyword>available</span>();</p>
  2098. <p class=desc>Returns true each time the FFT analysis produces new output data.
  2099. </p>
  2100. <p class=func><span class=keyword>read</span>(binNumber);</p>
  2101. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  2102. so 1.0 represents a full scale sine wave.
  2103. </p>
  2104. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  2105. <p class=desc>Read several frequency bins, returning their sum. The higher
  2106. audio octaves are represented by many bins, which are typically read
  2107. as a group for audio visualization.
  2108. </p>
  2109. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  2110. <p class=desc>This function does nothing. The 1024 point FFT always
  2111. updates at approximately 86 times per second.
  2112. </p>
  2113. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  2114. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  2115. is the default. Windowing may be disabled by NULL, but windowing
  2116. should be used for all non-periodic (music) signals, and all periodic
  2117. signals that are not exact integer division of the sample rate.
  2118. </p>
  2119. <h3>Examples</h3>
  2120. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; FFT
  2121. </p>
  2122. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; SpectrumAnalyzerBasic
  2123. </p>
  2124. <h3>Notes</h3>
  2125. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  2126. num is 0 to 511.</p>
  2127. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  2128. <p>Window Types:
  2129. <ul>
  2130. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  2131. <li><span class=literal>AudioWindowBartlett1024</span></li>
  2132. <li><span class=literal>AudioWindowBlackman1024</span></li>
  2133. <li><span class=literal>AudioWindowFlattop1024</span></li>
  2134. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  2135. <li><span class=literal>AudioWindowNuttall1024</span></li>
  2136. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  2137. <li><span class=literal>AudioWindowWelch1024</span></li>
  2138. <li><span class=literal>AudioWindowHamming1024</span></li>
  2139. <li><span class=literal>AudioWindowCosine1024</span></li>
  2140. <li><span class=literal>AudioWindowTukey1024</span></li>
  2141. </ul>
  2142. </p>
  2143. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  2144. Average usage is much lower. Future versions might distribute the
  2145. load more evenly over time....
  2146. </p>
  2147. </script>
  2148. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  2149. <div class="form-row">
  2150. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2151. <input type="text" id="node-input-name" placeholder="Name">
  2152. </div>
  2153. </script>
  2154. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  2155. <h3>Summary</h3>
  2156. <p>Detect the level of a single tone</p>
  2157. <h3>Audio Connections</h3>
  2158. <table class=doc align=center cellpadding=3>
  2159. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2160. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  2161. </table>
  2162. <h3>Functions</h3>
  2163. <p class=func><span class=keyword>frequency</span>(freq);</p>
  2164. <p class=desc>Set the frequency to detect. The default detection time
  2165. will be 10 cycles of this frequency.
  2166. </p>
  2167. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  2168. <p class=desc>Set the frequency to detect, and the number of cycles.
  2169. Longer detection time (more cycles) will give higher precision,
  2170. but of course slower response.
  2171. </p>
  2172. <p class=func><span class=keyword>available</span>();</p>
  2173. <p class=desc>Returns true (non-zero) each time a detection interval
  2174. (number of cycles) completed and a new level is detected.
  2175. </p>
  2176. <p class=func><span class=keyword>read</span>();</p>
  2177. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  2178. </p>
  2179. <p class=func><span class=keyword>threshold</span>(level);</p>
  2180. <p class=desc>Set a detection threshold, where the bool test operation
  2181. will return true if at or above this level, or false when below.
  2182. </p>
  2183. <p class=func>(bool)</p>
  2184. <p class=desc>By testing the object as a boolean value, you can respond
  2185. to detection of a tone.
  2186. </p>
  2187. <h3>Examples</h3>
  2188. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_Serial
  2189. </p>
  2190. <p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; DialTone_7segment
  2191. </p>
  2192. <h3>Notes</h3>
  2193. <p>Low frequency detection has trouble with numerical precision.
  2194. Works really well for all 8 DTMF frequencies, but fails for
  2195. detecting "sub audible tones" used in some control applications.</p>
  2196. <p>The (bool) test continues to return true until the next detection
  2197. interval (the configured number of cycles). This behavior may
  2198. change in future versions, for a single true each time the signal
  2199. is detected, and then false for the remainder of that interval.</p>
  2200. </script>
  2201. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  2202. <div class="form-row">
  2203. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2204. <input type="text" id="node-input-name" placeholder="Name">
  2205. </div>
  2206. </script>
  2207. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  2208. <h3>Summary</h3>
  2209. <p>Print raw audio data to the Arduino Serial Monitor. This
  2210. object creates massive output quickly, and should not normally be used.</p>
  2211. <h3>Audio Connections</h3>
  2212. <table class=doc align=center cellpadding=3>
  2213. <tr class=top><th>Port</th><th>Purpose</th></tr>
  2214. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  2215. </table>
  2216. <h3>Functions</h3>
  2217. <p class=func><span class=keyword>name</span>(string);</p>
  2218. <p class=desc>blah blah blah blah
  2219. </p>
  2220. <p class=func><span class=keyword>trigger</span>();</p>
  2221. <p class=desc>blah blah blah blah
  2222. </p>
  2223. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  2224. <p class=desc>blah blah blah blah
  2225. </p>
  2226. <p class=func><span class=keyword>delay</span>(samples);</p>
  2227. <p class=desc>blah blah blah blah
  2228. </p>
  2229. <p class=func><span class=keyword>length</span>(samples);</p>
  2230. <p class=desc>blah blah blah blah
  2231. </p>
  2232. <!--
  2233. <h3>Examples</h3>
  2234. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2235. </p>
  2236. -->
  2237. <h3>Notes</h3>
  2238. <p>This object doesn't work very well and probably should not be used.</p>
  2239. </script>
  2240. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  2241. <div class="form-row">
  2242. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2243. <input type="text" id="node-input-name" placeholder="Name">
  2244. </div>
  2245. </script>
  2246. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  2247. <h3>Summary</h3>
  2248. <p>Control the SGTL5000 chip on the
  2249. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  2250. SGTL5000 is always used in slave mode, where Teensy controls
  2251. all I2S timing.
  2252. </p>
  2253. <p align=center><img src="img/sgtl5000closeup.jpg"></p>
  2254. <h3>Audio Connections</h3>
  2255. <p>This object has no audio inputs or outputs. Separate i2s objects
  2256. are used to send and receive audio data. I2S master mode objects
  2257. must be used, because this object configures the SGTL5000 in slave
  2258. mode, where it depends on Teensy to provide all I2S clocks.
  2259. This object controls
  2260. how the SGTL5000 will use those I2S audio streams.</p>
  2261. <h3>Functions</h3>
  2262. <p>These are the most commonly used SGTL5000 functions.</p>
  2263. <p class=func><span class=keyword>enable</span>();</p>
  2264. <p class=desc>Start the SGTL5000. This function should be called first.
  2265. </p>
  2266. <p class=func><span class=keyword>volume</span>(level);</p>
  2267. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  2268. 0.8 corresponds to the maximum undistorted output for a full scale
  2269. signal. Usually 0.5 is a comfortable listening level. The line
  2270. level outputs are <em>not</em> changed by this function.
  2271. </p>
  2272. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2273. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  2274. </p>
  2275. <p class=func><span class=keyword>micGain</span>(dB);</p>
  2276. <p class=desc>When using the microphone input, set the amplifier gain.
  2277. The input number is in decibels, from 0 to 63.
  2278. </p>
  2279. <h3>Signal Levels</h3>
  2280. <p>The default signal levels should be used for most applications,
  2281. but these functions allow you to customize the analog signals.</p>
  2282. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  2283. <p class=desc>Silence the headphone output.
  2284. </p>
  2285. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  2286. <p class=desc>Turn the headphone output on.
  2287. </p>
  2288. <p class=func><span class=keyword>muteLineout</span>();</p>
  2289. <p class=desc>Silence the line level outputs.
  2290. </p>
  2291. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  2292. <p class=desc>Turn the line level outputs on.
  2293. </p>
  2294. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  2295. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  2296. Fifteen settings are possible:
  2297. </p>
  2298. <pre class="desc">
  2299. 0: 3.12 Volts p-p
  2300. 1: 2.63 Volts p-p
  2301. 2: 2.22 Volts p-p
  2302. 3: 1.87 Volts p-p
  2303. 4: 1.58 Volts p-p
  2304. 5: 1.33 Volts p-p (default)
  2305. 6: 1.11 Volts p-p
  2306. 7: 0.94 Volts p-p
  2307. 8: 0.79 Volts p-p
  2308. 9: 0.67 Volts p-p
  2309. 10: 0.56 Volts p-p
  2310. 11: 0.48 Volts p-p
  2311. 12: 0.40 Volts p-p
  2312. 13: 0.34 Volts p-p
  2313. 14: 0.29 Volts p-p
  2314. 15: 0.24 Volts p-p
  2315. </pre>
  2316. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  2317. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  2318. settings for left and right. The same 15 settings are available.
  2319. </p>
  2320. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  2321. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  2322. voltage range. The following settings are possible:
  2323. </p>
  2324. <pre class="desc">
  2325. 13: 3.16 Volts p-p
  2326. 14: 2.98 Volts p-p
  2327. 15: 2.83 Volts p-p
  2328. 16: 2.67 Volts p-p
  2329. 17: 2.53 Volts p-p
  2330. 18: 2.39 Volts p-p
  2331. 19: 2.26 Volts p-p
  2332. 20: 2.14 Volts p-p
  2333. 21: 2.02 Volts p-p
  2334. 22: 1.91 Volts p-p
  2335. 23: 1.80 Volts p-p
  2336. 24: 1.71 Volts p-p
  2337. 25: 1.62 Volts p-p
  2338. 26: 1.53 Volts p-p
  2339. 27: 1.44 Volts p-p
  2340. 28: 1.37 Volts p-p
  2341. 29: 1.29 Volts p-p (default)
  2342. 30: 1.22 Volts p-p
  2343. 31: 1.16 Volts p-p
  2344. </pre>
  2345. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  2346. <p class=desc>Adjust the line level outout voltage range, with separate
  2347. settings for left and right. The same settings (13 to 31) are available.
  2348. </p>
  2349. <h3>Signal Conditioning</h3>
  2350. <p>Usually these digital signal conditioning features should be left at their
  2351. default settings.
  2352. </p>
  2353. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  2354. <p class=desc>By default, the analog input (either line-level inputs or mic)
  2355. is high-pass filtered, to remove any DC component. This function
  2356. freezes the filter, so the current DC component is still substracted, but
  2357. the filter stops tracking any DC or low frequency changes.
  2358. </p>
  2359. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  2360. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  2361. low frequencies are allowed to enter the digital signal.
  2362. </p>
  2363. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  2364. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  2365. allows it to resume tracking DC and low frequency changes, if
  2366. previously frozen. This is the default setting.
  2367. </p>
  2368. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  2369. <p class=desc>Normally output volume should be used with volume(), which
  2370. changes the analog gain in the headphone amplifier. This function
  2371. on the other hand controls digital attenuation before conversion to analog, which
  2372. reduces resolution, but allows another fine control of output
  2373. signal level. The ranges is 0 to 1.0, with the default (no digital attenuation)
  2374. at 1.0.
  2375. </p>
  2376. <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and ramping is handled by
  2377. the chip so that a new volume may be set directly in a single call.
  2378. </p>
  2379. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  2380. <p class=desc>Adjust the digital output volume separately on left and
  2381. right channels.
  2382. </p>
  2383. <h3>Audio Processor</h3>
  2384. <p>The optional digital audio processor is capable of implementing
  2385. one or more of: automatic volume control, surround sound control,
  2386. bass enhancement, and tonal adjustments (either a
  2387. simple tone control, or a parametric equalizer, or a graphic equalizer),
  2388. in that order.
  2389. </p>
  2390. <p>These signal processing features are implemented in the SGTL5000 chip,
  2391. so they do not consume CPU time on Teensy. However, the order of
  2392. these processes is fixed in the hardware.
  2393. </p>
  2394. <p>It is good practice to mute the outputs before enabling or disabling
  2395. the Audio Processor, to avoid clicks or thumps.
  2396. </p>
  2397. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  2398. <p class=desc>Enable the audio processor to pre-process the input
  2399. (from either line-level inputs or microphone) before it's sent
  2400. to Teensy by I2S.
  2401. </p>
  2402. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  2403. <p class=desc>Enable the audio processor to post-process Teensy's
  2404. I2S output before it's turned into analog signals for the
  2405. headphones and/or line level outputs.
  2406. </p>
  2407. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  2408. <p class=desc>Disable the audio processor.
  2409. </p>
  2410. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  2411. <p class=desc>Configures the auto volume control, which is implemented as a compressor/expander
  2412. or hard limiter. <em>maxGain</em> is the maximum gain that can be applied for expanding, and
  2413. can take one of three values: 0 (0dB), 1 (6.0dB) and 2 (12dB). Values greater than 2 are treated
  2414. as 2. <em>response</em> controls the integration time for the compressor and can take
  2415. four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume
  2416. over a longer time, allowing short-term peaks through.
  2417. </p>
  2418. <p class=desc>If <em>hardLimit</em> is 0, a 'soft
  2419. knee' compressor is used to progressively compress louder values which are near to or above the
  2420. threashold (the louder they are, the greater the compression). If it is 1, a hard compressor
  2421. is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified
  2422. as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value.
  2423. <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over
  2424. threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level
  2425. drops below threashold, again in dB/s. It is typically set to a longer value than attack.
  2426. </p>
  2427. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  2428. <p class=desc>Enables auto volume control, using the previously specified settings.
  2429. </p>
  2430. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  2431. <p class=desc>Disables auto volume control.
  2432. </p>
  2433. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  2434. <p class=desc>Enable virtual surround processing, to give a broader and
  2435. deeper stereo image (even with mono input).
  2436. </p>
  2437. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  2438. <p class=desc>Disable virtual surround processing. Before disabling, ramp up
  2439. the width to maximum to avoid pops.
  2440. </p>
  2441. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  2442. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2443. </p>
  2444. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  2445. <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest).
  2446. <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
  2447. </p>
  2448. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  2449. <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of
  2450. the original stereo signal has bass levels boosted and is then mixed back into
  2451. the stereo signal, which is then optionally high pass filtered (to remove
  2452. inaudible subsonic frequencies).
  2453. </p>
  2454. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  2455. <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass
  2456. enhancement level to zero.
  2457. </p>
  2458. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  2459. <p class=desc>Configures the bass enhancement by setting the levels of the
  2460. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2461. There is no high-pass filter.
  2462. </p>
  2463. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2464. steps of 0.5dB, to avoid pops.
  2465. </p>
  2466. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  2467. <p class=desc>Configures the bass enhancement by setting the levels of the
  2468. original stereo signal and the bass-enhanced mono level which will be mixed together.
  2469. The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified
  2470. as follows:
  2471. </p>
  2472. <pre class="desc">
  2473. value frequency
  2474. 0 80Hz
  2475. 1 100Hz
  2476. 2 125Hz
  2477. 3 150Hz
  2478. 4 175Hz
  2479. 5 200Hz
  2480. 6 225Hz
  2481. </pre>
  2482. <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in
  2483. steps of 0.5dB, to avoid pops.
  2484. </p>
  2485. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  2486. <p class=desc>Selects the type of frequency control, where <em>n</em> is
  2487. one of</p>
  2488. <p class=desc><b>FLAT_FREQUENCY (0)</b><br>
  2489. Equalizers and tone controls disabled, flat frequency response.</p>
  2490. <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br>
  2491. Enables the 7-band parametric equalizer, thus disabling the
  2492. tone controls and graphic equalizer.</p>
  2493. <p class=desc><b>TONE_CONTROLS (2)</b><br>
  2494. Enables bass and treble tone controls, disabling the parametric
  2495. equalization and graphic equalizer.</p>
  2496. <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br>
  2497. Enables the five-band graphic equalizer, disabling the parametric
  2498. equalization and tone controls.</p>
  2499. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  2500. <p class=desc>Configures bass and treble tone controls, which are
  2501. implemented as one second order low pass filter (bass) in parallel with
  2502. one second order high pass filter (treble).
  2503. </p>
  2504. <p class=desc>When changing bass or treble level, call this function repeatedly to ramp
  2505. up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops.
  2506. </p>
  2507. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  2508. <p class=desc>Configures the graphic equalizer. It is implemented by five parallel,
  2509. second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz,
  2510. and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB).
  2511. </p>
  2512. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  2513. <p class=desc>Configures the gain or cut on one band in the graphic equalizer.
  2514. <em>bandnum</em> can range from 1 to 5; <em>n</em> is a float in the range 1.00 to -1.00.
  2515. </p>
  2516. <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB,
  2517. to avoid pops.
  2518. </p>
  2519. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  2520. <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7)
  2521. is specified along with a pointer to an array of filter coefficients.
  2522. The parametric equalizer is implemented using 7 cascaded, second order bi-quad
  2523. filters whose frequencies, gain, and Q may be freely configured, but each filter
  2524. can only be specified as a set of filter coefficients.
  2525. </p>
  2526. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  2527. <p class=desc>Enables zero or more of the already enabled parametric filters.
  2528. </p>
  2529. <h3>Examples</h3>
  2530. <p>Nearly all of the library's examples use this object. These
  2531. examples demonstrate its special features.
  2532. </p>
  2533. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; PassThroughStereo
  2534. </p>
  2535. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_bass_enhance
  2536. </p>
  2537. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; dap_avc_agc
  2538. </p>
  2539. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceDAC
  2540. </p>
  2541. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; balanceHP
  2542. </p>
  2543. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; SGTL5000 &gt; CalcBiquadToneControlDAP
  2544. </p>
  2545. <h3>Notes</h3>
  2546. <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost
  2547. and surround enhancement while speech uses bandpass filtering and auto volume control
  2548. compression.
  2549. </p>
  2550. <p>TODO: add example with two analogRead pots for bass and treble to demonstrate ramping.
  2551. </p>
  2552. </script>
  2553. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  2554. <div class="form-row">
  2555. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2556. <input type="text" id="node-input-name" placeholder="Name">
  2557. </div>
  2558. </script>
  2559. <script type="text/x-red" data-help-name="AudioControlWM8731">
  2560. <h3>Summary</h3>
  2561. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  2562. <h3>Audio Connections</h3>
  2563. <p>This object has no audio inputs or outputs. Separate i2s objects
  2564. are used to send and receive audio data. I2S master mode objects
  2565. must be used, since this control object configures the WM8731 into
  2566. slave mode.
  2567. </p>
  2568. <h3>Functions</h3>
  2569. <p class=func><span class=keyword>enable</span>();</p>
  2570. <p class=desc>blah blah blah blah
  2571. </p>
  2572. <p class=func><span class=keyword>disable</span>();</p>
  2573. <p class=desc>not implemented
  2574. </p>
  2575. <p class=func><span class=keyword>volume</span>(level);</p>
  2576. <p class=desc>blah blah blah blah
  2577. </p>
  2578. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2579. <p class=desc>not implemented
  2580. </p>
  2581. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2582. <p class=desc>not implemented
  2583. </p>
  2584. <!--
  2585. <h3>Examples</h3>
  2586. <p class=exam>File &gt; Examples &gt; Audio &gt;
  2587. </p>
  2588. -->
  2589. <h3>Notes</h3>
  2590. <p></p>
  2591. </script>
  2592. <script type="text/x-red" data-template-name="AudioControlWM8731">
  2593. <div class="form-row">
  2594. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2595. <input type="text" id="node-input-name" placeholder="Name">
  2596. </div>
  2597. </script>
  2598. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  2599. <h3>Summary</h3>
  2600. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  2601. <h3>Audio Connections</h3>
  2602. <p>This object has no audio inputs or outputs. Separate i2s objects
  2603. are used to send and receive audio data. I2S slave mode objects
  2604. must be used, since this control object configures the WM8731 into
  2605. master mode.
  2606. </p>
  2607. <h3>Functions</h3>
  2608. <p class=func><span class=keyword>enable</span>();</p>
  2609. <p class=desc>blah blah blah blah
  2610. </p>
  2611. <p class=func><span class=keyword>disable</span>();</p>
  2612. <p class=desc>not implemented
  2613. </p>
  2614. <p class=func><span class=keyword>volume</span>(level);</p>
  2615. <p class=desc>blah blah blah blah
  2616. </p>
  2617. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2618. <p class=desc>not implemented
  2619. </p>
  2620. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2621. <p class=desc>not implemented
  2622. </p>
  2623. <h3>Examples</h3>
  2624. <p class=exam>File &gt; Examples &gt; Audio &gt; HardwareTesting &gt; WM8731MikroSine
  2625. </p>
  2626. <h3>Notes</h3>
  2627. <p></p>
  2628. </script>
  2629. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  2630. <div class="form-row">
  2631. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2632. <input type="text" id="node-input-name" placeholder="Name">
  2633. </div>
  2634. </script>
  2635. </body>
  2636. </html>