Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

3663 lines
163KB

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