Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

1596 lines
57KB

  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('AnalogInputI2S',{
  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="AnalogInputI2S">
  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>Notes</h3>
  46. <p>Normally, this object is used with the Audio Shield, which
  47. is controlled separately by the "sgtl5000" object.</p>
  48. <p>Only one I2S input and one I2S output object may be used. Master
  49. and slave modes may not be mixed (both must be of the same type).
  50. </p>
  51. <p>I2S master objects can be used together with non-I2S input and output
  52. objects, for simultaneous audio streaming on different hardware.</p>
  53. </script>
  54. <script type="text/x-red" data-template-name="AnalogInputI2S">
  55. <div class="form-row">
  56. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  57. <input type="text" id="node-input-name" placeholder="Name">
  58. </div>
  59. </script>
  60. <script type="text/javascript">
  61. RED.nodes.registerType('AnalogInputI2Sslave',{
  62. shortName: "i2ss",
  63. inputs:0,
  64. outputs:2,
  65. category: 'input-function',
  66. color:"#E6E0F8",
  67. icon: "arrow-in.png"
  68. });
  69. </script>
  70. <script type="text/x-red" data-help-name="AnalogInputI2Sslave">
  71. <h3>Summary</h3>
  72. <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p>
  73. <h3>Audio Connections</h3>
  74. <table class=doc align=center cellpadding=3>
  75. <tr class=top><th>Port</th><th>Purpose</th></tr>
  76. <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr>
  77. <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr>
  78. </table>
  79. <h3>Functions</h3>
  80. <p>This object has no functions to call from the Arduino sketch. It
  81. simply streams data from the I2S hardware to its 2 output ports.</p>
  82. <h3>Hardware</h3>
  83. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  84. data timing.</p>
  85. <table class=doc align=center cellpadding=3>
  86. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  87. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  88. <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr>
  89. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  90. </table>
  91. <h3>Notes</h3>
  92. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  93. PWM</b> signals. Differences in timing between the I2S device and
  94. Teensy's clock can cause occasional audio glitches when I2S slave mode
  95. is used together with other input or output objects based on Teensy's
  96. timing.</p>
  97. <p>Only one I2S input and one I2S output object may be used. Master
  98. and slave modes may not be mixed (both must be of the same type).
  99. </p>
  100. </script>
  101. <script type="text/x-red" data-template-name="AnalogInputI2Sslave">
  102. <div class="form-row">
  103. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  104. <input type="text" id="node-input-name" placeholder="Name">
  105. </div>
  106. </script>
  107. <script type="text/javascript">
  108. RED.nodes.registerType('AnalogInputADC',{
  109. shortName: "adc",
  110. inputs:0,
  111. outputs:1,
  112. category: 'input-function',
  113. color:"#E6E0F8",
  114. icon: "arrow-in.png"
  115. });
  116. </script>
  117. <script type="text/x-red" data-help-name="AnalogInputADC">
  118. <h3>Summary</h3>
  119. <p>Receive audio using the built-in analog to digital converter.</p>
  120. <h3>Audio Connections</h3>
  121. <table class=doc align=center cellpadding=3>
  122. <tr class=top><th>Port</th><th>Purpose</th></tr>
  123. <tr class=odd><td align=center>Out 0</td><td>Audio Channel</td></tr>
  124. </table>
  125. <h3>Parameters</h3>
  126. <table class=doc align=center cellpadding=3>
  127. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  128. <tr class=odd><td align=center>Pin</td><td>Integer</td><td>Analog Pin To Use</td></tr>
  129. </table>
  130. <p>The pin number should be specified as "A0" to "A20"</p>
  131. <p align=center><img src="adcpins2.jpg"></p>
  132. <p align=center><img src="adcpins1.jpg"></p>
  133. <h3>Functions</h3>
  134. <p>This object has no functions to call from the Arduino sketch. It
  135. simply streams data from the ADC to its output port.</p>
  136. <h3>Hardware</h3>
  137. <p>Signal range is 0 to 1.2V</p>
  138. <p>Need for DC bias, approx 0.6V</p>
  139. <p>TODO: suggested circuity for signal input</p>
  140. <h3>Notes</h3>
  141. <p>Algorithm for automatic DC bias tracking</p>
  142. <p>Noise due to high source impedance</p>
  143. <p>Power Supply rejection issue with simple DC bias</p>
  144. <p>TODO: actual noise measurements with different input circuitry
  145. (it's not nearly as quiet as the audio shield)</p>
  146. </script>
  147. <script type="text/x-red" data-template-name="AnalogInputADC">
  148. <div class="form-row">
  149. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  150. <input type="text" id="node-input-name" placeholder="Name">
  151. </div>
  152. </script>
  153. <script type="text/javascript">
  154. RED.nodes.registerType('AnalogOutputI2S',{
  155. shortName: "i2s",
  156. inputs:2,
  157. outputs:0,
  158. category: 'output-function',
  159. color:"#E6E0F8",
  160. icon: "arrow-in.png"
  161. });
  162. </script>
  163. <script type="text/x-red" data-help-name="AnalogOutputI2S">
  164. <h3>Summary</h3>
  165. <p>Transmit 16 bit stereo audio to the
  166. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  167. or another I2S device, using I2S master mode.</p>
  168. <p align=center><img src="audioshield_outputs.jpg"></p>
  169. <h3>Audio Connections</h3>
  170. <table class=doc align=center cellpadding=3>
  171. <tr class=top><th>Port</th><th>Purpose</th></tr>
  172. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  173. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  174. </table>
  175. <h3>Functions</h3>
  176. <p>This object has no functions to call from the Arduino sketch. It
  177. simply streams data from its 2 input ports to the I2S hardware.</p>
  178. <h3>Hardware</h3>
  179. <p align=center><img src="audioshield_backside.jpg"></p>
  180. <p>The I2S signals are used in "master" mode, where Teensy creates
  181. all 3 clock signals and controls all data timing.</p>
  182. <table class=doc align=center cellpadding=3>
  183. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  184. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  185. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  186. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  187. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  188. </table>
  189. <p>Audio from
  190. master mode I2S may be used in the same project as ADC, DAC and
  191. PWM signals, because all remain in sync to Teensy's timing</p>
  192. <h3>Notes</h3>
  193. <p>Normally, this object is used with the Audio Shield, which
  194. is controlled separately by the "sgtl5000" object.</p>
  195. <p>Only one I2S input and one I2S output object may be used. Master
  196. and slave modes may not be mixed (both must be of the same type).
  197. </p>
  198. </script>
  199. <script type="text/x-red" data-template-name="AnalogOutputI2S">
  200. <div class="form-row">
  201. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  202. <input type="text" id="node-input-name" placeholder="Name">
  203. </div>
  204. </script>
  205. <script type="text/javascript">
  206. RED.nodes.registerType('AnalogOutputI2Sslave',{
  207. shortName: "i2ss",
  208. inputs:2,
  209. outputs:0,
  210. category: 'output-function',
  211. color:"#E6E0F8",
  212. icon: "arrow-in.png"
  213. });
  214. </script>
  215. <script type="text/x-red" data-help-name="AnalogOutputI2Sslave">
  216. <h3>Summary</h3>
  217. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p>
  218. <h3>Audio Connections</h3>
  219. <table class=doc align=center cellpadding=3>
  220. <tr class=top><th>Port</th><th>Purpose</th></tr>
  221. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  222. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  223. </table>
  224. <h3>Functions</h3>
  225. <p>This object has no functions to call from the Arduino sketch. It
  226. simply streams data from its 2 input ports to the I2S hardware.</p>
  227. <h3>Hardware</h3>
  228. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  229. data timing.</p>
  230. <table class=doc align=center cellpadding=3>
  231. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  232. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  233. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  234. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  235. </table>
  236. <h3>Notes</h3>
  237. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  238. PWM</b> signals. Differences in timing between the I2S device and
  239. Teensy's clock can cause occasional audio glitches when I2S slave mode
  240. is used together with other input or output objects based on Teensy's
  241. timing.</p>
  242. <p>Only one I2S input and one I2S output object may be used. Master
  243. and slave modes may not be mixed (both must be of the same type).
  244. </p>
  245. </script>
  246. <script type="text/x-red" data-template-name="AnalogOutputI2Sslave">
  247. <div class="form-row">
  248. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  249. <input type="text" id="node-input-name" placeholder="Name">
  250. </div>
  251. </script>
  252. <script type="text/javascript">
  253. RED.nodes.registerType('AnalogOutputAnalog',{
  254. shortName: "dac",
  255. inputs:1,
  256. outputs:0,
  257. category: 'output-function',
  258. color:"#E6E0F8",
  259. icon: "arrow-in.png"
  260. });
  261. </script>
  262. <script type="text/x-red" data-help-name="AnalogOutputAnalog">
  263. <h3>Summary</h3>
  264. <p>Transmit 12 bit audio using Teensy 3.1's built-in digital to analog converter.</p>
  265. <h3>Audio Connections</h3>
  266. <table class=doc align=center cellpadding=3>
  267. <tr class=top><th>Port</th><th>Purpose</th></tr>
  268. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  269. </table>
  270. <h3>Functions</h3>
  271. <p>This object has no functions to call from the Arduino sketch. It
  272. simply streams data from the ADC to its output port.</p>
  273. <h3>Hardware</h3>
  274. <p align=center><img src="dacpin.jpg"></p>
  275. <p>Signal range is 0 to 1.2V</p>
  276. <p>Most applications require at least a 10&micro;F DC-blocking capacitor.</p>
  277. <p>TODO: photo of Teensy 3.1 with 10&micro;F capacitor and 3.5mm jack.</p>
  278. <h3>Notes</h3>
  279. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  280. not filtered. This may not
  281. be an issue for many uses, but care should be used if amplified and driven
  282. to high power tweeters.</p>
  283. </script>
  284. <script type="text/x-red" data-template-name="AnalogOutputAnalog">
  285. <div class="form-row">
  286. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  287. <input type="text" id="node-input-name" placeholder="Name">
  288. </div>
  289. </script>
  290. <script type="text/javascript">
  291. RED.nodes.registerType('AnalogOutputPWM',{
  292. shortName: "pwm",
  293. inputs:1,
  294. outputs:0,
  295. category: 'output-function',
  296. color:"#E6E0F8",
  297. icon: "arrow-in.png"
  298. });
  299. </script>
  300. <script type="text/x-red" data-help-name="AnalogOutputPWM">
  301. <h3>Summary</h3>
  302. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  303. used for coarse and fine pulses, to be combined by scaled
  304. resistors.</p>
  305. <h3>Audio Connections</h3>
  306. <table class=doc align=center cellpadding=3>
  307. <tr class=top><th>Port</th><th>Purpose</th></tr>
  308. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  309. </table>
  310. <h3>Functions</h3>
  311. <p>This object has no functions to call from the Arduino sketch. It
  312. simply streams data from the its input port to the PWM pins.</p>
  313. <h3>Hardware</h3>
  314. <p>The following circuit is recommended.</p>
  315. <p align=center><img src="pwmdualcircuit.jpg"></p>
  316. <p>Signal range is approx 1.55 Vp-p.</p>
  317. <p>These resistor values assume approx 20 ohms output impedance
  318. on the digital pins. The 127K resistor may be adjusted or
  319. trimmed for variation in output drive and tolerance on the
  320. 475 ohm resistor.</p>
  321. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  322. C0G/NPO ceramic capacitor should be used for filtering. Low
  323. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  324. <h3>Notes</h3>
  325. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  326. will only slightly filter the carrier. Extra filtering will be
  327. required for a clean signal without the ultrasonic PWM carrier.
  328. </p>
  329. <p>Analog signals created by filtering PWM waveforms use the digital
  330. power supply as their reference voltage. Any noise on the digital
  331. power line can directly couple to the output signal. The built-in DAC or
  332. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  333. should be used when higher quality signals are needed.</p>
  334. </script>
  335. <script type="text/x-red" data-template-name="AnalogOutputPWM">
  336. <div class="form-row">
  337. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  338. <input type="text" id="node-input-name" placeholder="Name">
  339. </div>
  340. </script>
  341. <script type="text/javascript">
  342. RED.nodes.registerType('AudioMixer4',{
  343. shortName: "mixer",
  344. inputs:4,
  345. outputs:1,
  346. category: 'mixer-function',
  347. color:"#E6E0F8",
  348. icon: "arrow-in.png"
  349. });
  350. </script>
  351. <script type="text/x-red" data-help-name="AudioMixer4">
  352. <h3>Summary</h3>
  353. <p>Combine up to 4 audio signals together, each with adjustable gain.
  354. All channels support signal attenuation or amplification.</p>
  355. <h3>Audio Connections</h3>
  356. <table class=doc align=center cellpadding=3>
  357. <tr class=top><th>Port</th><th>Purpose</th></tr>
  358. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  359. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  360. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  361. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  362. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  363. </table>
  364. <h3>Functions</h3>
  365. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  366. <p class=desc>Adjust the amplification or attenuation. "channel" must
  367. be 0 to 3. "level" may be any floating point number from 0 to 32767.
  368. 1.0 passes the signal through directly. Level of 0 shuts the channel
  369. off completely. Between 0 to 1.0 attenuates the signal, and above
  370. 1.0 amplifies it. All 4 channels have separate settings.
  371. </p>
  372. <h3>Notes</h3>
  373. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  374. or when multiple signals add together to greater than 1.0.</p>
  375. <p>More than 4 channels may be combined by connecting multiple mixers
  376. in tandem. For example, a 16 channel mixer may be built using 5
  377. mixers, where the fifth mixer combines the outputs of the first 4.
  378. </p>
  379. </script>
  380. <script type="text/x-red" data-template-name="AudioMixer4">
  381. <div class="form-row">
  382. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  383. <input type="text" id="node-input-name" placeholder="Name">
  384. </div>
  385. </script>
  386. <script type="text/javascript">
  387. RED.nodes.registerType('AudioPlayMemory',{
  388. shortName: "playMem",
  389. inputs:0,
  390. outputs:1,
  391. category: 'play-function',
  392. color:"#E6E0F8",
  393. icon: "arrow-in.png"
  394. });
  395. </script>
  396. <script type="text/x-red" data-help-name="AudioPlayMemory">
  397. <h3>Summary</h3>
  398. <p>Play a short sound clip, stored directly in memory.
  399. Data files are created with the
  400. <a href="https://github.com/PaulStoffregen/Audio/tree/master/examples/PlayFromSketch/wav2sketch" target="_blank">wav2sketch program</a>,
  401. and copied to the sketch folder to become part of your sketch.</p>
  402. <h3>Audio Connections</h3>
  403. <table class=doc align=center cellpadding=3>
  404. <tr class=top><th>Port</th><th>Purpose</th></tr>
  405. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  406. </table>
  407. <h3>Functions</h3>
  408. <p class=func><span class=keyword>play</span>(data);</p>
  409. <p class=desc>Begin playing a sound clip. If already playing, the
  410. currently playing clip is stopped and this new data begins
  411. playing from the beginning.
  412. </p>
  413. <p class=func><span class=keyword>stop</span>();</p>
  414. <p class=desc>Stop playing. If not playing, this function has no effect.
  415. </p>
  416. <p class=func><span class=keyword>isPlaying</span>();</p>
  417. <p class=desc>Return true (non-zero) if playing, or false (zero)
  418. when not playing.
  419. </p>
  420. <p class=func><span class=keyword>positionMillis</span>();</p>
  421. <p class=desc>While playing, return the current time offset, in
  422. milliseconds. When not playing, the return from this function
  423. is undefined.
  424. </p>
  425. <p class=func><span class=keyword>lengthMillis</span>();</p>
  426. <p class=desc>Return the total length of the current sound clip,
  427. in milliseconds. When not playing, the return from this function
  428. is undefined.
  429. </p>
  430. <h3>Notes</h3>
  431. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  432. <p>TODO: ulaw vs uncompressed encoding</p>
  433. <p>Polyphonic playback can be built by creating multiple
  434. objects, with their output combined by mixers.</p>
  435. </script>
  436. <script type="text/x-red" data-template-name="AudioPlayMemory">
  437. <div class="form-row">
  438. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  439. <input type="text" id="node-input-name" placeholder="Name">
  440. </div>
  441. </script>
  442. <script type="text/javascript">
  443. RED.nodes.registerType('AudioPlaySdWav',{
  444. shortName: "playWav",
  445. inputs:0,
  446. outputs:2,
  447. category: 'play-function',
  448. color:"#E6E0F8",
  449. icon: "arrow-in.png"
  450. });
  451. </script>
  452. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  453. <h3>Summary</h3>
  454. <p>Play a WAV file, stored on a SD card.</p>
  455. <h3>Audio Connections</h3>
  456. <table class=doc align=center cellpadding=3>
  457. <tr class=top><th>Port</th><th>Purpose</th></tr>
  458. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  459. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  460. </table>
  461. <h3>Functions</h3>
  462. <p class=func><span class=keyword>play</span>(filename);</p>
  463. <p class=desc>Begin playing a WAV file. If a file is already playing,
  464. it is stopped and this file starts playing from the beginning.
  465. </p>
  466. <p class=func><span class=keyword>stop</span>();</p>
  467. <p class=desc>Stop playing. If not playing, this function has no effect.
  468. </p>
  469. <p class=func><span class=keyword>isPlaying</span>();</p>
  470. <p class=desc>Return true (non-zero) if playing, or false (zero)
  471. when not playing. See the note below about delayed start.
  472. </p>
  473. <p class=func><span class=keyword>positionMillis</span>();</p>
  474. <p class=desc>While playing, return the current time offset, in
  475. milliseconds. When not playing, the return from this function
  476. is undefined.
  477. </p>
  478. <p class=func><span class=keyword>lengthMillis</span>();</p>
  479. <p class=desc>Return the total length of the current sound clip,
  480. in milliseconds. When not playing, the return from this function
  481. is undefined.
  482. </p>
  483. <h3>Notes</h3>
  484. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  485. files are played, both output ports transmit a copy of the
  486. single sound. Of course, stereo WAV files play with the left
  487. channel on port 0 and the right channel on port 1.
  488. </p>
  489. <p>A brief delay after calling play() will usually occur before
  490. isPlaying() returns true and positionMillis() returns valid
  491. time offset. WAV files have a header at the beginning of the
  492. file, which the audio library must read and parse before
  493. playing can begin.
  494. </p>
  495. <p>While playing, the audio library accesses the SD card automatically.
  496. If card access is required, you must
  497. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  498. to prevent the library from accessing the SD card while you use it.
  499. Disabling the audio library interrupt for too long may cause audible
  500. dropouts or glitches.
  501. </p>
  502. </script>
  503. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  504. <div class="form-row">
  505. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  506. <input type="text" id="node-input-name" placeholder="Name">
  507. </div>
  508. </script>
  509. <script type="text/javascript">
  510. RED.nodes.registerType('AudioPlaySdRaw',{
  511. shortName: "playRaw",
  512. inputs:0,
  513. outputs:1,
  514. category: 'play-function',
  515. color:"#E6E0F8",
  516. icon: "arrow-in.png"
  517. });
  518. </script>
  519. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  520. <h3>Summary</h3>
  521. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  522. than WAV and begins playing immediately, without parsing WAV file
  523. header info.</p>
  524. <h3>Audio Connections</h3>
  525. <table class=doc align=center cellpadding=3>
  526. <tr class=top><th>Port</th><th>Purpose</th></tr>
  527. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  528. </table>
  529. <h3>Functions</h3>
  530. <p class=func><span class=keyword>play</span>(filename);</p>
  531. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  532. it is stopped and this file starts playing from the beginning.
  533. </p>
  534. <p class=func><span class=keyword>stop</span>();</p>
  535. <p class=desc>Stop playing. If not playing, this function has no effect.
  536. </p>
  537. <p class=func><span class=keyword>isPlaying</span>();</p>
  538. <p class=desc>Return true (non-zero) if playing, or false (zero)
  539. when not playing.
  540. </p>
  541. <p class=func><span class=keyword>positionMillis</span>();</p>
  542. <p class=desc>While playing, return the current time offset, in
  543. milliseconds. When not playing, the return from this function
  544. is undefined.
  545. </p>
  546. <p class=func><span class=keyword>lengthMillis</span>();</p>
  547. <p class=desc>Return the total length of the current sound clip,
  548. in milliseconds. When not playing, the return from this function
  549. is undefined.
  550. </p>
  551. <h3>Notes</h3>
  552. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  553. </p>
  554. <p>While playing, the audio library accesses the SD card automatically.
  555. If card access is required, you must
  556. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  557. to prevent the library from accessing the SD card while you use it.
  558. Disabling the audio library interrupt for too long may cause audible
  559. dropouts or glitches.
  560. </p>
  561. </script>
  562. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  563. <div class="form-row">
  564. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  565. <input type="text" id="node-input-name" placeholder="Name">
  566. </div>
  567. </script>
  568. <script type="text/javascript">
  569. RED.nodes.registerType('AudioPlayQueue',{
  570. shortName: "queue",
  571. inputs:0,
  572. outputs:1,
  573. category: 'play-function',
  574. color:"#E6E0F8",
  575. icon: "arrow-in.png"
  576. });
  577. </script>
  578. <script type="text/x-red" data-help-name="AudioPlayQueue">
  579. <h3>Summary</h3>
  580. <p>Play audio data provided by the Arduino sketch. This object provides
  581. functions to allow the sketch code to push data into the audio system.</p>
  582. <h3>Audio Connections</h3>
  583. <table class=doc align=center cellpadding=3>
  584. <tr class=top><th>Port</th><th>Purpose</th></tr>
  585. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  586. </table>
  587. <h3>Functions</h3>
  588. <p class=func><span class=keyword>play</span>(int16);</p>
  589. <p class=desc>not yet implemented
  590. </p>
  591. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  592. <p class=desc>not yet implemented
  593. </p>
  594. <p class=func><span class=keyword>getBuffer</span>();</p>
  595. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  596. is within the audio library memory pool, providing the most efficient
  597. way to input data to the audio system. The buffer is likely to be
  598. populated by previously used data, so the entire 128 words should be
  599. written before calling playBuffer(). Only a single buffer should be
  600. requested at a time. This function may return NULL if no memory is
  601. available.
  602. </p>
  603. <p class=func><span class=keyword>playBuffer</span>();</p>
  604. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  605. </p>
  606. <h3>Notes</h3>
  607. <p>TODO: many caveats....</p>
  608. <p>
  609. </p>
  610. </script>
  611. <script type="text/x-red" data-template-name="AudioPlayQueue">
  612. <div class="form-row">
  613. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  614. <input type="text" id="node-input-name" placeholder="Name">
  615. </div>
  616. </script>
  617. <script type="text/javascript">
  618. RED.nodes.registerType('AudioSynthWaveformSine',{
  619. shortName: "sine",
  620. inputs:0,
  621. outputs:1,
  622. category: 'synth-function',
  623. color:"#E6E0F8",
  624. icon: "arrow-in.png"
  625. });
  626. </script>
  627. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  628. <h3>Summary</h3>
  629. <p>Create a sine wave signal</p>
  630. <h3>Audio Connections</h3>
  631. <table class=doc align=center cellpadding=3>
  632. <tr class=top><th>Port</th><th>Purpose</th></tr>
  633. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  634. </table>
  635. <h3>Functions</h3>
  636. <p class=func><span class=keyword>frequency</span>(freq);</p>
  637. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  638. be used to create a LFO (Low Frequency Oscillator) for objects
  639. with modulation signal inputs.
  640. </p>
  641. <p class=func><span class=keyword>amplitude</span>(level);</p>
  642. <p class=desc>Set the amplitude, from 0 to 1.0.
  643. </p>
  644. <h3>Notes</h3>
  645. <p></p>
  646. </script>
  647. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  648. <div class="form-row">
  649. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  650. <input type="text" id="node-input-name" placeholder="Name">
  651. </div>
  652. </script>
  653. <script type="text/javascript">
  654. RED.nodes.registerType('AudioSynthWaveformSineModulated',{
  655. shortName: "sine_fm",
  656. inputs:1,
  657. outputs:1,
  658. category: 'synth-function',
  659. color:"#E6E0F8",
  660. icon: "arrow-in.png"
  661. });
  662. </script>
  663. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  664. <h3>Summary</h3>
  665. <p>Create a modulated sine wave, using any audio signal to continuously
  666. modulate the sine wave frequency.</p>
  667. <h3>Audio Connections</h3>
  668. <table class=doc align=center cellpadding=3>
  669. <tr class=top><th>Port</th><th>Purpose</th></tr>
  670. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  671. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  672. </table>
  673. <h3>Functions</h3>
  674. <p class=func><span class=keyword>frequency</span>(freq);</p>
  675. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  676. be this center frequency when the input modulation signal is zero.
  677. Modulation input 1.0 causes the frequency to double, and input -1.0
  678. causes zero Hz (DC) output. For less modulation, attenuate the input
  679. signal (perhaps with a mixer object) before it arrives here.
  680. </p>
  681. <p class=func><span class=keyword>amplitude</span>(level);</p>
  682. <p class=desc>Set the amplitude, from 0 to 1.0.
  683. </p>
  684. <h3>Notes</h3>
  685. <p></p>
  686. </script>
  687. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  688. <div class="form-row">
  689. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  690. <input type="text" id="node-input-name" placeholder="Name">
  691. </div>
  692. </script>
  693. <script type="text/javascript">
  694. RED.nodes.registerType('AudioSynthWaveform',{
  695. shortName: "waveform",
  696. inputs:0,
  697. outputs:1,
  698. category: 'synth-function',
  699. color:"#E6E0F8",
  700. icon: "arrow-in.png"
  701. });
  702. </script>
  703. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  704. <h3>Summary</h3>
  705. <p>Create a waveform: sine, sawtooth, square, or triangle</p>
  706. <h3>Audio Connections</h3>
  707. <table class=doc align=center cellpadding=3>
  708. <tr class=top><th>Port</th><th>Purpose</th></tr>
  709. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  710. </table>
  711. <h3>Functions</h3>
  712. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  713. <p class=desc>Output a waveform.
  714. </p>
  715. <p class=func><span class=keyword>frequency</span>(freq);</p>
  716. <p class=desc>Change the frequency.
  717. </p>
  718. <p class=func><span class=keyword>amplitude</span>(level);</p>
  719. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  720. <h3>Notes</h3>
  721. <p>Supported Waveforms:<br>
  722. <ul>
  723. <li><span class=literal>TONE_TYPE_SINE</span></li>
  724. <li><span class=literal>TONE_TYPE_SAWTOOTH</span></li>
  725. <li><span class=literal>TONE_TYPE_SQUARE</span></li>
  726. <li><span class=literal>TONE_TYPE_TRIANGLE</span></li>
  727. </ul>
  728. </p>
  729. </script>
  730. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  731. <div class="form-row">
  732. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  733. <input type="text" id="node-input-name" placeholder="Name">
  734. </div>
  735. </script>
  736. <script type="text/javascript">
  737. RED.nodes.registerType('AudioSynthToneSweep',{
  738. shortName: "tonesweep",
  739. inputs:0,
  740. outputs:1,
  741. category: 'synth-function',
  742. color:"#E6E0F8",
  743. icon: "arrow-in.png"
  744. });
  745. </script>
  746. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  747. <h3>Summary</h3>
  748. <p>Create a continuously varying (in frequency) sine wave</p>
  749. <h3>Audio Connections</h3>
  750. <table class=doc align=center cellpadding=3>
  751. <tr class=top><th>Port</th><th>Purpose</th></tr>
  752. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  753. </table>
  754. <h3>Functions</h3>
  755. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  756. <p class=desc>Start generating frequency sweep output. The time is specified
  757. in milliseconds. Level is 0 to 1.0.
  758. </p>
  759. <p class=func><span class=keyword>isPlaying</span>();</p>
  760. <p class=desc>Returns true (non-zero) while the output is active.
  761. </p>
  762. <h3>Notes</h3>
  763. <p>Uses excessive CPU time</p>
  764. </script>
  765. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  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('AudioEffectFade',{
  773. shortName: "fade",
  774. inputs:1,
  775. outputs:1,
  776. category: 'effect-function',
  777. color:"#E6E0F8",
  778. icon: "arrow-in.png"
  779. });
  780. </script>
  781. <script type="text/x-red" data-help-name="AudioEffectFade">
  782. <h3>Summary</h3>
  783. <p>Gradually increase or decrease audio level.</p>
  784. <h3>Audio Connections</h3>
  785. <table class=doc align=center cellpadding=3>
  786. <tr class=top><th>Port</th><th>Purpose</th></tr>
  787. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  788. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  789. </table>
  790. <h3>Functions</h3>
  791. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  792. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  793. directly to the output) after "milliseconds" time.
  794. </p>
  795. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  796. <p class=desc>Begin increasing the audio level, to reach 0 (no output)
  797. after "milliseconds" time.
  798. </p>
  799. <h3>Notes</h3>
  800. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  801. When one fade object is off (fully faded out) and the other on
  802. (fully faded in), if both are started at the same moment for the
  803. same time duration, their signal gains always add to 1.0. This
  804. allows 2 fade objects to work together for a smooth transition
  805. between a pair of signals.
  806. </p>
  807. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  808. should be used when changing
  809. settings on multiple objects, so all changes always take effect
  810. at the same moment.
  811. </p>
  812. </script>
  813. <script type="text/x-red" data-template-name="AudioEffectFade">
  814. <div class="form-row">
  815. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  816. <input type="text" id="node-input-name" placeholder="Name">
  817. </div>
  818. </script>
  819. <script type="text/javascript">
  820. RED.nodes.registerType('AudioEffectChorus',{
  821. shortName: "chorus",
  822. inputs:2,
  823. outputs:2,
  824. category: 'effect-function',
  825. color:"#E6E0F8",
  826. icon: "arrow-in.png"
  827. });
  828. </script>
  829. <script type="text/x-red" data-help-name="AudioEffectChorus">
  830. <h3>Summary</h3>
  831. <p>description</p>
  832. <h3>Audio Connections</h3>
  833. <table class=doc align=center cellpadding=3>
  834. <tr class=top><th>Port</th><th>Purpose</th></tr>
  835. <tr class=odd><td align=center></td><td></td></tr>
  836. </table>
  837. <!--<h3>Parameters</h3>
  838. <table class=doc align=center cellpadding=3>
  839. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  840. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  841. </table>
  842. <p>Extra description... Section only present if object has params</p>-->
  843. <h3>Functions</h3>
  844. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  845. <p class=desc>blah blah blah blah
  846. </p>
  847. <p class=func><span class=keyword>stop</span>();</p>
  848. <p class=desc>blah blah blah blah
  849. </p>
  850. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  851. <p class=desc>blah blah blah blah
  852. </p>
  853. <h3>Notes</h3>
  854. <p></p>
  855. </script>
  856. <script type="text/x-red" data-template-name="AudioEffectChorus">
  857. <div class="form-row">
  858. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  859. <input type="text" id="node-input-name" placeholder="Name">
  860. </div>
  861. </script>
  862. <script type="text/javascript">
  863. RED.nodes.registerType('AudioEffectFlange',{
  864. shortName: "flange",
  865. inputs:2,
  866. outputs:2,
  867. category: 'effect-function',
  868. color:"#E6E0F8",
  869. icon: "arrow-in.png"
  870. });
  871. </script>
  872. <script type="text/x-red" data-help-name="AudioEffectFlange">
  873. <h3>Summary</h3>
  874. <p>description</p>
  875. <h3>Audio Connections</h3>
  876. <table class=doc align=center cellpadding=3>
  877. <tr class=top><th>Port</th><th>Purpose</th></tr>
  878. <tr class=odd><td align=center></td><td></td></tr>
  879. </table>
  880. <!--<h3>Parameters</h3>
  881. <table class=doc align=center cellpadding=3>
  882. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  883. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  884. </table>
  885. <p>Extra description... Section only present if object has params</p>-->
  886. <h3>Functions</h3>
  887. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  888. <p class=desc>blah blah blah blah
  889. </p>
  890. <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p>
  891. <p class=desc>blah blah blah blah
  892. </p>
  893. <p class=func><span class=keyword>stop</span>();</p>
  894. <p class=desc>blah blah blah blah
  895. </p>
  896. <h3>Notes</h3>
  897. <p></p>
  898. </script>
  899. <script type="text/x-red" data-template-name="AudioEffectFlange">
  900. <div class="form-row">
  901. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  902. <input type="text" id="node-input-name" placeholder="Name">
  903. </div>
  904. </script>
  905. <script type="text/javascript">
  906. RED.nodes.registerType('AudioFilterBiquad',{
  907. shortName: "biquad",
  908. inputs:1,
  909. outputs:1,
  910. category: 'filter-function',
  911. color:"#E6E0F8",
  912. icon: "arrow-in.png"
  913. });
  914. </script>
  915. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  916. <h3>Summary</h3>
  917. <p>description</p>
  918. <h3>Audio Connections</h3>
  919. <table class=doc align=center cellpadding=3>
  920. <tr class=top><th>Port</th><th>Purpose</th></tr>
  921. <tr class=odd><td align=center></td><td></td></tr>
  922. </table>
  923. <h3>Parameters</h3>
  924. <table class=doc align=center cellpadding=3>
  925. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  926. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  927. </table>
  928. <p>Extra description... Section only present if object has params</p>
  929. <h3>Functions</h3>
  930. <p class=func><span class=keyword>function</span>(parm1, parm2);</p>
  931. <p class=desc>blah blah blah blah
  932. </p>
  933. <h3>Notes</h3>
  934. <p></p>
  935. </script>
  936. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  937. <div class="form-row">
  938. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  939. <input type="text" id="node-input-name" placeholder="Name">
  940. </div>
  941. </script>
  942. <script type="text/javascript">
  943. RED.nodes.registerType('AudioFilterFIR',{
  944. shortName: "fir",
  945. inputs:1,
  946. outputs:1,
  947. category: 'filter-function',
  948. color:"#E6E0F8",
  949. icon: "arrow-in.png"
  950. });
  951. </script>
  952. <script type="text/x-red" data-help-name="AudioFilterFIR">
  953. <h3>Summary</h3>
  954. <p>description</p>
  955. <h3>Audio Connections</h3>
  956. <table class=doc align=center cellpadding=3>
  957. <tr class=top><th>Port</th><th>Purpose</th></tr>
  958. <tr class=odd><td align=center></td><td></td></tr>
  959. </table>
  960. <!--<h3>Parameters</h3>
  961. <table class=doc align=center cellpadding=3>
  962. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  963. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  964. </table>
  965. <p>Extra description... Section only present if object has params</p>-->
  966. <h3>Functions</h3>
  967. <p class=func><span class=keyword>function</span>(parm1, parm2);</p>
  968. <p class=desc>blah blah blah blah
  969. </p>
  970. <h3>Notes</h3>
  971. <p></p>
  972. </script>
  973. <script type="text/x-red" data-template-name="AudioFilterFIR">
  974. <div class="form-row">
  975. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  976. <input type="text" id="node-input-name" placeholder="Name">
  977. </div>
  978. </script>
  979. <script type="text/javascript">
  980. RED.nodes.registerType('AudioPeak',{
  981. shortName: "peak",
  982. inputs:1,
  983. outputs:0,
  984. category: 'analyze-function',
  985. color:"#E6E0F8",
  986. icon: "arrow-in.png"
  987. });
  988. </script>
  989. <script type="text/x-red" data-help-name="AudioPeak">
  990. <h3>Summary</h3>
  991. <p>description</p>
  992. <h3>Audio Connections</h3>
  993. <table class=doc align=center cellpadding=3>
  994. <tr class=top><th>Port</th><th>Purpose</th></tr>
  995. <tr class=odd><td align=center></td><td></td></tr>
  996. </table>
  997. <!--<h3>Parameters</h3>
  998. <table class=doc align=center cellpadding=3>
  999. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1000. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1001. </table>
  1002. <p>Extra description... Section only present if object has params</p>-->
  1003. <h3>Functions</h3>
  1004. <p class=func><span class=keyword>begin</span>(noReset);</p>
  1005. <p class=desc>blah blah blah blah
  1006. </p>
  1007. <p class=func><span class=keyword>stop</span>();</p>
  1008. <p class=desc>blah blah blah blah
  1009. </p>
  1010. <p class=func><span class=keyword>Dpp</span>();</p>
  1011. <p class=desc>blah blah blah blah
  1012. </p>
  1013. <h3>Notes</h3>
  1014. <p></p>
  1015. </script>
  1016. <script type="text/x-red" data-template-name="AudioPeak">
  1017. <div class="form-row">
  1018. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1019. <input type="text" id="node-input-name" placeholder="Name">
  1020. </div>
  1021. </script>
  1022. <script type="text/javascript">
  1023. RED.nodes.registerType('AudioAnalyzeFFT256',{
  1024. shortName: "fft256",
  1025. inputs:1,
  1026. outputs:0,
  1027. category: 'analyze-function',
  1028. color:"#E6E0F8",
  1029. icon: "arrow-in.png"
  1030. });
  1031. </script>
  1032. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  1033. <h3>Summary</h3>
  1034. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  1035. with real value (magnitude) output. The frequency resolution is
  1036. 172 Hz, useful for simple audio visualization.</p>
  1037. <h3>Audio Connections</h3>
  1038. <table class=doc align=center cellpadding=3>
  1039. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1040. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1041. </table>
  1042. <h3>Parameters</h3>
  1043. <table class=doc align=center cellpadding=3>
  1044. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1045. <tr class=odd><td align=center>Num</td><td>Integer</td><td># FFTs to average</td></tr>
  1046. <tr class=odd><td align=center>Window</td><td>Array</td><td>Window method to use</td></tr>
  1047. </table>
  1048. <p>Extra description... Section only present if object has params</p>
  1049. <h3>Functions</h3>
  1050. <p class=func><span class=keyword>available</span>();</p>
  1051. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1052. </p>
  1053. <h3>Notes</h3>
  1054. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1055. num is 0 to 127.</p>
  1056. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1057. <p>Known bug in the library limits to only a single instance of this object.
  1058. This bug will be fixed someday... allowing 2 or more FFTs to run on simultaneously.</p>
  1059. <p>Window Types:
  1060. <ul>
  1061. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  1062. <li><span class=literal>AudioWindowBartlett256</span></li>
  1063. <li><span class=literal>AudioWindowBlackman256</span></li>
  1064. <li><span class=literal>AudioWindowFlattop256</span></li>
  1065. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  1066. <li><span class=literal>AudioWindowNuttall256</span></li>
  1067. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  1068. <li><span class=literal>AudioWindowWelch256</span></li>
  1069. <li><span class=literal>AudioWindowHamming256</span></li>
  1070. <li><span class=literal>AudioWindowCosine256</span></li>
  1071. <li><span class=literal>AudioWindowTukey256</span></li>
  1072. </ul>
  1073. </p>
  1074. </script>
  1075. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  1076. <div class="form-row">
  1077. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1078. <input type="text" id="node-input-name" placeholder="Name">
  1079. </div>
  1080. </script>
  1081. <script type="text/javascript">
  1082. RED.nodes.registerType('AudioAnalyzeFFT1024',{
  1083. shortName: "fft1024",
  1084. inputs:1,
  1085. outputs:0,
  1086. category: 'analyze-function',
  1087. color:"#E6E0F8",
  1088. icon: "arrow-in.png"
  1089. });
  1090. </script>
  1091. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  1092. <h3>Summary</h3>
  1093. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  1094. with real value (magnitude) output. The frequency resolution is
  1095. 43 Hz, useful detailed for audio visualization.</p>
  1096. <h3>Audio Connections</h3>
  1097. <table class=doc align=center cellpadding=3>
  1098. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1099. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1100. </table>
  1101. <h3>Parameters</h3>
  1102. <table class=doc align=center cellpadding=3>
  1103. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1104. <tr class=odd><td align=center>Num</td><td>Integer</td><td># FFTs to average</td></tr>
  1105. <tr class=odd><td align=center>Window</td><td>Array</td><td>Window method to use</td></tr>
  1106. </table>
  1107. <p>Extra description... Section only present if object has params</p>
  1108. <h3>Functions</h3>
  1109. <p class=func><span class=keyword>available</span>();</p>
  1110. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1111. </p>
  1112. <h3>Notes</h3>
  1113. <p>1024 point FFT uses approx 50% of the CPU power on Teensy 3.1</p>
  1114. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1115. num is 0 to 511.</p>
  1116. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1117. <p>Known bug in the library limits to only a single instance of this object.
  1118. This bug will be fixed someday... but 2 instances may not run due to CPU limitation</p>
  1119. <p>Window Types:
  1120. <ul>
  1121. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  1122. </ul>
  1123. </p>
  1124. </script>
  1125. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  1126. <div class="form-row">
  1127. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1128. <input type="text" id="node-input-name" placeholder="Name">
  1129. </div>
  1130. </script>
  1131. <script type="text/javascript">
  1132. RED.nodes.registerType('AudioAnalyzeToneDetect',{
  1133. shortName: "tone",
  1134. inputs:1,
  1135. outputs:0,
  1136. category: 'analyze-function',
  1137. color:"#E6E0F8",
  1138. icon: "arrow-in.png"
  1139. });
  1140. </script>
  1141. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  1142. <h3>Summary</h3>
  1143. <p>Detect the level of a single tone</p>
  1144. <h3>Audio Connections</h3>
  1145. <table class=doc align=center cellpadding=3>
  1146. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1147. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1148. </table>
  1149. <h3>Functions</h3>
  1150. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1151. <p class=desc>Set the frequency to detect. The default detection time
  1152. will be 10 cycles of this frequency.
  1153. </p>
  1154. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  1155. <p class=desc>Set the frequency to detect, and the number of cycles.
  1156. Longer detection time (more cycles) will give higher precision,
  1157. but of course slower response.
  1158. </p>
  1159. <p class=func><span class=keyword>available</span>();</p>
  1160. <p class=desc>Returns true (non-zero) each time a detection interval
  1161. (number of cycles) completed and a new level is detected.
  1162. </p>
  1163. <p class=func><span class=keyword>read</span>();</p>
  1164. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  1165. </p>
  1166. <p class=func><span class=keyword>threshold</span>(level);</p>
  1167. <p class=desc>Set a detection threshold, where the bool test operation
  1168. will return true if at or above this level, or false when below.
  1169. </p>
  1170. <p class=func>(bool)</p>
  1171. <p class=desc>By testing the object as a boolean value, you can respond
  1172. to detection of a tone.
  1173. </p>
  1174. <h3>Notes</h3>
  1175. <p>Low frequency detection has trouble with numerical precision.
  1176. Works really well for all 8 DTMF frequencies, but fails for
  1177. detecting "sub audible tones" used in some control applications.</p>
  1178. <p>The (bool) test continues to return true until the next detection
  1179. interval (the configured number of cycles). This behavior may
  1180. change in future versions, for a single true each time the signal
  1181. is detected, and then false for the remainder of that interval.</p>
  1182. </script>
  1183. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  1184. <div class="form-row">
  1185. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1186. <input type="text" id="node-input-name" placeholder="Name">
  1187. </div>
  1188. </script>
  1189. <script type="text/javascript">
  1190. RED.nodes.registerType('AudioAnalyzePrint',{
  1191. shortName: "print",
  1192. inputs:1,
  1193. outputs:0,
  1194. category: 'analyze-function',
  1195. color:"#E6E0F8",
  1196. icon: "arrow-in.png"
  1197. });
  1198. </script>
  1199. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  1200. <h3>Summary</h3>
  1201. <p>Print raw audio data to the Arduino Serial Monitor. This
  1202. object creates massive output quickly, and should not normall be used.</p>
  1203. <h3>Audio Connections</h3>
  1204. <table class=doc align=center cellpadding=3>
  1205. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1206. <tr class=odd><td align=center></td><td></td></tr>
  1207. </table>
  1208. <!--<h3>Parameters</h3>
  1209. <table class=doc align=center cellpadding=3>
  1210. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1211. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1212. </table>
  1213. <p>Extra description... Section only present if object has params</p>-->
  1214. <h3>Functions</h3>
  1215. <p class=func><span class=keyword>trigger</span>();</p>
  1216. <p class=desc>blah blah blah blah
  1217. </p>
  1218. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  1219. <p class=desc>blah blah blah blah
  1220. </p>
  1221. <p class=func><span class=keyword>delay</span>(samples);</p>
  1222. <p class=desc>blah blah blah blah
  1223. </p>
  1224. <p class=func><span class=keyword>length</span>(samples);</p>
  1225. <p class=desc>blah blah blah blah
  1226. </p>
  1227. <h3>Notes</h3>
  1228. <p></p>
  1229. </script>
  1230. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  1231. <div class="form-row">
  1232. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1233. <input type="text" id="node-input-name" placeholder="Name">
  1234. </div>
  1235. </script>
  1236. <script type="text/javascript">
  1237. RED.nodes.registerType('AudioControlSGTL5000',{
  1238. shortName: "sgtl5000",
  1239. inputs:0,
  1240. outputs:0,
  1241. category: 'control-function',
  1242. color:"#E6E0F8",
  1243. icon: "arrow-in.png"
  1244. });
  1245. </script>
  1246. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  1247. <h3>Summary</h3>
  1248. <p>Control the SGTL5000 chip on the audio shield
  1249. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  1250. SGTL5000 is always used in slave mode, where Teensy controls
  1251. all I2S timing.
  1252. </p>
  1253. <p align=center><img src="sgtl5000closeup.jpg"></p>
  1254. <h3>Audio Connections</h3>
  1255. <p>This object has no audio inputs or outputs. Separate i2s objects
  1256. are used to send and receive audio data. I2S master mode objects
  1257. must be used, because this object configures the SGTL5000 in slave
  1258. mode, where it depends on Teensy to provide all I2S clocks.
  1259. This object controls
  1260. how the SGTL5000 will use those I2S audio streams.</p>
  1261. <h3>Functions</h3>
  1262. <p>These are the most commonly used SGTL5000 functions.</p>
  1263. <p class=func><span class=keyword>enable</span>();</p>
  1264. <p class=desc>blah blah blah blah
  1265. </p>
  1266. <p class=func><span class=keyword>disable</span>();</p>
  1267. <p class=desc>blah blah blah blah
  1268. </p>
  1269. <p class=func><span class=keyword>volume</span>(level);</p>
  1270. <p class=desc>blah blah blah blah
  1271. </p>
  1272. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1273. <p class=desc>blah blah blah blah
  1274. </p>
  1275. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  1276. <p class=desc>blah blah blah blah
  1277. </p>
  1278. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  1279. <p class=desc>blah blah blah blah
  1280. </p>
  1281. <p class=func><span class=keyword>muteLineout</span>();</p>
  1282. <p class=desc>blah blah blah blah
  1283. </p>
  1284. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  1285. <p class=desc>blah blah blah blah
  1286. </p>
  1287. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1288. <p class=desc>AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC
  1289. </p>
  1290. <h3>Signal Adjustment</h3>
  1291. <p>The SGTL5000 supports flexible signal routing (inside the chip) and
  1292. many optional signal conditioning features.</p>
  1293. <p class=func><span class=keyword>route</span>(i2s, dac, dap);</p>
  1294. <p class=desc>blah blah blah blah
  1295. </p>
  1296. <p class=func><span class=keyword>route</span>(i2s, dac, dap, dapmix);</p>
  1297. <p class=desc>blah blah blah blah
  1298. </p>
  1299. <p class=func><span class=keyword>micGain</span>(n);</p>
  1300. <p class=desc>blah blah blah blah
  1301. </p>
  1302. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  1303. <p class=desc>blah blah blah blah
  1304. </p>
  1305. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  1306. <p class=desc>blah blah blah blah
  1307. </p>
  1308. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  1309. <p class=desc>blah blah blah blah
  1310. </p>
  1311. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  1312. <p class=desc>blah blah blah blah
  1313. </p>
  1314. <p class=func><span class=keyword>adcHighPassFilterControl</span>(bypass, freeze);</p>
  1315. <p class=desc>blah blah blah blah
  1316. </p>
  1317. <p class=func><span class=keyword>adcHighPassFilterControl</span>(bypass);</p>
  1318. <p class=desc>blah blah blah blah
  1319. </p>
  1320. <p class=func><span class=keyword>audioMixerEnable</span>(n);</p>
  1321. <p class=desc>blah blah blah blah
  1322. </p>
  1323. <h3>Audio Processor</h3>
  1324. <p>An optional digital audio processor, capable of implementing a
  1325. simple equalizer, filtering, bass enhancement and surround sound
  1326. is available. It can process audio input before the SGTL5000
  1327. sends it by I2S to Teensy, or it can process Teensy's I2S output
  1328. before converting the digital data to analog signals.</p>
  1329. <p class=func><span class=keyword>audioProcessorEnable</span>(n);</p>
  1330. <p class=desc>blah blah blah blah
  1331. </p>
  1332. <p class=func><span class=keyword>audioProcessorEnable</span>();</p>
  1333. <p class=desc>blah blah blah blah
  1334. </p>
  1335. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  1336. <p class=desc>blah blah blah blah
  1337. </p>
  1338. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  1339. <p class=desc>blah blah blah blah
  1340. </p>
  1341. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  1342. <p class=desc>blah blah blah blah
  1343. </p>
  1344. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  1345. <p class=desc>blah blah blah blah
  1346. </p>
  1347. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  1348. <p class=desc>blah blah blah blah
  1349. </p>
  1350. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  1351. <p class=desc>blah blah blah blah
  1352. </p>
  1353. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  1354. <p class=desc>blah blah blah blah
  1355. </p>
  1356. <p class=func><span class=keyword>autoVolumeEnable</span>(n);</p>
  1357. <p class=desc>blah blah blah blah
  1358. </p>
  1359. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  1360. <p class=desc>blah blah blah blah
  1361. </p>
  1362. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  1363. <p class=desc>blah blah blah blah
  1364. </p>
  1365. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  1366. <p class=desc>blah blah blah blah
  1367. </p>
  1368. <p class=func><span class=keyword>enhanceBassEnable</span>(n);</p>
  1369. <p class=desc>blah blah blah blah
  1370. </p>
  1371. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  1372. <p class=desc>blah blah blah blah
  1373. </p>
  1374. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  1375. <p class=desc>blah blah blah blah
  1376. </p>
  1377. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  1378. <p class=desc>blah blah blah blah
  1379. </p>
  1380. <p class=func><span class=keyword>surroundSoundEnable</span>(n);</p>
  1381. <p class=desc>blah blah blah blah
  1382. </p>
  1383. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  1384. <p class=desc>blah blah blah blah
  1385. </p>
  1386. <p class=func><span class=keyword>killAutomation</span>();</p>
  1387. <p class=desc>blah blah blah blah
  1388. </p>
  1389. <h3>Notes</h3>
  1390. <p>TODO: how does the input AGC work
  1391. </p>
  1392. <p>TODO: document signal routing
  1393. </p>
  1394. <p>TODO: line level output adjust is weird arbitrary integers. Should this be
  1395. made into more sensible numbers, or do we just document the integer-voltage
  1396. measurements that correspond to the audio shield's hardware?
  1397. </p>
  1398. <p>TODO: make some sense out of the terribly complex audio processor features &amp; options!
  1399. </p>
  1400. <p>TODO: can some of these enable functions be eliminated and have those features
  1401. automatically enabled or disabled depending on whether the route() function has
  1402. configured signals to/from them?
  1403. </p>
  1404. </script>
  1405. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  1406. <div class="form-row">
  1407. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1408. <input type="text" id="node-input-name" placeholder="Name">
  1409. </div>
  1410. </script>
  1411. <script type="text/javascript">
  1412. RED.nodes.registerType('AudioControlWM8731',{
  1413. shortName: "wm8731",
  1414. inputs:0,
  1415. outputs:0,
  1416. category: 'control-function',
  1417. color:"#E6E0F8",
  1418. icon: "arrow-in.png"
  1419. });
  1420. </script>
  1421. <script type="text/x-red" data-help-name="AudioControlWM8731">
  1422. <h3>Summary</h3>
  1423. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  1424. <h3>Audio Connections</h3>
  1425. <p>This object has no audio inputs or outputs. Separate i2s objects
  1426. are used to send and receive audio data. I2S master mode objects
  1427. must be used, since this control object configures the WM8731 into
  1428. slave mode.
  1429. </p>
  1430. <h3>Functions</h3>
  1431. <p class=func><span class=keyword>enable</span>();</p>
  1432. <p class=desc>blah blah blah blah
  1433. </p>
  1434. <p class=func><span class=keyword>disable</span>();</p>
  1435. <p class=desc>not implemented
  1436. </p>
  1437. <p class=func><span class=keyword>volume</span>(level);</p>
  1438. <p class=desc>blah blah blah blah
  1439. </p>
  1440. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1441. <p class=desc>not implemented
  1442. </p>
  1443. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1444. <p class=desc>not implemented
  1445. </p>
  1446. <h3>Notes</h3>
  1447. <p></p>
  1448. </script>
  1449. <script type="text/x-red" data-template-name="AudioControlWM8731">
  1450. <div class="form-row">
  1451. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1452. <input type="text" id="node-input-name" placeholder="Name">
  1453. </div>
  1454. </script>
  1455. <script type="text/javascript">
  1456. RED.nodes.registerType('AudioControlWM8731master',{
  1457. shortName: "wm8731m",
  1458. inputs:0,
  1459. outputs:0,
  1460. category: 'control-function',
  1461. color:"#E6E0F8",
  1462. icon: "arrow-in.png"
  1463. });
  1464. </script>
  1465. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  1466. <h3>Summary</h3>
  1467. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  1468. <h3>Audio Connections</h3>
  1469. <p>This object has no audio inputs or outputs. Separate i2s objects
  1470. are used to send and receive audio data. I2S slave mode objects
  1471. must be used, since this control object configures the WM8731 into
  1472. master mode.
  1473. </p>
  1474. <h3>Functions</h3>
  1475. <p class=func><span class=keyword>enable</span>();</p>
  1476. <p class=desc>blah blah blah blah
  1477. </p>
  1478. <p class=func><span class=keyword>disable</span>();</p>
  1479. <p class=desc>not implemented
  1480. </p>
  1481. <p class=func><span class=keyword>volume</span>(level);</p>
  1482. <p class=desc>blah blah blah blah
  1483. </p>
  1484. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1485. <p class=desc>not implemented
  1486. </p>
  1487. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1488. <p class=desc>not implemented
  1489. </p>
  1490. <h3>Notes</h3>
  1491. <p></p>
  1492. </script>
  1493. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  1494. <div class="form-row">
  1495. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1496. <input type="text" id="node-input-name" placeholder="Name">
  1497. </div>
  1498. </script>