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 135KB

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