選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

2856 行
127KB

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