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

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