Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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