您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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