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

4002 satır
179KB

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