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

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