Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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