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.

index.html 155KB

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