您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

4331 行
194KB

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