Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1968 lines
70KB

  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>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="AudioInputI2S">
  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('AudioInputI2Sslave',{
  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="AudioInputI2Sslave">
  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="AudioInputI2Sslave">
  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('AudioInputADC',{
  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="AudioInputADC">
  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="AudioInputADC">
  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('AudioOutputI2S',{
  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="AudioOutputI2S">
  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="AudioOutputI2S">
  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('AudioOutputI2Sslave',{
  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="AudioOutputI2Sslave">
  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="AudioOutputI2Sslave">
  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('AudioOutputAnalog',{
  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="AudioOutputAnalog">
  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="AudioOutputAnalog">
  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('AudioOutputPWM',{
  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="AudioOutputPWM">
  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="AudioOutputPWM">
  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('AudioSynthWaveformDc',{
  773. shortName: "dc",
  774. inputs:0,
  775. outputs:1,
  776. category: 'synth-function',
  777. color:"#E6E0F8",
  778. icon: "arrow-in.png"
  779. });
  780. </script>
  781. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  782. <h3>Summary</h3>
  783. <p>Create constant (DC) signal, useful for control of objects that take
  784. a modulation or control input signal. This constant level can be
  785. used to modify other waveforms using mixer or multiplier objects</p>
  786. <h3>Audio Connections</h3>
  787. <table class=doc align=center cellpadding=3>
  788. <tr class=top><th>Port</th><th>Purpose</th></tr>
  789. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  790. </table>
  791. <h3>Functions</h3>
  792. <p class=func><span class=keyword>amplitude</span>(level);</p>
  793. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  794. changed immediately.
  795. </p>
  796. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  797. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  798. gradually changed over a "milliseconds" time period. Any time may
  799. be specified, but periods longer than 1 second may be automatically
  800. shortened for small level changes, due to numerical precision limits.
  801. </p>
  802. <h3>Notes</h3>
  803. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  804. to a pure digital stream of numerical values. But the term is widely
  805. understood in audio applications, so hopefully it's not too confusing?</p>
  806. </script>
  807. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  808. <div class="form-row">
  809. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  810. <input type="text" id="node-input-name" placeholder="Name">
  811. </div>
  812. </script>
  813. <script type="text/javascript">
  814. RED.nodes.registerType('AudioSynthNoiseWhite',{
  815. shortName: "noise",
  816. inputs:0,
  817. outputs:1,
  818. category: 'synth-function',
  819. color:"#E6E0F8",
  820. icon: "arrow-in.png"
  821. });
  822. </script>
  823. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  824. <h3>Summary</h3>
  825. <div>
  826. <p>Create white noise.
  827. </p>
  828. <p align=center><img src="whitenoise.png"></p>
  829. </div>
  830. <h3>Audio Connections</h3>
  831. <table class=doc align=center cellpadding=3>
  832. <tr class=top><th>Port</th><th>Purpose</th></tr>
  833. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  834. </table>
  835. <h3>Functions</h3>
  836. <p class=func><span class=keyword>amplitude</span>(level);</p>
  837. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  838. The default is off. Noise is generated only after setting
  839. to a non-zero level.
  840. </p>
  841. <h3>Notes</h3>
  842. <p>Setting the amplitude to zero causes this object to stop using
  843. CPU time to generate random numbers.
  844. </p>
  845. </script>
  846. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  847. <div class="form-row">
  848. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  849. <input type="text" id="node-input-name" placeholder="Name">
  850. </div>
  851. </script>
  852. <script type="text/javascript">
  853. RED.nodes.registerType('AudioSynthNoisePink',{
  854. shortName: "pink",
  855. inputs:0,
  856. outputs:1,
  857. category: 'synth-function',
  858. color:"#E6E0F8",
  859. icon: "arrow-in.png"
  860. });
  861. </script>
  862. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  863. <h3>Summary</h3>
  864. <div>
  865. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  866. </p>
  867. <!--<p align=center><img src="whitenoise.png"></p>-->
  868. </div>
  869. <h3>Audio Connections</h3>
  870. <table class=doc align=center cellpadding=3>
  871. <tr class=top><th>Port</th><th>Purpose</th></tr>
  872. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  873. </table>
  874. <h3>Functions</h3>
  875. <p class=func><span class=keyword>amplitude</span>(level);</p>
  876. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  877. The default is off. Noise is generated only after setting
  878. to a non-zero level.
  879. </p>
  880. <h3>Notes</h3>
  881. <p>Setting the amplitude to zero causes this object to stop using
  882. CPU time. CPU usage is approx 3% on Teensy 3.1.
  883. </p>
  884. <p>Stefan Stenzel's
  885. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  886. algorithm. Stefan's terms of use are "Use for any purpose. If used
  887. in a commercial product, you should give me one."
  888. </p>
  889. </script>
  890. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  891. <div class="form-row">
  892. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  893. <input type="text" id="node-input-name" placeholder="Name">
  894. </div>
  895. </script>
  896. <script type="text/javascript">
  897. RED.nodes.registerType('AudioEffectFade',{
  898. shortName: "fade",
  899. inputs:1,
  900. outputs:1,
  901. category: 'effect-function',
  902. color:"#E6E0F8",
  903. icon: "arrow-in.png"
  904. });
  905. </script>
  906. <script type="text/x-red" data-help-name="AudioEffectFade">
  907. <h3>Summary</h3>
  908. <p>Gradually increase or decrease audio level.</p>
  909. <h3>Audio Connections</h3>
  910. <table class=doc align=center cellpadding=3>
  911. <tr class=top><th>Port</th><th>Purpose</th></tr>
  912. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  913. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  914. </table>
  915. <h3>Functions</h3>
  916. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  917. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  918. directly to the output) after "milliseconds" time.
  919. </p>
  920. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  921. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  922. after "milliseconds" time.
  923. </p>
  924. <h3>Notes</h3>
  925. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  926. When one fade object is off (fully faded out) and the other on
  927. (fully faded in), if both are started at the same moment for the
  928. same time duration, their signal gains always add to 1.0. This
  929. allows 2 fade objects to work together for a smooth transition
  930. between a pair of signals.
  931. </p>
  932. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  933. should be used when changing
  934. settings on multiple objects, so all changes always take effect
  935. at the same moment.
  936. </p>
  937. </script>
  938. <script type="text/x-red" data-template-name="AudioEffectFade">
  939. <div class="form-row">
  940. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  941. <input type="text" id="node-input-name" placeholder="Name">
  942. </div>
  943. </script>
  944. <script type="text/javascript">
  945. RED.nodes.registerType('AudioEffectChorus',{
  946. shortName: "chorus",
  947. inputs:2,
  948. outputs:2,
  949. category: 'effect-function',
  950. color:"#E6E0F8",
  951. icon: "arrow-in.png"
  952. });
  953. </script>
  954. <script type="text/x-red" data-help-name="AudioEffectChorus">
  955. <h3>Summary</h3>
  956. <p>description</p>
  957. <h3>Audio Connections</h3>
  958. <table class=doc align=center cellpadding=3>
  959. <tr class=top><th>Port</th><th>Purpose</th></tr>
  960. <tr class=odd><td align=center></td><td></td></tr>
  961. </table>
  962. <!--<h3>Parameters</h3>
  963. <table class=doc align=center cellpadding=3>
  964. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  965. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  966. </table>
  967. <p>Extra description... Section only present if object has params</p>-->
  968. <h3>Functions</h3>
  969. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  970. <p class=desc>blah blah blah blah
  971. </p>
  972. <p class=func><span class=keyword>stop</span>();</p>
  973. <p class=desc>blah blah blah blah
  974. </p>
  975. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  976. <p class=desc>blah blah blah blah
  977. </p>
  978. <h3>Notes</h3>
  979. <p></p>
  980. </script>
  981. <script type="text/x-red" data-template-name="AudioEffectChorus">
  982. <div class="form-row">
  983. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  984. <input type="text" id="node-input-name" placeholder="Name">
  985. </div>
  986. </script>
  987. <script type="text/javascript">
  988. RED.nodes.registerType('AudioEffectFlange',{
  989. shortName: "flange",
  990. inputs:2,
  991. outputs:2,
  992. category: 'effect-function',
  993. color:"#E6E0F8",
  994. icon: "arrow-in.png"
  995. });
  996. </script>
  997. <script type="text/x-red" data-help-name="AudioEffectFlange">
  998. <h3>Summary</h3>
  999. <p>description</p>
  1000. <h3>Audio Connections</h3>
  1001. <table class=doc align=center cellpadding=3>
  1002. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1003. <tr class=odd><td align=center></td><td></td></tr>
  1004. </table>
  1005. <!--<h3>Parameters</h3>
  1006. <table class=doc align=center cellpadding=3>
  1007. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1008. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1009. </table>
  1010. <p>Extra description... Section only present if object has params</p>-->
  1011. <h3>Functions</h3>
  1012. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  1013. <p class=desc>blah blah blah blah
  1014. </p>
  1015. <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p>
  1016. <p class=desc>blah blah blah blah
  1017. </p>
  1018. <p class=func><span class=keyword>stop</span>();</p>
  1019. <p class=desc>blah blah blah blah
  1020. </p>
  1021. <h3>Notes</h3>
  1022. <p></p>
  1023. </script>
  1024. <script type="text/x-red" data-template-name="AudioEffectFlange">
  1025. <div class="form-row">
  1026. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1027. <input type="text" id="node-input-name" placeholder="Name">
  1028. </div>
  1029. </script>
  1030. <script type="text/javascript">
  1031. RED.nodes.registerType('AudioEffectEnvelope',{
  1032. shortName: "envelope",
  1033. inputs:1,
  1034. outputs:1,
  1035. category: 'effect-function',
  1036. color:"#E6E0F8",
  1037. icon: "arrow-in.png"
  1038. });
  1039. </script>
  1040. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  1041. <h3>Summary</h3>
  1042. <div>
  1043. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  1044. Release) envelope.
  1045. </p>
  1046. <p align=center><img src="dahdsr.png"></p>
  1047. </div>
  1048. <h3>Audio Connections</h3>
  1049. <table class=doc align=center cellpadding=3>
  1050. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1051. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1052. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1053. </table>
  1054. <h3>Functions</h3>
  1055. <p class=func><span class=keyword>noteOn</span>();</p>
  1056. <p class=desc>Begin the delay to attack, or the attack phase is
  1057. delay is zero.
  1058. </p>
  1059. <p class=func><span class=keyword>noteOff</span>();</p>
  1060. <p class=desc>Begin the release phase.
  1061. </p>
  1062. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  1063. <p class=desc>Set the delay from noteOn to the attach phase. The
  1064. default is zero, for no delay.
  1065. </p>
  1066. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  1067. <p class=desc>Set the attack time. The default is 1.5 milliseconds.
  1068. </p>
  1069. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  1070. <p class=desc>Set the hold time. The default is 0.5 milliseconds.
  1071. </p>
  1072. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  1073. <p class=desc>Set the decay time. The default is 15 milliseconds.
  1074. </p>
  1075. <p class=func><span class=keyword>sustain</span>(level);</p>
  1076. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  1077. gain will be maintained at this level after the decay phase,
  1078. until noteOff() is called.
  1079. </p>
  1080. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  1081. <p class=desc>Set the release time. The default is 30 millisecond.
  1082. </p>
  1083. <h3>Notes</h3>
  1084. <p>To achieve the more common ADSR shape, simply
  1085. set delay and hold to zero.</p>
  1086. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  1087. milliseconds. Up to 200 ms can be used, with somewhat reduced
  1088. accuracy</p>
  1089. </script>
  1090. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  1091. <div class="form-row">
  1092. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1093. <input type="text" id="node-input-name" placeholder="Name">
  1094. </div>
  1095. </script>
  1096. <script type="text/javascript">
  1097. RED.nodes.registerType('AudioEffectMultiply',{
  1098. shortName: "multiply",
  1099. inputs:2,
  1100. outputs:1,
  1101. category: 'effect-function',
  1102. color:"#E6E0F8",
  1103. icon: "arrow-in.png"
  1104. });
  1105. </script>
  1106. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  1107. <h3>Summary</h3>
  1108. <div>
  1109. <p>Multiply two signals together, useful for amplitude modulation
  1110. or "voltage controlled amplification".
  1111. </p>
  1112. <p align=center><img src="multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  1113. </div>
  1114. <h3>Audio Connections</h3>
  1115. <table class=doc align=center cellpadding=3>
  1116. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1117. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1118. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  1119. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1120. </table>
  1121. <h3>Functions</h3>
  1122. <p>There are no functions to call from the Arduino sketch.
  1123. This object simply multiplies the 2 signals to create
  1124. a continuous output
  1125. </p>
  1126. <h3>Notes</h3>
  1127. <p>
  1128. </p>
  1129. </script>
  1130. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  1131. <div class="form-row">
  1132. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1133. <input type="text" id="node-input-name" placeholder="Name">
  1134. </div>
  1135. </script>
  1136. <script type="text/javascript">
  1137. RED.nodes.registerType('AudioEffectDelay',{
  1138. shortName: "delay",
  1139. inputs:1,
  1140. outputs:8,
  1141. category: 'effect-function',
  1142. color:"#E6E0F8",
  1143. icon: "arrow-in.png"
  1144. });
  1145. </script>
  1146. <script type="text/x-red" data-help-name="AudioEffectDelay">
  1147. <h3>Summary</h3>
  1148. <div>
  1149. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  1150. <p align=center><img src="delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1151. </div>
  1152. <h3>Audio Connections</h3>
  1153. <table class=doc align=center cellpadding=3>
  1154. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1155. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1156. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1157. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1158. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1159. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1160. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1161. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1162. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1163. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1164. </table>
  1165. <h3>Functions</h3>
  1166. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1167. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1168. milliseconds. The maximum delay is approx 333 ms. The actual delay
  1169. is rounded to the nearest sample. Each channel can be configured for
  1170. any delay. There is no requirement to configure the "taps" in increasing
  1171. delay order.
  1172. </p>
  1173. <p class=func><span class=keyword>disable</span>(channel);</p>
  1174. <p class=desc>Disable a channel. The output of this channel becomes
  1175. silent. If this channel is the longest delay, memory usage is
  1176. automatically reduced to accomodate only the remaining channels used.
  1177. </p>
  1178. <h3>Notes</h3>
  1179. <p>Memory for the delayed signal is take from the memory pool allocated by
  1180. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  1181. Each block allows about 3 milliseconds of delay, so AudioMemory
  1182. should be increased to allow for the longest delay tap.
  1183. </p>
  1184. </script>
  1185. <script type="text/x-red" data-template-name="AudioEffectDelay">
  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('AudioFilterBiquad',{
  1193. shortName: "biquad",
  1194. inputs:1,
  1195. outputs:1,
  1196. category: 'filter-function',
  1197. color:"#E6E0F8",
  1198. icon: "arrow-in.png"
  1199. });
  1200. </script>
  1201. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  1202. <h3>Summary</h3>
  1203. <p>description</p>
  1204. <h3>Audio Connections</h3>
  1205. <table class=doc align=center cellpadding=3>
  1206. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1207. <tr class=odd><td align=center></td><td></td></tr>
  1208. </table>
  1209. <h3>Parameters</h3>
  1210. <table class=doc align=center cellpadding=3>
  1211. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1212. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1213. </table>
  1214. <p>Extra description... Section only present if object has params</p>
  1215. <h3>Functions</h3>
  1216. <p class=func><span class=keyword>function</span>(parm1, parm2);</p>
  1217. <p class=desc>blah blah blah blah
  1218. </p>
  1219. <h3>Notes</h3>
  1220. <p></p>
  1221. </script>
  1222. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  1223. <div class="form-row">
  1224. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1225. <input type="text" id="node-input-name" placeholder="Name">
  1226. </div>
  1227. </script>
  1228. <script type="text/javascript">
  1229. RED.nodes.registerType('AudioFilterFIR',{
  1230. shortName: "fir",
  1231. inputs:1,
  1232. outputs:1,
  1233. category: 'filter-function',
  1234. color:"#E6E0F8",
  1235. icon: "arrow-in.png"
  1236. });
  1237. </script>
  1238. <script type="text/x-red" data-help-name="AudioFilterFIR">
  1239. <h3>Summary</h3>
  1240. <p>description</p>
  1241. <h3>Audio Connections</h3>
  1242. <table class=doc align=center cellpadding=3>
  1243. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1244. <tr class=odd><td align=center></td><td></td></tr>
  1245. </table>
  1246. <!--<h3>Parameters</h3>
  1247. <table class=doc align=center cellpadding=3>
  1248. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1249. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1250. </table>
  1251. <p>Extra description... Section only present if object has params</p>-->
  1252. <h3>Functions</h3>
  1253. <p class=func><span class=keyword>function</span>(parm1, parm2);</p>
  1254. <p class=desc>blah blah blah blah
  1255. </p>
  1256. <h3>Notes</h3>
  1257. <p></p>
  1258. </script>
  1259. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1260. <div class="form-row">
  1261. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1262. <input type="text" id="node-input-name" placeholder="Name">
  1263. </div>
  1264. </script>
  1265. <script type="text/javascript">
  1266. RED.nodes.registerType('AudioFilterStateVariable',{
  1267. shortName: "filter",
  1268. inputs:2,
  1269. outputs:3,
  1270. category: 'filter-function',
  1271. color:"#E6E0F8",
  1272. icon: "arrow-in.png"
  1273. });
  1274. </script>
  1275. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  1276. <h3>Summary</h3>
  1277. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  1278. adjustable resonance, and optional signal control of corner
  1279. frequency.</p>
  1280. <h3>Audio Connections</h3>
  1281. <table class=doc align=center cellpadding=3>
  1282. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1283. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  1284. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  1285. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  1286. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  1287. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  1288. </table>
  1289. <h3>Functions</h3>
  1290. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1291. <p class=desc>Set the filter's corner frequency. When a signal is
  1292. connected to the control input, the filter will implement this
  1293. frequency when the signal is zero.
  1294. </p>
  1295. <p class=func><span class=keyword>resonance</span>(Q);</p>
  1296. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  1297. Resonance greater than 0.707 will amplify the signal near the
  1298. corner frequency. You must attenuate the signal before input
  1299. to this filter, to prevent clipping.
  1300. </p>
  1301. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  1302. <p class=desc>Set how much (in octaves) the control signal can alter
  1303. the filter's corner freqency. Range is 0 to 7 octaves. For
  1304. example, when set to 2.5, a full scale positive signal (1.0) will
  1305. shift the filter frequency up 2.5 octaves, and a full scale negative
  1306. signal will shift it down 2.5 octaves.
  1307. </p>
  1308. <h3>Notes</h3>
  1309. <p>
  1310. When controlled by a signal, the equation for the filter
  1311. frequency is:
  1312. </p>
  1313. <p>
  1314. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  1315. <br><small>If anyone knows how to do HTML equations, please
  1316. help me improve this.....</small>
  1317. </p>
  1318. <p>When operating with signal control of corner frequency, this
  1319. object uses approximately 4% of the CPU time on Teensy 3.1.
  1320. </p>
  1321. </script>
  1322. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1323. <div class="form-row">
  1324. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1325. <input type="text" id="node-input-name" placeholder="Name">
  1326. </div>
  1327. </script>
  1328. <script type="text/javascript">
  1329. RED.nodes.registerType('AudioPeak',{
  1330. shortName: "peak",
  1331. inputs:1,
  1332. outputs:0,
  1333. category: 'analyze-function',
  1334. color:"#E6E0F8",
  1335. icon: "arrow-in.png"
  1336. });
  1337. </script>
  1338. <script type="text/x-red" data-help-name="AudioPeak">
  1339. <h3>Summary</h3>
  1340. <p>description</p>
  1341. <h3>Audio Connections</h3>
  1342. <table class=doc align=center cellpadding=3>
  1343. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1344. <tr class=odd><td align=center></td><td></td></tr>
  1345. </table>
  1346. <!--<h3>Parameters</h3>
  1347. <table class=doc align=center cellpadding=3>
  1348. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1349. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1350. </table>
  1351. <p>Extra description... Section only present if object has params</p>-->
  1352. <h3>Functions</h3>
  1353. <p class=func><span class=keyword>begin</span>(noReset);</p>
  1354. <p class=desc>blah blah blah blah
  1355. </p>
  1356. <p class=func><span class=keyword>stop</span>();</p>
  1357. <p class=desc>blah blah blah blah
  1358. </p>
  1359. <p class=func><span class=keyword>Dpp</span>();</p>
  1360. <p class=desc>blah blah blah blah
  1361. </p>
  1362. <h3>Notes</h3>
  1363. <p></p>
  1364. </script>
  1365. <script type="text/x-red" data-template-name="AudioPeak">
  1366. <div class="form-row">
  1367. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1368. <input type="text" id="node-input-name" placeholder="Name">
  1369. </div>
  1370. </script>
  1371. <script type="text/javascript">
  1372. RED.nodes.registerType('AudioAnalyzeFFT256',{
  1373. shortName: "fft256",
  1374. inputs:1,
  1375. outputs:0,
  1376. category: 'analyze-function',
  1377. color:"#E6E0F8",
  1378. icon: "arrow-in.png"
  1379. });
  1380. </script>
  1381. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  1382. <h3>Summary</h3>
  1383. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  1384. with real value (magnitude) output. The frequency resolution is
  1385. 172 Hz, useful for simple audio visualization.</p>
  1386. <h3>Audio Connections</h3>
  1387. <table class=doc align=center cellpadding=3>
  1388. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1389. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1390. </table>
  1391. <h3>Parameters</h3>
  1392. <table class=doc align=center cellpadding=3>
  1393. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1394. <tr class=odd><td align=center>Num</td><td>Integer</td><td># FFTs to average</td></tr>
  1395. <tr class=odd><td align=center>Window</td><td>Array</td><td>Window method to use</td></tr>
  1396. </table>
  1397. <p>Extra description... Section only present if object has params</p>
  1398. <h3>Functions</h3>
  1399. <p class=func><span class=keyword>available</span>();</p>
  1400. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1401. </p>
  1402. <h3>Notes</h3>
  1403. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1404. num is 0 to 127.</p>
  1405. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1406. <p>Known bug in the library limits to only a single instance of this object.
  1407. This bug will be fixed someday... allowing 2 or more FFTs to run on simultaneously.</p>
  1408. <p>Window Types:
  1409. <ul>
  1410. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  1411. <li><span class=literal>AudioWindowBartlett256</span></li>
  1412. <li><span class=literal>AudioWindowBlackman256</span></li>
  1413. <li><span class=literal>AudioWindowFlattop256</span></li>
  1414. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  1415. <li><span class=literal>AudioWindowNuttall256</span></li>
  1416. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  1417. <li><span class=literal>AudioWindowWelch256</span></li>
  1418. <li><span class=literal>AudioWindowHamming256</span></li>
  1419. <li><span class=literal>AudioWindowCosine256</span></li>
  1420. <li><span class=literal>AudioWindowTukey256</span></li>
  1421. </ul>
  1422. </p>
  1423. </script>
  1424. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  1425. <div class="form-row">
  1426. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1427. <input type="text" id="node-input-name" placeholder="Name">
  1428. </div>
  1429. </script>
  1430. <script type="text/javascript">
  1431. RED.nodes.registerType('AudioAnalyzeFFT1024',{
  1432. shortName: "fft1024",
  1433. inputs:1,
  1434. outputs:0,
  1435. category: 'analyze-function',
  1436. color:"#E6E0F8",
  1437. icon: "arrow-in.png"
  1438. });
  1439. </script>
  1440. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  1441. <h3>Summary</h3>
  1442. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  1443. with real value (magnitude) output. The frequency resolution is
  1444. 43 Hz, useful detailed for audio visualization.</p>
  1445. <h3>Audio Connections</h3>
  1446. <table class=doc align=center cellpadding=3>
  1447. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1448. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1449. </table>
  1450. <h3>Parameters</h3>
  1451. <table class=doc align=center cellpadding=3>
  1452. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1453. <tr class=odd><td align=center>Num</td><td>Integer</td><td># FFTs to average</td></tr>
  1454. <tr class=odd><td align=center>Window</td><td>Array</td><td>Window method to use</td></tr>
  1455. </table>
  1456. <p>Extra description... Section only present if object has params</p>
  1457. <h3>Functions</h3>
  1458. <p class=func><span class=keyword>available</span>();</p>
  1459. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1460. </p>
  1461. <h3>Notes</h3>
  1462. <p>1024 point FFT uses approx 50% of the CPU power on Teensy 3.1</p>
  1463. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1464. num is 0 to 511.</p>
  1465. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1466. <p>Known bug in the library limits to only a single instance of this object.
  1467. This bug will be fixed someday... but 2 instances may not run due to CPU limitation</p>
  1468. <p>Window Types:
  1469. <ul>
  1470. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  1471. </ul>
  1472. </p>
  1473. </script>
  1474. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  1475. <div class="form-row">
  1476. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1477. <input type="text" id="node-input-name" placeholder="Name">
  1478. </div>
  1479. </script>
  1480. <script type="text/javascript">
  1481. RED.nodes.registerType('AudioAnalyzeToneDetect',{
  1482. shortName: "tone",
  1483. inputs:1,
  1484. outputs:0,
  1485. category: 'analyze-function',
  1486. color:"#E6E0F8",
  1487. icon: "arrow-in.png"
  1488. });
  1489. </script>
  1490. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  1491. <h3>Summary</h3>
  1492. <p>Detect the level of a single tone</p>
  1493. <h3>Audio Connections</h3>
  1494. <table class=doc align=center cellpadding=3>
  1495. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1496. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1497. </table>
  1498. <h3>Functions</h3>
  1499. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1500. <p class=desc>Set the frequency to detect. The default detection time
  1501. will be 10 cycles of this frequency.
  1502. </p>
  1503. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  1504. <p class=desc>Set the frequency to detect, and the number of cycles.
  1505. Longer detection time (more cycles) will give higher precision,
  1506. but of course slower response.
  1507. </p>
  1508. <p class=func><span class=keyword>available</span>();</p>
  1509. <p class=desc>Returns true (non-zero) each time a detection interval
  1510. (number of cycles) completed and a new level is detected.
  1511. </p>
  1512. <p class=func><span class=keyword>read</span>();</p>
  1513. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  1514. </p>
  1515. <p class=func><span class=keyword>threshold</span>(level);</p>
  1516. <p class=desc>Set a detection threshold, where the bool test operation
  1517. will return true if at or above this level, or false when below.
  1518. </p>
  1519. <p class=func>(bool)</p>
  1520. <p class=desc>By testing the object as a boolean value, you can respond
  1521. to detection of a tone.
  1522. </p>
  1523. <h3>Notes</h3>
  1524. <p>Low frequency detection has trouble with numerical precision.
  1525. Works really well for all 8 DTMF frequencies, but fails for
  1526. detecting "sub audible tones" used in some control applications.</p>
  1527. <p>The (bool) test continues to return true until the next detection
  1528. interval (the configured number of cycles). This behavior may
  1529. change in future versions, for a single true each time the signal
  1530. is detected, and then false for the remainder of that interval.</p>
  1531. </script>
  1532. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  1533. <div class="form-row">
  1534. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1535. <input type="text" id="node-input-name" placeholder="Name">
  1536. </div>
  1537. </script>
  1538. <script type="text/javascript">
  1539. RED.nodes.registerType('AudioAnalyzePrint',{
  1540. shortName: "print",
  1541. inputs:1,
  1542. outputs:0,
  1543. category: 'analyze-function',
  1544. color:"#E6E0F8",
  1545. icon: "arrow-in.png"
  1546. });
  1547. </script>
  1548. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  1549. <h3>Summary</h3>
  1550. <p>Print raw audio data to the Arduino Serial Monitor. This
  1551. object creates massive output quickly, and should not normall be used.</p>
  1552. <h3>Audio Connections</h3>
  1553. <table class=doc align=center cellpadding=3>
  1554. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1555. <tr class=odd><td align=center></td><td></td></tr>
  1556. </table>
  1557. <!--<h3>Parameters</h3>
  1558. <table class=doc align=center cellpadding=3>
  1559. <tr class=top><th>Name</th><th>Type</th><th>Function</th></tr>
  1560. <tr class=odd><td align=center></td><td>Integer</td><td></td></tr>
  1561. </table>
  1562. <p>Extra description... Section only present if object has params</p>-->
  1563. <h3>Functions</h3>
  1564. <p class=func><span class=keyword>trigger</span>();</p>
  1565. <p class=desc>blah blah blah blah
  1566. </p>
  1567. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  1568. <p class=desc>blah blah blah blah
  1569. </p>
  1570. <p class=func><span class=keyword>delay</span>(samples);</p>
  1571. <p class=desc>blah blah blah blah
  1572. </p>
  1573. <p class=func><span class=keyword>length</span>(samples);</p>
  1574. <p class=desc>blah blah blah blah
  1575. </p>
  1576. <h3>Notes</h3>
  1577. <p></p>
  1578. </script>
  1579. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  1580. <div class="form-row">
  1581. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1582. <input type="text" id="node-input-name" placeholder="Name">
  1583. </div>
  1584. </script>
  1585. <script type="text/javascript">
  1586. RED.nodes.registerType('AudioControlSGTL5000',{
  1587. shortName: "sgtl5000",
  1588. inputs:0,
  1589. outputs:0,
  1590. category: 'control-function',
  1591. color:"#E6E0F8",
  1592. icon: "arrow-in.png"
  1593. });
  1594. </script>
  1595. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  1596. <h3>Summary</h3>
  1597. <p>Control the SGTL5000 chip on the audio shield
  1598. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  1599. SGTL5000 is always used in slave mode, where Teensy controls
  1600. all I2S timing.
  1601. </p>
  1602. <p align=center><img src="sgtl5000closeup.jpg"></p>
  1603. <h3>Audio Connections</h3>
  1604. <p>This object has no audio inputs or outputs. Separate i2s objects
  1605. are used to send and receive audio data. I2S master mode objects
  1606. must be used, because this object configures the SGTL5000 in slave
  1607. mode, where it depends on Teensy to provide all I2S clocks.
  1608. This object controls
  1609. how the SGTL5000 will use those I2S audio streams.</p>
  1610. <h3>Functions</h3>
  1611. <p>These are the most commonly used SGTL5000 functions.</p>
  1612. <p class=func><span class=keyword>enable</span>();</p>
  1613. <p class=desc>blah blah blah blah
  1614. </p>
  1615. <p class=func><span class=keyword>disable</span>();</p>
  1616. <p class=desc>blah blah blah blah
  1617. </p>
  1618. <p class=func><span class=keyword>volume</span>(level);</p>
  1619. <p class=desc>blah blah blah blah
  1620. </p>
  1621. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1622. <p class=desc>blah blah blah blah
  1623. </p>
  1624. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  1625. <p class=desc>blah blah blah blah
  1626. </p>
  1627. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  1628. <p class=desc>blah blah blah blah
  1629. </p>
  1630. <p class=func><span class=keyword>muteLineout</span>();</p>
  1631. <p class=desc>blah blah blah blah
  1632. </p>
  1633. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  1634. <p class=desc>blah blah blah blah
  1635. </p>
  1636. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1637. <p class=desc>AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC
  1638. </p>
  1639. <h3>Signal Adjustment</h3>
  1640. <p>The SGTL5000 supports flexible signal routing (inside the chip) and
  1641. many optional signal conditioning features.</p>
  1642. <p class=func><span class=keyword>route</span>(i2s, dac, dap);</p>
  1643. <p class=desc>blah blah blah blah
  1644. </p>
  1645. <p class=func><span class=keyword>route</span>(i2s, dac, dap, dapmix);</p>
  1646. <p class=desc>blah blah blah blah
  1647. </p>
  1648. <p class=func><span class=keyword>micGain</span>(n);</p>
  1649. <p class=desc>blah blah blah blah
  1650. </p>
  1651. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  1652. <p class=desc>blah blah blah blah
  1653. </p>
  1654. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  1655. <p class=desc>blah blah blah blah
  1656. </p>
  1657. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  1658. <p class=desc>blah blah blah blah
  1659. </p>
  1660. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  1661. <p class=desc>blah blah blah blah
  1662. </p>
  1663. <p class=func><span class=keyword>adcHighPassFilterControl</span>(bypass, freeze);</p>
  1664. <p class=desc>blah blah blah blah
  1665. </p>
  1666. <p class=func><span class=keyword>adcHighPassFilterControl</span>(bypass);</p>
  1667. <p class=desc>blah blah blah blah
  1668. </p>
  1669. <p class=func><span class=keyword>audioMixerEnable</span>(n);</p>
  1670. <p class=desc>blah blah blah blah
  1671. </p>
  1672. <h3>Audio Processor</h3>
  1673. <p>An optional digital audio processor, capable of implementing a
  1674. simple equalizer, filtering, bass enhancement and surround sound
  1675. is available. It can process audio input before the SGTL5000
  1676. sends it by I2S to Teensy, or it can process Teensy's I2S output
  1677. before converting the digital data to analog signals.</p>
  1678. <p class=func><span class=keyword>audioProcessorEnable</span>(n);</p>
  1679. <p class=desc>blah blah blah blah
  1680. </p>
  1681. <p class=func><span class=keyword>audioProcessorEnable</span>();</p>
  1682. <p class=desc>blah blah blah blah
  1683. </p>
  1684. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  1685. <p class=desc>blah blah blah blah
  1686. </p>
  1687. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  1688. <p class=desc>blah blah blah blah
  1689. </p>
  1690. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  1691. <p class=desc>blah blah blah blah
  1692. </p>
  1693. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  1694. <p class=desc>blah blah blah blah
  1695. </p>
  1696. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  1697. <p class=desc>blah blah blah blah
  1698. </p>
  1699. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  1700. <p class=desc>blah blah blah blah
  1701. </p>
  1702. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  1703. <p class=desc>blah blah blah blah
  1704. </p>
  1705. <p class=func><span class=keyword>autoVolumeEnable</span>(n);</p>
  1706. <p class=desc>blah blah blah blah
  1707. </p>
  1708. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  1709. <p class=desc>blah blah blah blah
  1710. </p>
  1711. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  1712. <p class=desc>blah blah blah blah
  1713. </p>
  1714. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  1715. <p class=desc>blah blah blah blah
  1716. </p>
  1717. <p class=func><span class=keyword>enhanceBassEnable</span>(n);</p>
  1718. <p class=desc>blah blah blah blah
  1719. </p>
  1720. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  1721. <p class=desc>blah blah blah blah
  1722. </p>
  1723. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  1724. <p class=desc>blah blah blah blah
  1725. </p>
  1726. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  1727. <p class=desc>blah blah blah blah
  1728. </p>
  1729. <p class=func><span class=keyword>surroundSoundEnable</span>(n);</p>
  1730. <p class=desc>blah blah blah blah
  1731. </p>
  1732. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  1733. <p class=desc>blah blah blah blah
  1734. </p>
  1735. <p class=func><span class=keyword>killAutomation</span>();</p>
  1736. <p class=desc>blah blah blah blah
  1737. </p>
  1738. <h3>Notes</h3>
  1739. <p>TODO: how does the input AGC work
  1740. </p>
  1741. <p>TODO: document signal routing
  1742. </p>
  1743. <p>TODO: line level output adjust is weird arbitrary integers. Should this be
  1744. made into more sensible numbers, or do we just document the integer-voltage
  1745. measurements that correspond to the audio shield's hardware?
  1746. </p>
  1747. <p>TODO: make some sense out of the terribly complex audio processor features &amp; options!
  1748. </p>
  1749. <p>TODO: can some of these enable functions be eliminated and have those features
  1750. automatically enabled or disabled depending on whether the route() function has
  1751. configured signals to/from them?
  1752. </p>
  1753. </script>
  1754. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  1755. <div class="form-row">
  1756. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1757. <input type="text" id="node-input-name" placeholder="Name">
  1758. </div>
  1759. </script>
  1760. <script type="text/javascript">
  1761. RED.nodes.registerType('AudioControlWM8731',{
  1762. shortName: "wm8731",
  1763. inputs:0,
  1764. outputs:0,
  1765. category: 'control-function',
  1766. color:"#E6E0F8",
  1767. icon: "arrow-in.png"
  1768. });
  1769. </script>
  1770. <script type="text/x-red" data-help-name="AudioControlWM8731">
  1771. <h3>Summary</h3>
  1772. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  1773. <h3>Audio Connections</h3>
  1774. <p>This object has no audio inputs or outputs. Separate i2s objects
  1775. are used to send and receive audio data. I2S master mode objects
  1776. must be used, since this control object configures the WM8731 into
  1777. slave mode.
  1778. </p>
  1779. <h3>Functions</h3>
  1780. <p class=func><span class=keyword>enable</span>();</p>
  1781. <p class=desc>blah blah blah blah
  1782. </p>
  1783. <p class=func><span class=keyword>disable</span>();</p>
  1784. <p class=desc>not implemented
  1785. </p>
  1786. <p class=func><span class=keyword>volume</span>(level);</p>
  1787. <p class=desc>blah blah blah blah
  1788. </p>
  1789. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1790. <p class=desc>not implemented
  1791. </p>
  1792. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1793. <p class=desc>not implemented
  1794. </p>
  1795. <h3>Notes</h3>
  1796. <p></p>
  1797. </script>
  1798. <script type="text/x-red" data-template-name="AudioControlWM8731">
  1799. <div class="form-row">
  1800. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1801. <input type="text" id="node-input-name" placeholder="Name">
  1802. </div>
  1803. </script>
  1804. <script type="text/javascript">
  1805. RED.nodes.registerType('AudioControlWM8731master',{
  1806. shortName: "wm8731m",
  1807. inputs:0,
  1808. outputs:0,
  1809. category: 'control-function',
  1810. color:"#E6E0F8",
  1811. icon: "arrow-in.png"
  1812. });
  1813. </script>
  1814. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  1815. <h3>Summary</h3>
  1816. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  1817. <h3>Audio Connections</h3>
  1818. <p>This object has no audio inputs or outputs. Separate i2s objects
  1819. are used to send and receive audio data. I2S slave mode objects
  1820. must be used, since this control object configures the WM8731 into
  1821. master mode.
  1822. </p>
  1823. <h3>Functions</h3>
  1824. <p class=func><span class=keyword>enable</span>();</p>
  1825. <p class=desc>blah blah blah blah
  1826. </p>
  1827. <p class=func><span class=keyword>disable</span>();</p>
  1828. <p class=desc>not implemented
  1829. </p>
  1830. <p class=func><span class=keyword>volume</span>(level);</p>
  1831. <p class=desc>blah blah blah blah
  1832. </p>
  1833. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  1834. <p class=desc>not implemented
  1835. </p>
  1836. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1837. <p class=desc>not implemented
  1838. </p>
  1839. <h3>Notes</h3>
  1840. <p></p>
  1841. </script>
  1842. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  1843. <div class="form-row">
  1844. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1845. <input type="text" id="node-input-name" placeholder="Name">
  1846. </div>
  1847. </script>