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

2241 line
83KB

  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('AudioInputAnalog',{
  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="AudioInputAnalog">
  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>Functions</h3>
  126. <p>This object has no functions to call from the Arduino sketch. It
  127. simply streams data from the ADC to its output port.</p>
  128. <h3>Hardware</h3>
  129. <p>Pin A2 is used for audio input. This circuitry is recommended.</p>
  130. <p align=center><img src="adccircuit.png"></p>
  131. <p>Signal range is 0 to 1.2V</p>
  132. <h3>Notes</h3>
  133. <p>Algorithm for automatic DC bias tracking</p>
  134. <p>Noise due to high source impedance</p>
  135. <p>Power Supply rejection issue with simple DC bias</p>
  136. <p>TODO: actual noise measurements with different input circuitry
  137. (it's not as quiet as the audio shield)</p>
  138. </script>
  139. <script type="text/x-red" data-template-name="AudioInputAnalog">
  140. <div class="form-row">
  141. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  142. <input type="text" id="node-input-name" placeholder="Name">
  143. </div>
  144. </script>
  145. <script type="text/javascript">
  146. RED.nodes.registerType('AudioOutputI2S',{
  147. shortName: "i2s",
  148. inputs:2,
  149. outputs:0,
  150. category: 'output-function',
  151. color:"#E6E0F8",
  152. icon: "arrow-in.png"
  153. });
  154. </script>
  155. <script type="text/x-red" data-help-name="AudioOutputI2S">
  156. <h3>Summary</h3>
  157. <p>Transmit 16 bit stereo audio to the
  158. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  159. or another I2S device, using I2S master mode.</p>
  160. <p align=center><img src="audioshield_outputs.jpg"></p>
  161. <h3>Audio Connections</h3>
  162. <table class=doc align=center cellpadding=3>
  163. <tr class=top><th>Port</th><th>Purpose</th></tr>
  164. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  165. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  166. </table>
  167. <h3>Functions</h3>
  168. <p>This object has no functions to call from the Arduino sketch. It
  169. simply streams data from its 2 input ports to the I2S hardware.</p>
  170. <h3>Hardware</h3>
  171. <p align=center><img src="audioshield_backside.jpg"></p>
  172. <p>The I2S signals are used in "master" mode, where Teensy creates
  173. all 3 clock signals and controls all data timing.</p>
  174. <table class=doc align=center cellpadding=3>
  175. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  176. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Output</td></tr>
  177. <tr class=odd><td align=center>11</td><td>MCLK</td><td>Output</td></tr>
  178. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  179. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Output</td></tr>
  180. </table>
  181. <p>Audio from
  182. master mode I2S may be used in the same project as ADC, DAC and
  183. PWM signals, because all remain in sync to Teensy's timing</p>
  184. <h3>Notes</h3>
  185. <p>Normally, this object is used with the Audio Shield, which
  186. is controlled separately by the "sgtl5000" object.</p>
  187. <p>Only one I2S input and one I2S output object may be used. Master
  188. and slave modes may not be mixed (both must be of the same type).
  189. </p>
  190. </script>
  191. <script type="text/x-red" data-template-name="AudioOutputI2S">
  192. <div class="form-row">
  193. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  194. <input type="text" id="node-input-name" placeholder="Name">
  195. </div>
  196. </script>
  197. <script type="text/javascript">
  198. RED.nodes.registerType('AudioOutputI2Sslave',{
  199. shortName: "i2ss",
  200. inputs:2,
  201. outputs:0,
  202. category: 'output-function',
  203. color:"#E6E0F8",
  204. icon: "arrow-in.png"
  205. });
  206. </script>
  207. <script type="text/x-red" data-help-name="AudioOutputI2Sslave">
  208. <h3>Summary</h3>
  209. <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p>
  210. <h3>Audio Connections</h3>
  211. <table class=doc align=center cellpadding=3>
  212. <tr class=top><th>Port</th><th>Purpose</th></tr>
  213. <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr>
  214. <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr>
  215. </table>
  216. <h3>Functions</h3>
  217. <p>This object has no functions to call from the Arduino sketch. It
  218. simply streams data from its 2 input ports to the I2S hardware.</p>
  219. <h3>Hardware</h3>
  220. <p>The I2S signals are used in "slave" mode, where the I2S device controls
  221. data timing.</p>
  222. <table class=doc align=center cellpadding=3>
  223. <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr>
  224. <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr>
  225. <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr>
  226. <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr>
  227. </table>
  228. <h3>Notes</h3>
  229. <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and
  230. PWM</b> signals. Differences in timing between the I2S device and
  231. Teensy's clock can cause occasional audio glitches when I2S slave mode
  232. is used together with other input or output objects based on Teensy's
  233. timing.</p>
  234. <p>Only one I2S input and one I2S output object may be used. Master
  235. and slave modes may not be mixed (both must be of the same type).
  236. </p>
  237. </script>
  238. <script type="text/x-red" data-template-name="AudioOutputI2Sslave">
  239. <div class="form-row">
  240. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  241. <input type="text" id="node-input-name" placeholder="Name">
  242. </div>
  243. </script>
  244. <script type="text/javascript">
  245. RED.nodes.registerType('AudioOutputAnalog',{
  246. shortName: "dac",
  247. inputs:1,
  248. outputs:0,
  249. category: 'output-function',
  250. color:"#E6E0F8",
  251. icon: "arrow-in.png"
  252. });
  253. </script>
  254. <script type="text/x-red" data-help-name="AudioOutputAnalog">
  255. <h3>Summary</h3>
  256. <p>Transmit 12 bit audio using Teensy 3.1's built-in digital to analog converter.</p>
  257. <h3>Audio Connections</h3>
  258. <table class=doc align=center cellpadding=3>
  259. <tr class=top><th>Port</th><th>Purpose</th></tr>
  260. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  261. </table>
  262. <h3>Functions</h3>
  263. <p>This object has no functions to call from the Arduino sketch. It
  264. simply streams data from the ADC to its output port.</p>
  265. <h3>Hardware</h3>
  266. <p align=center><img src="dacpin.jpg"></p>
  267. <p>Signal range is 0 to 1.2V</p>
  268. <p>Most applications require at least a 10&micro;F DC-blocking capacitor.</p>
  269. <p>TODO: photo of Teensy 3.1 with 10&micro;F capacitor and 3.5mm jack.</p>
  270. <h3>Notes</h3>
  271. <p>The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if
  272. not filtered. This may not
  273. be an issue for many uses, but care should be used if amplified and driven
  274. to high power tweeters.</p>
  275. </script>
  276. <script type="text/x-red" data-template-name="AudioOutputAnalog">
  277. <div class="form-row">
  278. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  279. <input type="text" id="node-input-name" placeholder="Name">
  280. </div>
  281. </script>
  282. <script type="text/javascript">
  283. RED.nodes.registerType('AudioOutputPWM',{
  284. shortName: "pwm",
  285. inputs:1,
  286. outputs:0,
  287. category: 'output-function',
  288. color:"#E6E0F8",
  289. icon: "arrow-in.png"
  290. });
  291. </script>
  292. <script type="text/x-red" data-help-name="AudioOutputPWM">
  293. <h3>Summary</h3>
  294. <p>Transmit audio using Teensy 3.1's PWM pins. Two pins are
  295. used for coarse and fine pulses, to be combined by scaled
  296. resistors.</p>
  297. <h3>Audio Connections</h3>
  298. <table class=doc align=center cellpadding=3>
  299. <tr class=top><th>Port</th><th>Purpose</th></tr>
  300. <tr class=odd><td align=center>In 0</td><td>Audio Channel</td></tr>
  301. </table>
  302. <h3>Functions</h3>
  303. <p>This object has no functions to call from the Arduino sketch. It
  304. simply streams data from the its input port to the PWM pins.</p>
  305. <h3>Hardware</h3>
  306. <p>The following circuit is recommended.</p>
  307. <p align=center><img src="pwmdualcircuit.jpg"></p>
  308. <p>Signal range is approx 1.55 Vp-p.</p>
  309. <p>These resistor values assume approx 20 ohms output impedance
  310. on the digital pins. The 127K resistor may be adjusted or
  311. trimmed for variation in output drive and tolerance on the
  312. 475 ohm resistor.</p>
  313. <p>A plastic film (Polypropylene, Polyethylene, Polyester, etc) or
  314. C0G/NPO ceramic capacitor should be used for filtering. Low
  315. quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
  316. <h3>Notes</h3>
  317. <p>This object only works properly when Tools > CPU_Speed is set to
  318. 48 or 96 MHz. Other speeds aren't supported and will likely fail
  319. in strange ways.</p>
  320. <p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
  321. will only slightly filter the carrier. Extra filtering will be
  322. required for a clean signal without the ultrasonic PWM carrier.
  323. </p>
  324. <p>Analog signals created by filtering PWM waveforms use the digital
  325. power supply as their reference voltage. Any noise on the digital
  326. power line can directly couple to the output signal. The built-in DAC or
  327. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>
  328. should be used when higher quality signals are needed.</p>
  329. </script>
  330. <script type="text/x-red" data-template-name="AudioOutputPWM">
  331. <div class="form-row">
  332. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  333. <input type="text" id="node-input-name" placeholder="Name">
  334. </div>
  335. </script>
  336. <script type="text/javascript">
  337. RED.nodes.registerType('AudioMixer4',{
  338. shortName: "mixer",
  339. inputs:4,
  340. outputs:1,
  341. category: 'mixer-function',
  342. color:"#E6E0F8",
  343. icon: "arrow-in.png"
  344. });
  345. </script>
  346. <script type="text/x-red" data-help-name="AudioMixer4">
  347. <h3>Summary</h3>
  348. <p>Combine up to 4 audio signals together, each with adjustable gain.
  349. All channels support signal attenuation or amplification.</p>
  350. <h3>Audio Connections</h3>
  351. <table class=doc align=center cellpadding=3>
  352. <tr class=top><th>Port</th><th>Purpose</th></tr>
  353. <tr class=odd><td align=center>In 0</td><td>Input signal #1</td></tr>
  354. <tr class=odd><td align=center>In 1</td><td>Input signal #2</td></tr>
  355. <tr class=odd><td align=center>In 2</td><td>Input signal #3</td></tr>
  356. <tr class=odd><td align=center>In 3</td><td>Input signal #4</td></tr>
  357. <tr class=odd><td align=center>Out 0</td><td>Sum of all inputs</td></tr>
  358. </table>
  359. <h3>Functions</h3>
  360. <p class=func><span class=keyword>gain</span>(channel, level);</p>
  361. <p class=desc>Adjust the amplification or attenuation. "channel" must
  362. be 0 to 3. "level" may be any floating point number from 0 to 32767.
  363. 1.0 passes the signal through directly. Level of 0 shuts the channel
  364. off completely. Between 0 to 1.0 attenuates the signal, and above
  365. 1.0 amplifies it. All 4 channels have separate settings.
  366. </p>
  367. <h3>Notes</h3>
  368. <p>Signal clipping can occur when any channel has gain greater than 1.0,
  369. or when multiple signals add together to greater than 1.0.</p>
  370. <p>More than 4 channels may be combined by connecting multiple mixers
  371. in tandem. For example, a 16 channel mixer may be built using 5
  372. mixers, where the fifth mixer combines the outputs of the first 4.
  373. </p>
  374. </script>
  375. <script type="text/x-red" data-template-name="AudioMixer4">
  376. <div class="form-row">
  377. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  378. <input type="text" id="node-input-name" placeholder="Name">
  379. </div>
  380. </script>
  381. <script type="text/javascript">
  382. RED.nodes.registerType('AudioPlayMemory',{
  383. shortName: "playMem",
  384. inputs:0,
  385. outputs:1,
  386. category: 'play-function',
  387. color:"#E6E0F8",
  388. icon: "arrow-in.png"
  389. });
  390. </script>
  391. <script type="text/x-red" data-help-name="AudioPlayMemory">
  392. <h3>Summary</h3>
  393. <p>Play a short sound clip, stored directly in memory.
  394. Data files are created with the
  395. <a href="https://github.com/PaulStoffregen/Audio/tree/master/examples/PlayFromSketch/wav2sketch" target="_blank">wav2sketch program</a>,
  396. and copied to the sketch folder to become part of your sketch.</p>
  397. <h3>Audio Connections</h3>
  398. <table class=doc align=center cellpadding=3>
  399. <tr class=top><th>Port</th><th>Purpose</th></tr>
  400. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  401. </table>
  402. <h3>Functions</h3>
  403. <p class=func><span class=keyword>play</span>(data);</p>
  404. <p class=desc>Begin playing a sound clip. If already playing, the
  405. currently playing clip is stopped and this new data begins
  406. playing from the beginning.
  407. </p>
  408. <p class=func><span class=keyword>stop</span>();</p>
  409. <p class=desc>Stop playing. If not playing, this function has no effect.
  410. </p>
  411. <p class=func><span class=keyword>isPlaying</span>();</p>
  412. <p class=desc>Return true (non-zero) if playing, or false (zero)
  413. when not playing.
  414. </p>
  415. <p class=func><span class=keyword>positionMillis</span>();</p>
  416. <p class=desc>While playing, return the current time offset, in
  417. milliseconds. When not playing, the return from this function
  418. is undefined.
  419. </p>
  420. <p class=func><span class=keyword>lengthMillis</span>();</p>
  421. <p class=desc>Return the total length of the current sound clip,
  422. in milliseconds. When not playing, the return from this function
  423. is undefined.
  424. </p>
  425. <h3>Notes</h3>
  426. <p>TODO: supported sample rates: 11.025, 22.05, 44.1</p>
  427. <p>TODO: ulaw vs uncompressed encoding</p>
  428. <p>Polyphonic playback can be built by creating multiple
  429. objects, with their output combined by mixers.</p>
  430. </script>
  431. <script type="text/x-red" data-template-name="AudioPlayMemory">
  432. <div class="form-row">
  433. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  434. <input type="text" id="node-input-name" placeholder="Name">
  435. </div>
  436. </script>
  437. <script type="text/javascript">
  438. RED.nodes.registerType('AudioPlaySdWav',{
  439. shortName: "playWav",
  440. inputs:0,
  441. outputs:2,
  442. category: 'play-function',
  443. color:"#E6E0F8",
  444. icon: "arrow-in.png"
  445. });
  446. </script>
  447. <script type="text/x-red" data-help-name="AudioPlaySdWav">
  448. <h3>Summary</h3>
  449. <p>Play a WAV file, stored on a SD card.</p>
  450. <h3>Audio Connections</h3>
  451. <table class=doc align=center cellpadding=3>
  452. <tr class=top><th>Port</th><th>Purpose</th></tr>
  453. <tr class=odd><td align=center>Out 0</td><td>Left Channel Output</td></tr>
  454. <tr class=odd><td align=center>Out 1</td><td>Right Channel Output</td></tr>
  455. </table>
  456. <h3>Functions</h3>
  457. <p class=func><span class=keyword>play</span>(filename);</p>
  458. <p class=desc>Begin playing a WAV file. If a file is already playing,
  459. it is stopped and this file starts playing from the beginning.
  460. </p>
  461. <p class=func><span class=keyword>stop</span>();</p>
  462. <p class=desc>Stop playing. If not playing, this function has no effect.
  463. </p>
  464. <p class=func><span class=keyword>isPlaying</span>();</p>
  465. <p class=desc>Return true (non-zero) if playing, or false (zero)
  466. when not playing. See the note below about delayed start.
  467. </p>
  468. <p class=func><span class=keyword>positionMillis</span>();</p>
  469. <p class=desc>While playing, return the current time offset, in
  470. milliseconds. When not playing, the return from this function
  471. is undefined.
  472. </p>
  473. <p class=func><span class=keyword>lengthMillis</span>();</p>
  474. <p class=desc>Return the total length of the current sound clip,
  475. in milliseconds. When not playing, the return from this function
  476. is undefined.
  477. </p>
  478. <h3>Notes</h3>
  479. <p>Only 16 bit PCM, 44100 Hz WAV files are supported. When mono
  480. files are played, both output ports transmit a copy of the
  481. single sound. Of course, stereo WAV files play with the left
  482. channel on port 0 and the right channel on port 1.
  483. </p>
  484. <p>A brief delay after calling play() will usually occur before
  485. isPlaying() returns true and positionMillis() returns valid
  486. time offset. WAV files have a header at the beginning of the
  487. file, which the audio library must read and parse before
  488. playing can begin.
  489. </p>
  490. <p>While playing, the audio library accesses the SD card automatically.
  491. If card access is required, you must
  492. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">use AudioNoInterrupts()</a>
  493. to prevent the library from accessing the SD card while you use it.
  494. Disabling the audio library interrupt for too long may cause audible
  495. dropouts or glitches.
  496. </p>
  497. </script>
  498. <script type="text/x-red" data-template-name="AudioPlaySdWav">
  499. <div class="form-row">
  500. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  501. <input type="text" id="node-input-name" placeholder="Name">
  502. </div>
  503. </script>
  504. <script type="text/javascript">
  505. RED.nodes.registerType('AudioPlaySdRaw',{
  506. shortName: "playRaw",
  507. inputs:0,
  508. outputs:1,
  509. category: 'play-function',
  510. color:"#E6E0F8",
  511. icon: "arrow-in.png"
  512. });
  513. </script>
  514. <script type="text/x-red" data-help-name="AudioPlaySdRaw">
  515. <h3>Summary</h3>
  516. <p>Play a RAW data file, stored on a SD card. RAW format is simpler
  517. than WAV and begins playing immediately, without parsing WAV file
  518. header info.</p>
  519. <h3>Audio Connections</h3>
  520. <table class=doc align=center cellpadding=3>
  521. <tr class=top><th>Port</th><th>Purpose</th></tr>
  522. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  523. </table>
  524. <h3>Functions</h3>
  525. <p class=func><span class=keyword>play</span>(filename);</p>
  526. <p class=desc>Begin playing a RAW data file. If a file is already playing,
  527. it is stopped and this file starts playing from the beginning.
  528. </p>
  529. <p class=func><span class=keyword>stop</span>();</p>
  530. <p class=desc>Stop playing. If not playing, this function has no effect.
  531. </p>
  532. <p class=func><span class=keyword>isPlaying</span>();</p>
  533. <p class=desc>Return true (non-zero) if playing, or false (zero)
  534. when not playing.
  535. </p>
  536. <p class=func><span class=keyword>positionMillis</span>();</p>
  537. <p class=desc>While playing, return the current time offset, in
  538. milliseconds. When not playing, the return from this function
  539. is undefined.
  540. </p>
  541. <p class=func><span class=keyword>lengthMillis</span>();</p>
  542. <p class=desc>Return the total length of the current sound clip,
  543. in milliseconds. When not playing, the return from this function
  544. is undefined.
  545. </p>
  546. <h3>Notes</h3>
  547. <p>The data file must be RAW 16 bit signed integers in LSB-first format.
  548. </p>
  549. <p>While playing, the audio library accesses the SD card automatically.
  550. If card access is required, you must
  551. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  552. to prevent the library from accessing the SD card while you use it.
  553. Disabling the audio library interrupt for too long may cause audible
  554. dropouts or glitches.
  555. </p>
  556. </script>
  557. <script type="text/x-red" data-template-name="AudioPlaySdRaw">
  558. <div class="form-row">
  559. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  560. <input type="text" id="node-input-name" placeholder="Name">
  561. </div>
  562. </script>
  563. <script type="text/javascript">
  564. RED.nodes.registerType('AudioPlayQueue',{
  565. shortName: "queue",
  566. inputs:0,
  567. outputs:1,
  568. category: 'play-function',
  569. color:"#E6E0F8",
  570. icon: "arrow-in.png"
  571. });
  572. </script>
  573. <script type="text/x-red" data-help-name="AudioPlayQueue">
  574. <h3>Summary</h3>
  575. <p>Play audio data provided by the Arduino sketch. This object provides
  576. functions to allow the sketch code to push data into the audio system.</p>
  577. <h3>Audio Connections</h3>
  578. <table class=doc align=center cellpadding=3>
  579. <tr class=top><th>Port</th><th>Purpose</th></tr>
  580. <tr class=odd><td align=center>Out 0</td><td>Sound Output</td></tr>
  581. </table>
  582. <h3>Functions</h3>
  583. <p class=func><span class=keyword>play</span>(int16);</p>
  584. <p class=desc>not yet implemented
  585. </p>
  586. <p class=func><span class=keyword>play</span>(int16[], length);</p>
  587. <p class=desc>not yet implemented
  588. </p>
  589. <p class=func><span class=keyword>getBuffer</span>();</p>
  590. <p class=desc>Returns a pointer to an array of 128 int16. This buffer
  591. is within the audio library memory pool, providing the most efficient
  592. way to input data to the audio system. The buffer is likely to be
  593. populated by previously used data, so the entire 128 words should be
  594. written before calling playBuffer(). Only a single buffer should be
  595. requested at a time. This function may return NULL if no memory is
  596. available.
  597. </p>
  598. <p class=func><span class=keyword>playBuffer</span>();</p>
  599. <p class=desc>Transmit the buffer previously obtained from getBuffer().
  600. </p>
  601. <h3>Notes</h3>
  602. <p>TODO: many caveats....</p>
  603. <p>
  604. </p>
  605. </script>
  606. <script type="text/x-red" data-template-name="AudioPlayQueue">
  607. <div class="form-row">
  608. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  609. <input type="text" id="node-input-name" placeholder="Name">
  610. </div>
  611. </script>
  612. <script type="text/javascript">
  613. RED.nodes.registerType('AudioRecordQueue',{
  614. shortName: "queue",
  615. inputs:1,
  616. outputs:0,
  617. category: 'record-function',
  618. color:"#E6E0F8",
  619. icon: "arrow-in.png"
  620. });
  621. </script>
  622. <script type="text/x-red" data-help-name="AudioRecordQueue">
  623. <h3>Summary</h3>
  624. <p>Record audio data by sending to the Arduino sketch. This object allows
  625. sketch code to receive audio packets.</p>
  626. <h3>Audio Connections</h3>
  627. <table class=doc align=center cellpadding=3>
  628. <tr class=top><th>Port</th><th>Purpose</th></tr>
  629. <tr class=odd><td align=center>In 0</td><td>Sound To Access</td></tr>
  630. </table>
  631. <h3>Functions</h3>
  632. <p class=func><span class=keyword>begin</span>();</p>
  633. <p class=desc>Begin capturing incoming audio to the queue. After calling
  634. begin, readBuffer() and freeBuffer(), or clear() must be used frequently
  635. to prevent the queue from filling up.
  636. </p>
  637. <p class=func><span class=keyword>available</span>();</p>
  638. <p class=desc>Returns the number of audio packets available to read.
  639. </p>
  640. <p class=func><span class=keyword>readBuffer</span>();</p>
  641. <p class=desc>Read a single audio packet. A pointer to a 128 sample
  642. array of 16 bit integers is returned. NULL is returned if no packets
  643. are available.
  644. </p>
  645. <p class=func><span class=keyword>freeBuffer</span>();</p>
  646. <p class=desc>Release the memory from the previously read packet returned
  647. from readBuffer(). Only a single packet at a time may be read, and
  648. each packet must be freed with this function, to return the memory to
  649. the audio library.
  650. </p>
  651. <p class=func><span class=keyword>clear</span>();</p>
  652. <p class=desc>Discard all audio held in the queue.
  653. </p>
  654. <p class=func><span class=keyword>end</span>();</p>
  655. <p class=desc>Stop capturing incoming audio into the queue. Data already
  656. captured remains in the queue and may be read with readBuffer().
  657. </p>
  658. <h3>Notes</h3>
  659. <p>
  660. Up to 52 packets may be queued by this object, which allows approximately
  661. 150 ms of audio to be held in the queue, to allow time for the Arduino
  662. sketch to write data to media or do other high-latency tasks.
  663. The actual packets are taken
  664. from the pool created by AudioMemory().
  665. </p>
  666. </script>
  667. <script type="text/x-red" data-template-name="AudioRecordQueue">
  668. <div class="form-row">
  669. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  670. <input type="text" id="node-input-name" placeholder="Name">
  671. </div>
  672. </script>
  673. <script type="text/javascript">
  674. RED.nodes.registerType('AudioSynthWaveformSine',{
  675. shortName: "sine",
  676. inputs:0,
  677. outputs:1,
  678. category: 'synth-function',
  679. color:"#E6E0F8",
  680. icon: "arrow-in.png"
  681. });
  682. </script>
  683. <script type="text/x-red" data-help-name="AudioSynthWaveformSine">
  684. <h3>Summary</h3>
  685. <p>Create a sine wave signal</p>
  686. <h3>Audio Connections</h3>
  687. <table class=doc align=center cellpadding=3>
  688. <tr class=top><th>Port</th><th>Purpose</th></tr>
  689. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  690. </table>
  691. <h3>Functions</h3>
  692. <p class=func><span class=keyword>amplitude</span>(level);</p>
  693. <p class=desc>Set the amplitude, from 0 to 1.0.
  694. </p>
  695. <p class=func><span class=keyword>frequency</span>(freq);</p>
  696. <p class=desc>Set the frequency, from 0 to 22000. Very low values may
  697. be used to create a LFO (Low Frequency Oscillator) for objects
  698. with modulation signal inputs.
  699. </p>
  700. <p class=func><span class=keyword>phase</span>(angle);</p>
  701. <p class=desc>
  702. Cause the generated waveform to jump to a specific point within
  703. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  704. are configured,
  705. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  706. should be used to guarantee all new settings take effect together.
  707. </p>
  708. <h3>Notes</h3>
  709. <p></p>
  710. </script>
  711. <script type="text/x-red" data-template-name="AudioSynthWaveformSine">
  712. <div class="form-row">
  713. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  714. <input type="text" id="node-input-name" placeholder="Name">
  715. </div>
  716. </script>
  717. <script type="text/javascript">
  718. RED.nodes.registerType('AudioSynthWaveformSineModulated',{
  719. shortName: "sine_fm",
  720. inputs:1,
  721. outputs:1,
  722. category: 'synth-function',
  723. color:"#E6E0F8",
  724. icon: "arrow-in.png"
  725. });
  726. </script>
  727. <script type="text/x-red" data-help-name="AudioSynthWaveformSineModulated">
  728. <h3>Summary</h3>
  729. <p>Create a modulated sine wave, using any audio signal to continuously
  730. modulate the sine wave frequency.</p>
  731. <h3>Audio Connections</h3>
  732. <table class=doc align=center cellpadding=3>
  733. <tr class=top><th>Port</th><th>Purpose</th></tr>
  734. <tr class=odd><td align=center>In 0</td><td>Modulation Signal</td></tr>
  735. <tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
  736. </table>
  737. <h3>Functions</h3>
  738. <p class=func><span class=keyword>amplitude</span>(level);</p>
  739. <p class=desc>Set the amplitude, from 0 to 1.0.
  740. </p>
  741. <p class=func><span class=keyword>frequency</span>(freq);</p>
  742. <p class=desc>Set the center frequency, from 0 to 11000. The output will
  743. be this center frequency when the input modulation signal is zero.
  744. Modulation input 1.0 causes the frequency to double, and input -1.0
  745. causes zero Hz (DC) output. For less modulation, attenuate the input
  746. signal (perhaps with a mixer object) before it arrives here.
  747. </p>
  748. <p class=func><span class=keyword>phase</span>(angle);</p>
  749. <p class=desc>
  750. Cause the generated waveform to jump to a specific point within
  751. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  752. are configured,
  753. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  754. should be used to guarantee all new settings take effect together.
  755. </p>
  756. <h3>Notes</h3>
  757. <p></p>
  758. </script>
  759. <script type="text/x-red" data-template-name="AudioSynthWaveformSineModulated">
  760. <div class="form-row">
  761. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  762. <input type="text" id="node-input-name" placeholder="Name">
  763. </div>
  764. </script>
  765. <script type="text/javascript">
  766. RED.nodes.registerType('AudioSynthWaveform',{
  767. shortName: "waveform",
  768. inputs:0,
  769. outputs:1,
  770. category: 'synth-function',
  771. color:"#E6E0F8",
  772. icon: "arrow-in.png"
  773. });
  774. </script>
  775. <script type="text/x-red" data-help-name="AudioSynthWaveform">
  776. <h3>Summary</h3>
  777. <p>Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.</p>
  778. <h3>Audio Connections</h3>
  779. <table class=doc align=center cellpadding=3>
  780. <tr class=top><th>Port</th><th>Purpose</th></tr>
  781. <tr class=odd><td align=center>Out 0</td><td>Waveform Output</td></tr>
  782. </table>
  783. <h3>Functions</h3>
  784. <p class=func><span class=keyword>begin</span>(waveform);</p>
  785. <p class=desc>Configure the waveform type to create.
  786. </p>
  787. <p class=func><span class=keyword>begin</span>(level, frequency, waveform);</p>
  788. <p class=desc>Output a waveform, and set the amplitude and frequency.
  789. </p>
  790. <p class=func><span class=keyword>frequency</span>(freq);</p>
  791. <p class=desc>Change the frequency.
  792. </p>
  793. <p class=func><span class=keyword>amplitude</span>(level);</p>
  794. <p class=desc>Change the amplitude. Set to 0 to turn the signal off.
  795. </p>
  796. <p class=func><span class=keyword>phase</span>(angle);</p>
  797. <p class=desc>
  798. Cause the generated waveform to jump to a specific point within
  799. its cycle. Angle is from 0 to 360 degrees. When multiple objects
  800. are configured,
  801. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  802. should be used to guarantee all new settings take effect together.
  803. </p>
  804. <p class=func><span class=keyword>pulseWidth</span>(amount);</p>
  805. <p class=desc>Change the width (duty cycle) of the pulse.</p>
  806. <p class=func><span class=keyword>arbitraryWaveform</span>(array, maxFreq);</p>
  807. <p class=desc>
  808. Configure the waveform to be used with WAVEFORM_ARBITRARY. Array
  809. must be an array of 256 samples. Currently, the data is used
  810. without any filtering, which can cause aliasing with frequencies
  811. above 172 Hz. For higher frequency output, you must bandwidth
  812. limit your waveform data. Someday, "maxFreq" will be used to
  813. do this automatically.
  814. </p>
  815. <h3>Notes</h3>
  816. <p>Supported Waveforms:<br>
  817. <ul>
  818. <li><span class=literal>WAVEFORM_SINE</span></li>
  819. <li><span class=literal>WAVEFORM_SAWTOOTH</span></li>
  820. <li><span class=literal>WAVEFORM_SQUARE</span></li>
  821. <li><span class=literal>WAVEFORM_TRIANGLE</span></li>
  822. <li><span class=literal>WAVEFORM_ARBITRARY</span></li>
  823. <li><span class=literal>WAVEFORM_PULSE</span></li>
  824. </ul>
  825. </p>
  826. </script>
  827. <script type="text/x-red" data-template-name="AudioSynthWaveform">
  828. <div class="form-row">
  829. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  830. <input type="text" id="node-input-name" placeholder="Name">
  831. </div>
  832. </script>
  833. <script type="text/javascript">
  834. RED.nodes.registerType('AudioSynthToneSweep',{
  835. shortName: "tonesweep",
  836. inputs:0,
  837. outputs:1,
  838. category: 'synth-function',
  839. color:"#E6E0F8",
  840. icon: "arrow-in.png"
  841. });
  842. </script>
  843. <script type="text/x-red" data-help-name="AudioSynthToneSweep">
  844. <h3>Summary</h3>
  845. <p>Create a continuously varying (in frequency) sine wave</p>
  846. <h3>Audio Connections</h3>
  847. <table class=doc align=center cellpadding=3>
  848. <tr class=top><th>Port</th><th>Purpose</th></tr>
  849. <tr class=odd><td align=center>Out 0</td><td>Continuously varying tone</td></tr>
  850. </table>
  851. <h3>Functions</h3>
  852. <p class=func><span class=keyword>play</span>(level, lowFreq, highFreq, time);</p>
  853. <p class=desc>Start generating frequency sweep output. The time is specified
  854. in milliseconds. Level is 0 to 1.0.
  855. </p>
  856. <p class=func><span class=keyword>isPlaying</span>();</p>
  857. <p class=desc>Returns true (non-zero) while the output is active.
  858. </p>
  859. <h3>Notes</h3>
  860. <p>Uses excessive CPU time</p>
  861. </script>
  862. <script type="text/x-red" data-template-name="AudioSynthToneSweep">
  863. <div class="form-row">
  864. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  865. <input type="text" id="node-input-name" placeholder="Name">
  866. </div>
  867. </script>
  868. <script type="text/javascript">
  869. RED.nodes.registerType('AudioSynthWaveformDc',{
  870. shortName: "dc",
  871. inputs:0,
  872. outputs:1,
  873. category: 'synth-function',
  874. color:"#E6E0F8",
  875. icon: "arrow-in.png"
  876. });
  877. </script>
  878. <script type="text/x-red" data-help-name="AudioSynthWaveformDc">
  879. <h3>Summary</h3>
  880. <p>Create constant (DC) signal, useful for control of objects that take
  881. a modulation or control input signal. This constant level can be
  882. used to modify other waveforms using mixer or multiplier objects</p>
  883. <h3>Audio Connections</h3>
  884. <table class=doc align=center cellpadding=3>
  885. <tr class=top><th>Port</th><th>Purpose</th></tr>
  886. <tr class=odd><td align=center>Out 0</td><td>Output constant DC level</td></tr>
  887. </table>
  888. <h3>Functions</h3>
  889. <p class=func><span class=keyword>amplitude</span>(level);</p>
  890. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  891. changed immediately.
  892. </p>
  893. <p class=func><span class=keyword>amplitude</span>(level, milliseconds);</p>
  894. <p class=desc>Set the output. Level is -1.0 to 1.0. The output is
  895. gradually changed over a "milliseconds" time period. Any time may
  896. be specified, but periods longer than 1 second may be automatically
  897. shortened for small level changes, due to numerical precision limits.
  898. </p>
  899. <h3>Notes</h3>
  900. <p>Of course, the term "DC", for Direct Current, doesn't properly apply
  901. to a pure digital stream of numerical values. But the term is widely
  902. understood in audio applications, so hopefully it's not too confusing?</p>
  903. </script>
  904. <script type="text/x-red" data-template-name="AudioSynthWaveformDc">
  905. <div class="form-row">
  906. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  907. <input type="text" id="node-input-name" placeholder="Name">
  908. </div>
  909. </script>
  910. <script type="text/javascript">
  911. RED.nodes.registerType('AudioSynthNoiseWhite',{
  912. shortName: "noise",
  913. inputs:0,
  914. outputs:1,
  915. category: 'synth-function',
  916. color:"#E6E0F8",
  917. icon: "arrow-in.png"
  918. });
  919. </script>
  920. <script type="text/x-red" data-help-name="AudioSynthNoiseWhite">
  921. <h3>Summary</h3>
  922. <div>
  923. <p>Create white noise.
  924. </p>
  925. <p align=center><img src="whitenoise.png"></p>
  926. </div>
  927. <h3>Audio Connections</h3>
  928. <table class=doc align=center cellpadding=3>
  929. <tr class=top><th>Port</th><th>Purpose</th></tr>
  930. <tr class=odd><td align=center>Out 0</td><td>White Noise</td></tr>
  931. </table>
  932. <h3>Functions</h3>
  933. <p class=func><span class=keyword>amplitude</span>(level);</p>
  934. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  935. The default is off. Noise is generated only after setting
  936. to a non-zero level.
  937. </p>
  938. <h3>Notes</h3>
  939. <p>Setting the amplitude to zero causes this object to stop using
  940. CPU time to generate random numbers.
  941. </p>
  942. </script>
  943. <script type="text/x-red" data-template-name="AudioSynthNoiseWhite">
  944. <div class="form-row">
  945. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  946. <input type="text" id="node-input-name" placeholder="Name">
  947. </div>
  948. </script>
  949. <script type="text/javascript">
  950. RED.nodes.registerType('AudioSynthNoisePink',{
  951. shortName: "pink",
  952. inputs:0,
  953. outputs:1,
  954. category: 'synth-function',
  955. color:"#E6E0F8",
  956. icon: "arrow-in.png"
  957. });
  958. </script>
  959. <script type="text/x-red" data-help-name="AudioSynthNoisePink">
  960. <h3>Summary</h3>
  961. <div>
  962. <p>Create pink noise, using Stefan Stenzel's "New Shade Of Pink" algorithm.
  963. </p>
  964. <!--<p align=center><img src="whitenoise.png"></p>-->
  965. </div>
  966. <h3>Audio Connections</h3>
  967. <table class=doc align=center cellpadding=3>
  968. <tr class=top><th>Port</th><th>Purpose</th></tr>
  969. <tr class=odd><td align=center>Out 0</td><td>Pink Noise</td></tr>
  970. </table>
  971. <h3>Functions</h3>
  972. <p class=func><span class=keyword>amplitude</span>(level);</p>
  973. <p class=desc>Set the output peak level, from 0 (off) to 1.0.
  974. The default is off. Noise is generated only after setting
  975. to a non-zero level.
  976. </p>
  977. <h3>Notes</h3>
  978. <p>Setting the amplitude to zero causes this object to stop using
  979. CPU time. CPU usage is approx 3% on Teensy 3.1.
  980. </p>
  981. <p>Stefan Stenzel's
  982. <a href="http://stenzel.waldorfmusic.de/post/pink/" target="_blank">New Shade Of Pink</a>
  983. algorithm. Stefan's terms of use are "Use for any purpose. If used
  984. in a commercial product, you should give me one."
  985. </p>
  986. </script>
  987. <script type="text/x-red" data-template-name="AudioSynthNoisePink">
  988. <div class="form-row">
  989. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  990. <input type="text" id="node-input-name" placeholder="Name">
  991. </div>
  992. </script>
  993. <script type="text/javascript">
  994. RED.nodes.registerType('AudioEffectFade',{
  995. shortName: "fade",
  996. inputs:1,
  997. outputs:1,
  998. category: 'effect-function',
  999. color:"#E6E0F8",
  1000. icon: "arrow-in.png"
  1001. });
  1002. </script>
  1003. <script type="text/x-red" data-help-name="AudioEffectFade">
  1004. <h3>Summary</h3>
  1005. <p>Gradually increase or decrease audio level.</p>
  1006. <h3>Audio Connections</h3>
  1007. <table class=doc align=center cellpadding=3>
  1008. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1009. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1010. <tr class=odd><td align=center>Out 0</td><td>Signal Output</td></tr>
  1011. </table>
  1012. <h3>Functions</h3>
  1013. <p class=func><span class=keyword>fadeIn</span>(milliseconds);</p>
  1014. <p class=desc>Begin increasing the audio level, to reach 1.0 (input passed
  1015. directly to the output) after "milliseconds" time.
  1016. </p>
  1017. <p class=func><span class=keyword>fadeOut</span>(milliseconds);</p>
  1018. <p class=desc>Begin decreasing the audio level, to reach 0 (no output)
  1019. after "milliseconds" time.
  1020. </p>
  1021. <h3>Notes</h3>
  1022. <p>Cross fading can be built with 2 fade objects fed into a mixer.
  1023. When one fade object is off (fully faded out) and the other on
  1024. (fully faded in), if both are started at the same moment for the
  1025. same time duration, their signal gains always add to 1.0. This
  1026. allows 2 fade objects to work together for a smooth transition
  1027. between a pair of signals.
  1028. </p>
  1029. <p><a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html" target="_blank">AudioNoInterrupts()</a>
  1030. should be used when changing
  1031. settings on multiple objects, so all changes always take effect
  1032. at the same moment.
  1033. </p>
  1034. </script>
  1035. <script type="text/x-red" data-template-name="AudioEffectFade">
  1036. <div class="form-row">
  1037. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1038. <input type="text" id="node-input-name" placeholder="Name">
  1039. </div>
  1040. </script>
  1041. <script type="text/javascript">
  1042. RED.nodes.registerType('AudioEffectChorus',{
  1043. shortName: "chorus",
  1044. inputs:1,
  1045. outputs:1,
  1046. category: 'effect-function',
  1047. color:"#E6E0F8",
  1048. icon: "arrow-in.png"
  1049. });
  1050. </script>
  1051. <script type="text/x-red" data-help-name="AudioEffectChorus">
  1052. <h3>Summary</h3>
  1053. <p>The chorus effect simulates the richness of several nearly-identical
  1054. sound sources (like the way a choir sounds different to a single singer).
  1055. It does this by sampling from a delay line, so each voice is actually
  1056. the same but at a slightly different point in time. This is a type of
  1057. comb filtering.</p>
  1058. <p>Chorus combines one or more samples ranging from the most recent
  1059. sample back to about 50ms ago. The additional samples are evenly spread
  1060. through the supplied delay line, and there is no modulation.</p>
  1061. <p>If the number of voices is specified as 2, then the
  1062. effect combines the current sample and the oldest sample (the last one
  1063. in the delay line). If the number of voices is 3 then the effect combines
  1064. the most recent sample, the oldest sample and the sample in the middle of
  1065. the delay line.</p>
  1066. <p>For two voices the effect can be represented as:<br/>
  1067. result = (sample(0) + sample(dt))/2<br/>
  1068. where sample(0) represents the current sample and sample(dt)
  1069. is the sample in the delay line from dt milliseconds ago.</p>
  1070. <h3>Audio Connections</h3>
  1071. <table class=doc align=center cellpadding=3>
  1072. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1073. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1074. <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr>
  1075. </table>
  1076. <h3>Functions</h3>
  1077. <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p>
  1078. <p class=desc>Create a chorus by specifying the address of the delayline, the
  1079. total number of samples in the delay line (often done as an integer multiple of
  1080. AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em>
  1081. the original voice (so, 2 and up to get a chorus effect, although you can
  1082. specify 1 if you want).
  1083. </p>
  1084. <p class=func><span class=keyword>modify</span>(n_chorus);</p>
  1085. <p class=desc>Alters the number of voices in a running chorus (previously started with begin).
  1086. </p>
  1087. <h3>Notes</h3>
  1088. <p>The longer the length of the chorus, the more memory blocks are used.</p>
  1089. </script>
  1090. <script type="text/x-red" data-template-name="AudioEffectChorus">
  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('AudioEffectFlange',{
  1098. shortName: "flange",
  1099. inputs:1,
  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="AudioEffectFlange">
  1107. <h3>Summary</h3>
  1108. <p>Originally, flanging was produced by playing the same signal on two synchronized
  1109. reel-to-reel tape recorders and making one of the reels slow down and speed up by
  1110. pressing on the flange of the reel (hence the name). This is a type of
  1111. comb filtering, and produces a harmonically-related series of peaks and notches
  1112. in the audio spectrum.</p>
  1113. <p>This flanger uses a delay line, combining the original voice with only one sample from the delay
  1114. line, but the position of that sample varies sinusoidally.</p>
  1115. <p>The effect can be represented as:<br>
  1116. result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p>
  1117. <p>The value of the sine function is always a number from -1 to +1 and
  1118. so the result of depth*(sin(Fe)) is always a number from -depth to +depth.
  1119. Thus, the delayed sample will be selected from the range (dt-depth) to
  1120. (dt+depth). This selection will vary at whatever rate is specified as the
  1121. frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used.
  1122. <h3>Audio Connections</h3>
  1123. <table class=doc align=center cellpadding=3>
  1124. <tr class="top"><th>Port</th><th>Purpose</th></tr>
  1125. <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr>
  1126. <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr>
  1127. </table>
  1128. <h3>Functions</h3>
  1129. <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p>
  1130. <p class=desc>Create a flanger by specifying the address of the delayline, the
  1131. total number of samples in the delay line (often done as an integer multiple of
  1132. AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice),
  1133. the modulation depth (larger values give a greater variation) and the modulation
  1134. frequency, in Hertz.
  1135. </p>
  1136. <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p>
  1137. <p class=desc>Alters the parameters in a running flanger (previously started with begin).
  1138. </p>
  1139. <h3>Notes</h3>
  1140. <p>The longer the length of the delay buffer, the more memory blocks are used.</p>
  1141. <p>Try these settings:<br>
  1142. #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br>
  1143. and<br>
  1144. int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br>
  1145. int s_depth = FLANGE_DELAY_LENGTH/4;<br>
  1146. double s_freq = 3;</p>
  1147. <p>The flange effect can also produce a chorus-like effect if a longer
  1148. delay line is used with a slower modulation rate, for example try:<br>
  1149. #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br>
  1150. and<br>
  1151. int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br>
  1152. int s_depth = FLANGE_DELAY_LENGTH/8;<br>
  1153. double s_freq = .0625;</p>
  1154. </script>
  1155. <script type="text/x-red" data-template-name="AudioEffectFlange">
  1156. <div class="form-row">
  1157. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1158. <input type="text" id="node-input-name" placeholder="Name">
  1159. </div>
  1160. </script>
  1161. <script type="text/javascript">
  1162. RED.nodes.registerType('AudioEffectEnvelope',{
  1163. shortName: "envelope",
  1164. inputs:1,
  1165. outputs:1,
  1166. category: 'effect-function',
  1167. color:"#E6E0F8",
  1168. icon: "arrow-in.png"
  1169. });
  1170. </script>
  1171. <script type="text/x-red" data-help-name="AudioEffectEnvelope">
  1172. <h3>Summary</h3>
  1173. <div>
  1174. <p>Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain
  1175. Release) envelope.
  1176. </p>
  1177. <p align=center><img src="dahdsr.png"></p>
  1178. </div>
  1179. <h3>Audio Connections</h3>
  1180. <table class=doc align=center cellpadding=3>
  1181. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1182. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1183. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1184. </table>
  1185. <h3>Functions</h3>
  1186. <p class=func><span class=keyword>noteOn</span>();</p>
  1187. <p class=desc>Begin the delay to attack, or the attack phase is
  1188. delay is zero.
  1189. </p>
  1190. <p class=func><span class=keyword>noteOff</span>();</p>
  1191. <p class=desc>Begin the release phase.
  1192. </p>
  1193. <p class=func><span class=keyword>delay</span>(milliseconds);</p>
  1194. <p class=desc>Set the delay from noteOn to the attach phase. The
  1195. default is zero, for no delay.
  1196. </p>
  1197. <p class=func><span class=keyword>attack</span>(milliseconds);</p>
  1198. <p class=desc>Set the attack time. The default is 1.5 milliseconds.
  1199. </p>
  1200. <p class=func><span class=keyword>hold</span>(milliseconds);</p>
  1201. <p class=desc>Set the hold time. The default is 0.5 milliseconds.
  1202. </p>
  1203. <p class=func><span class=keyword>decay</span>(milliseconds);</p>
  1204. <p class=desc>Set the decay time. The default is 15 milliseconds.
  1205. </p>
  1206. <p class=func><span class=keyword>sustain</span>(level);</p>
  1207. <p class=desc>Set the sustain level. The range is 0 to 1.0. The
  1208. gain will be maintained at this level after the decay phase,
  1209. until noteOff() is called.
  1210. </p>
  1211. <p class=func><span class=keyword>release</span>(milliseconds);</p>
  1212. <p class=desc>Set the release time. The default is 30 millisecond.
  1213. </p>
  1214. <h3>Notes</h3>
  1215. <p>To achieve the more common ADSR shape, simply
  1216. set delay and hold to zero.</p>
  1217. <p>The recommended range for each of the 5 timing inputs is 0 to 50
  1218. milliseconds. Up to 200 ms can be used, with somewhat reduced
  1219. accuracy</p>
  1220. </script>
  1221. <script type="text/x-red" data-template-name="AudioEffectEnvelope">
  1222. <div class="form-row">
  1223. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1224. <input type="text" id="node-input-name" placeholder="Name">
  1225. </div>
  1226. </script>
  1227. <script type="text/javascript">
  1228. RED.nodes.registerType('AudioEffectMultiply',{
  1229. shortName: "multiply",
  1230. inputs:2,
  1231. outputs:1,
  1232. category: 'effect-function',
  1233. color:"#E6E0F8",
  1234. icon: "arrow-in.png"
  1235. });
  1236. </script>
  1237. <script type="text/x-red" data-help-name="AudioEffectMultiply">
  1238. <h3>Summary</h3>
  1239. <div>
  1240. <p>Multiply two signals together, useful for amplitude modulation
  1241. or "voltage controlled amplification".
  1242. </p>
  1243. <p align=center><img src="multiply.png"><br><small>56 Hz and 1 kHz sine waves multiplied.</small></p>
  1244. </div>
  1245. <h3>Audio Connections</h3>
  1246. <table class=doc align=center cellpadding=3>
  1247. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1248. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1249. <tr class=odd><td align=center>In 1</td><td>Signal Input</td></tr>
  1250. <tr class=odd><td align=center>Out 0</td><td>Signal with Envelope Applied</td></tr>
  1251. </table>
  1252. <h3>Functions</h3>
  1253. <p>There are no functions to call from the Arduino sketch.
  1254. This object simply multiplies the 2 signals to create
  1255. a continuous output
  1256. </p>
  1257. <h3>Notes</h3>
  1258. <p>
  1259. </p>
  1260. </script>
  1261. <script type="text/x-red" data-template-name="AudioEffectMultiply">
  1262. <div class="form-row">
  1263. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1264. <input type="text" id="node-input-name" placeholder="Name">
  1265. </div>
  1266. </script>
  1267. <script type="text/javascript">
  1268. RED.nodes.registerType('AudioEffectDelay',{
  1269. shortName: "delay",
  1270. inputs:1,
  1271. outputs:8,
  1272. category: 'effect-function',
  1273. color:"#E6E0F8",
  1274. icon: "arrow-in.png"
  1275. });
  1276. </script>
  1277. <script type="text/x-red" data-help-name="AudioEffectDelay">
  1278. <h3>Summary</h3>
  1279. <div>
  1280. <p>Delay a signal. Up to 8 separate delay taps can be used.</p>
  1281. <p align=center><img src="delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  1282. </div>
  1283. <h3>Audio Connections</h3>
  1284. <table class=doc align=center cellpadding=3>
  1285. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1286. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  1287. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  1288. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  1289. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  1290. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  1291. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  1292. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  1293. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  1294. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  1295. </table>
  1296. <h3>Functions</h3>
  1297. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  1298. <p class=desc>Set output channel (0 to 7) to delay the signals by
  1299. milliseconds. The maximum delay is approx 333 ms. The actual delay
  1300. is rounded to the nearest sample. Each channel can be configured for
  1301. any delay. There is no requirement to configure the "taps" in increasing
  1302. delay order.
  1303. </p>
  1304. <p class=func><span class=keyword>disable</span>(channel);</p>
  1305. <p class=desc>Disable a channel. The output of this channel becomes
  1306. silent. If this channel is the longest delay, memory usage is
  1307. automatically reduced to accomodate only the remaining channels used.
  1308. </p>
  1309. <h3>Notes</h3>
  1310. <p>Memory for the delayed signal is take from the memory pool allocated by
  1311. <a href="http://www.pjrc.com/teensy/td_libs_AudioConnection.html" target="_blank">AudioMemory()</a>.
  1312. Each block allows about 3 milliseconds of delay, so AudioMemory
  1313. should be increased to allow for the longest delay tap.
  1314. </p>
  1315. </script>
  1316. <script type="text/x-red" data-template-name="AudioEffectDelay">
  1317. <div class="form-row">
  1318. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1319. <input type="text" id="node-input-name" placeholder="Name">
  1320. </div>
  1321. </script>
  1322. <script type="text/javascript">
  1323. RED.nodes.registerType('AudioFilterBiquad',{
  1324. shortName: "biquad",
  1325. inputs:1,
  1326. outputs:1,
  1327. category: 'filter-function',
  1328. color:"#E6E0F8",
  1329. icon: "arrow-in.png"
  1330. });
  1331. </script>
  1332. <script type="text/x-red" data-help-name="AudioFilterBiquad">
  1333. <h3>Summary</h3>
  1334. <div>
  1335. <p>Biquadratic cascaded filter, useful for all sorts of filtering.
  1336. Up to 4 stages may be cascaded.
  1337. </p>
  1338. <p align=center><img src="biquad.png"></p>
  1339. </div>
  1340. <h3>Audio Connections</h3>
  1341. <table class=doc align=center cellpadding=3>
  1342. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1343. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1344. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1345. </table>
  1346. <h3>Functions</h3>
  1347. <p class=func><span class=keyword>setLowpass</span>(stage, frequency, Q);</p>
  1348. <p class=desc>Configure one stage of the filter (0 to 3) with low pass
  1349. response, with the specified corner frequency and Q shape. If Q is
  1350. higher that 0.7071, be careful of filter gain (see below).
  1351. </p>
  1352. <p class=func><span class=keyword>setHighpass</span>(stage, frequency, Q);</p>
  1353. <p class=desc>Configure one stage of the filter (0 to 3) with high pass
  1354. response, with the specified corner frequency and Q shape. If Q is
  1355. higher that 0.7071, be careful of filter gain (see below).
  1356. </p>
  1357. <p class=func><span class=keyword>setBandpass</span>(stage, frequency, Q);</p>
  1358. <p class=desc>Configure one stage of the filter (0 to 3) with band pass
  1359. response. The filter has unity gain at the specified frequency. Q
  1360. controls the width of frequencies allowed to pass.
  1361. </p>
  1362. <p class=func><span class=keyword>setNotch</span>(stage, frequency, Q);</p>
  1363. <p class=desc>Configure one stage of the filter (0 to 3) with band reject (notch)
  1364. response. Q controls the width of rejected frequencies.
  1365. </p>
  1366. <p class=func><span class=keyword>setCoefficients</span>(stage, array[5]);</p>
  1367. <p class=desc>Configure one stage of the filter (0 to 3) with an arbitrary
  1368. filter response. The array of coefficients is in order: B0, B1, B2, A1, A2.
  1369. Each coefficient must be less than 2.0 and greater than -2.0. The array
  1370. should be type double. Alternately, it may be type int, where 1.0 is
  1371. represented with 1073741824 (2<sup>30</sup>).
  1372. </p>
  1373. <h3>Notes</h3>
  1374. <p>Filters can with gain must have their input signals attenuated, so the
  1375. signal does not exceed 1.0.
  1376. </p>
  1377. <p>This object implements up to 4 cascaded stages. Unconfigured stages will
  1378. not pass any signal.
  1379. </p>
  1380. <p>Biquad filters with low corner frequency (under about 400 Hz) can run into
  1381. trouble with limited numerical precision, causing the filter to perform
  1382. poorly. For very low corner frequency, the State Variable (Chamberlin)
  1383. filter should be used.
  1384. </p>
  1385. </script>
  1386. <script type="text/x-red" data-template-name="AudioFilterBiquad">
  1387. <div class="form-row">
  1388. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1389. <input type="text" id="node-input-name" placeholder="Name">
  1390. </div>
  1391. </script>
  1392. <script type="text/javascript">
  1393. RED.nodes.registerType('AudioFilterFIR',{
  1394. shortName: "fir",
  1395. inputs:1,
  1396. outputs:1,
  1397. category: 'filter-function',
  1398. color:"#E6E0F8",
  1399. icon: "arrow-in.png"
  1400. });
  1401. </script>
  1402. <script type="text/x-red" data-help-name="AudioFilterFIR">
  1403. <h3>Summary</h3>
  1404. <div>
  1405. <p>Finite impulse response filter, useful for all sorts of filtering.
  1406. </p>
  1407. <p align=center><img src="fir_filter.png"></p>
  1408. </div>
  1409. <h3>Audio Connections</h3>
  1410. <table class=doc align=center cellpadding=3>
  1411. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1412. <tr class=odd><td align=center>In 0</td><td>Signal to be filtered</td></tr>
  1413. <tr class=odd><td align=center>Out 0</td><td>Filtered Signal Output</td></tr>
  1414. </table>
  1415. <h3>Functions</h3>
  1416. <p class=func><span class=keyword>begin</span>(array, length);</p>
  1417. <p class=desc>Initialize the filter. The array must be 16 bit integers (the
  1418. filter's impulse response), and
  1419. length indicates the number of points in the array. Array may also be
  1420. FIR_PASSTHRU (length = 0), to directly pass the input to output without
  1421. filtering.
  1422. </p>
  1423. <p class=func><span class=keyword>end</span>();</p>
  1424. <p class=desc>Turn the filter off.
  1425. </p>
  1426. <h3>Notes</h3>
  1427. <p>FIR filters requires more CPU time than Biquad (IIR), but they can
  1428. implement filters with better phase response.
  1429. </p>
  1430. <p>A 100 point filter requires 9% CPU time on Teensy 3.1. The maximum
  1431. supported filter length is 200 points.
  1432. </p>
  1433. <p>The free
  1434. <a href="http://t-filter.appspot.com/fir/index.html" target="_blank"> TFilter Design Tool</a>
  1435. can be used to create the impulse response array. Be sure to set the sampling
  1436. frequency to 44117 HZ (it defaults to only 2000 Hz) and the output type to "int" (16 bit).
  1437. </p>
  1438. <p>
  1439. If you use TFilter Design's "C/C++ array" option, it's output has "int" definition, which
  1440. is 32 bits on Teensy 3.1. Edit "int" to "short" for an array of 16 bit numbers,
  1441. and add "const" to avoid consuming extra RAM.
  1442. </p>
  1443. </script>
  1444. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1445. <div class="form-row">
  1446. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1447. <input type="text" id="node-input-name" placeholder="Name">
  1448. </div>
  1449. </script>
  1450. <script type="text/javascript">
  1451. RED.nodes.registerType('AudioFilterStateVariable',{
  1452. shortName: "filter",
  1453. inputs:2,
  1454. outputs:3,
  1455. category: 'filter-function',
  1456. color:"#E6E0F8",
  1457. icon: "arrow-in.png"
  1458. });
  1459. </script>
  1460. <script type="text/x-red" data-help-name="AudioFilterStateVariable">
  1461. <h3>Summary</h3>
  1462. <p>A State Variable (Chamberlin) Filter with 12 dB/octave roll-off,
  1463. adjustable resonance, and optional signal control of corner
  1464. frequency.</p>
  1465. <h3>Audio Connections</h3>
  1466. <table class=doc align=center cellpadding=3>
  1467. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1468. <tr class=odd><td align=center>In 0</td><td>Signal to Filter</td></tr>
  1469. <tr class=odd><td align=center>In 1</td><td>Frequency Control</td></tr>
  1470. <tr class=odd><td align=center>Out 0</td><td>Low Pass Output</td></tr>
  1471. <tr class=odd><td align=center>Out 1</td><td>Band Pass Output</td></tr>
  1472. <tr class=odd><td align=center>Out 2</td><td>High Pass Output</td></tr>
  1473. </table>
  1474. <h3>Functions</h3>
  1475. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1476. <p class=desc>Set the filter's corner frequency. When a signal is
  1477. connected to the control input, the filter will implement this
  1478. frequency when the signal is zero.
  1479. </p>
  1480. <p class=func><span class=keyword>resonance</span>(Q);</p>
  1481. <p class=desc>Set the filter's resonance. Q ranges from 0.7 to 5.0.
  1482. Resonance greater than 0.707 will amplify the signal near the
  1483. corner frequency. You must attenuate the signal before input
  1484. to this filter, to prevent clipping.
  1485. </p>
  1486. <p class=func><span class=keyword>octaveControl</span>(octaves);</p>
  1487. <p class=desc>Set how much (in octaves) the control signal can alter
  1488. the filter's corner freqency. Range is 0 to 7 octaves. For
  1489. example, when set to 2.5, a full scale positive signal (1.0) will
  1490. shift the filter frequency up 2.5 octaves, and a full scale negative
  1491. signal will shift it down 2.5 octaves.
  1492. </p>
  1493. <h3>Notes</h3>
  1494. <p>
  1495. When controlled by a signal, the equation for the filter
  1496. frequency is:
  1497. </p>
  1498. <p>
  1499. F = Fcenter * 2^<sup>(signal * octaves)</sup>
  1500. <br><small>If anyone knows how to do HTML equations, please
  1501. help me improve this.....</small>
  1502. </p>
  1503. <p>When operating with signal control of corner frequency, this
  1504. object uses approximately 4% of the CPU time on Teensy 3.1.
  1505. </p>
  1506. </script>
  1507. <script type="text/x-red" data-template-name="AudioFilterFIR">
  1508. <div class="form-row">
  1509. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1510. <input type="text" id="node-input-name" placeholder="Name">
  1511. </div>
  1512. </script>
  1513. <script type="text/javascript">
  1514. RED.nodes.registerType('AudioAnalyzePeak',{
  1515. shortName: "peak",
  1516. inputs:1,
  1517. outputs:0,
  1518. category: 'analyze-function',
  1519. color:"#E6E0F8",
  1520. icon: "arrow-in.png"
  1521. });
  1522. </script>
  1523. <script type="text/x-red" data-help-name="AudioAnalyzePeak">
  1524. <h3>Summary</h3>
  1525. <p>Track the signal peak amplitude. Very useful for simple
  1526. audio level response projects, and general troubleshooting.</p>
  1527. <h3>Audio Connections</h3>
  1528. <table class=doc align=center cellpadding=3>
  1529. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1530. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1531. </table>
  1532. <h3>Functions</h3>
  1533. <p class=func><span class=keyword>available</span>();</p>
  1534. <p class=desc>Returns true each time new peak data is available.
  1535. </p>
  1536. <p class=func><span class=keyword>read</span>();</p>
  1537. <p class=desc>Read the highest peak value since the last read.
  1538. Return is from 0.0 to 1.0.
  1539. </p>
  1540. <h3>Notes</h3>
  1541. <p></p>
  1542. </script>
  1543. <script type="text/x-red" data-template-name="AudioAnalyzePeak">
  1544. <div class="form-row">
  1545. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1546. <input type="text" id="node-input-name" placeholder="Name">
  1547. </div>
  1548. </script>
  1549. <script type="text/javascript">
  1550. RED.nodes.registerType('AudioAnalyzeFFT256',{
  1551. shortName: "fft256",
  1552. inputs:1,
  1553. outputs:0,
  1554. category: 'analyze-function',
  1555. color:"#E6E0F8",
  1556. icon: "arrow-in.png"
  1557. });
  1558. </script>
  1559. <script type="text/x-red" data-help-name="AudioAnalyzeFFT256">
  1560. <h3>Summary</h3>
  1561. <p>Compute a 256 point Fast Fourier Transform (FFT) frequency analysis,
  1562. with real value (magnitude) output. The frequency resolution is
  1563. 172 Hz, useful for simple audio visualization.</p>
  1564. <h3>Audio Connections</h3>
  1565. <table class=doc align=center cellpadding=3>
  1566. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1567. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1568. </table>
  1569. <h3>Functions</h3>
  1570. <p class=func><span class=keyword>available</span>();</p>
  1571. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1572. </p>
  1573. <p class=func><span class=keyword>read</span>(binNumber);</p>
  1574. <p class=desc>Read a single frequency bin, from 0 to 127. The result is scaled
  1575. so 1.0 represents a full scale sine wave.
  1576. </p>
  1577. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  1578. <p class=desc>Read several frequency bins, returning their sum. The higher
  1579. audio octaves are represented by many bins, which are typically read
  1580. as a group for audio visualization.
  1581. </p>
  1582. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  1583. <p class=desc>New data is produced very radidly, approximately 344 times
  1584. per second. Multiple outputs can be averaged together, so available()
  1585. returns true at a slower rate.
  1586. </p>
  1587. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  1588. <p class=desc>Set the window function to be used. AudioWindowHanning256
  1589. is the default. Windowing may be disabled by NULL, but windowing
  1590. should be used for all non-periodic (music) signals, and all periodic
  1591. signals that are not exact integer division of the sample rate.
  1592. </p>
  1593. <h3>Notes</h3>
  1594. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1595. num is 0 to 127.</p>
  1596. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1597. <p>Window Types:
  1598. <ul>
  1599. <li><span class=literal>AudioWindowHanning256</span> (default)</li>
  1600. <li><span class=literal>AudioWindowBartlett256</span></li>
  1601. <li><span class=literal>AudioWindowBlackman256</span></li>
  1602. <li><span class=literal>AudioWindowFlattop256</span></li>
  1603. <li><span class=literal>AudioWindowBlackmanHarris256</span></li>
  1604. <li><span class=literal>AudioWindowNuttall256</span></li>
  1605. <li><span class=literal>AudioWindowBlackmanNuttall256</span></li>
  1606. <li><span class=literal>AudioWindowWelch256</span></li>
  1607. <li><span class=literal>AudioWindowHamming256</span></li>
  1608. <li><span class=literal>AudioWindowCosine256</span></li>
  1609. <li><span class=literal>AudioWindowTukey256</span></li>
  1610. </ul>
  1611. </p>
  1612. </script>
  1613. <script type="text/x-red" data-template-name="AudioAnalyzeFFT256">
  1614. <div class="form-row">
  1615. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1616. <input type="text" id="node-input-name" placeholder="Name">
  1617. </div>
  1618. </script>
  1619. <script type="text/javascript">
  1620. RED.nodes.registerType('AudioAnalyzeFFT1024',{
  1621. shortName: "fft1024",
  1622. inputs:1,
  1623. outputs:0,
  1624. category: 'analyze-function',
  1625. color:"#E6E0F8",
  1626. icon: "arrow-in.png"
  1627. });
  1628. </script>
  1629. <script type="text/x-red" data-help-name="AudioAnalyzeFFT1024">
  1630. <h3>Summary</h3>
  1631. <p>Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis,
  1632. with real value (magnitude) output. The frequency resolution is
  1633. 43 Hz, useful detailed for audio visualization.</p>
  1634. <h3>Audio Connections</h3>
  1635. <table class=doc align=center cellpadding=3>
  1636. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1637. <tr class=odd><td align=center>In 0</td><td>Signal to convert to frequency bins</td></tr>
  1638. </table>
  1639. <h3>Functions</h3>
  1640. <p class=func><span class=keyword>available</span>();</p>
  1641. <p class=desc>Returns true each time the FFT analysis produces new output data.
  1642. </p>
  1643. <p class=func><span class=keyword>read</span>(binNumber);</p>
  1644. <p class=desc>Read a single frequency bin, from 0 to 511. The result is scaled
  1645. so 1.0 represents a full scale sine wave.
  1646. </p>
  1647. <p class=func><span class=keyword>read</span>(firstBin, lastBin);</p>
  1648. <p class=desc>Read several frequency bins, returning their sum. The higher
  1649. audio octaves are represented by many bins, which are typically read
  1650. as a group for audio visualization.
  1651. </p>
  1652. <p class=func><span class=keyword>averageTogether</span>(number);</p>
  1653. <p class=desc>This function does nothing. The 1024 point FFT always
  1654. updates at approximately 86 times per second.
  1655. </p>
  1656. <p class=func><span class=keyword>windowFunction</span>(window);</p>
  1657. <p class=desc>Set the window function to be used. AudioWindowHanning1024
  1658. is the default. Windowing may be disabled by NULL, but windowing
  1659. should be used for all non-periodic (music) signals, and all periodic
  1660. signals that are not exact integer division of the sample rate.
  1661. </p>
  1662. <h3>Notes</h3>
  1663. <p>The raw 16 bit output data bins may be access with myFFT.output[num], where
  1664. num is 0 to 511.</p>
  1665. <p>TODO: caveats about spectral leakage vs frequency precision for arbitrary signals</p>
  1666. <p>Window Types:
  1667. <ul>
  1668. <li><span class=literal>AudioWindowHanning1024</span> (default)</li>
  1669. <li><span class=literal>AudioWindowBartlett1024</span></li>
  1670. <li><span class=literal>AudioWindowBlackman1024</span></li>
  1671. <li><span class=literal>AudioWindowFlattop1024</span></li>
  1672. <li><span class=literal>AudioWindowBlackmanHarris1024</span></li>
  1673. <li><span class=literal>AudioWindowNuttall1024</span></li>
  1674. <li><span class=literal>AudioWindowBlackmanNuttall1024</span></li>
  1675. <li><span class=literal>AudioWindowWelch1024</span></li>
  1676. <li><span class=literal>AudioWindowHamming1024</span></li>
  1677. <li><span class=literal>AudioWindowCosine1024</span></li>
  1678. <li><span class=literal>AudioWindowTukey1024</span></li>
  1679. </ul>
  1680. </p>
  1681. <p>1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1.
  1682. Average usage is much lower. Future versions might distribute the
  1683. load more evenly over time....
  1684. </p>
  1685. </script>
  1686. <script type="text/x-red" data-template-name="AudioAnalyzeFFT1024">
  1687. <div class="form-row">
  1688. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1689. <input type="text" id="node-input-name" placeholder="Name">
  1690. </div>
  1691. </script>
  1692. <script type="text/javascript">
  1693. RED.nodes.registerType('AudioAnalyzeToneDetect',{
  1694. shortName: "tone",
  1695. inputs:1,
  1696. outputs:0,
  1697. category: 'analyze-function',
  1698. color:"#E6E0F8",
  1699. icon: "arrow-in.png"
  1700. });
  1701. </script>
  1702. <script type="text/x-red" data-help-name="AudioAnalyzeToneDetect">
  1703. <h3>Summary</h3>
  1704. <p>Detect the level of a single tone</p>
  1705. <h3>Audio Connections</h3>
  1706. <table class=doc align=center cellpadding=3>
  1707. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1708. <tr class=odd><td align=center>In 0</td><td>Signal to analyze</td></tr>
  1709. </table>
  1710. <h3>Functions</h3>
  1711. <p class=func><span class=keyword>frequency</span>(freq);</p>
  1712. <p class=desc>Set the frequency to detect. The default detection time
  1713. will be 10 cycles of this frequency.
  1714. </p>
  1715. <p class=func><span class=keyword>frequency</span>(freq, cycles);</p>
  1716. <p class=desc>Set the frequency to detect, and the number of cycles.
  1717. Longer detection time (more cycles) will give higher precision,
  1718. but of course slower response.
  1719. </p>
  1720. <p class=func><span class=keyword>available</span>();</p>
  1721. <p class=desc>Returns true (non-zero) each time a detection interval
  1722. (number of cycles) completed and a new level is detected.
  1723. </p>
  1724. <p class=func><span class=keyword>read</span>();</p>
  1725. <p class=desc>Read the detected signal level. Range is 0 to 1.0.
  1726. </p>
  1727. <p class=func><span class=keyword>threshold</span>(level);</p>
  1728. <p class=desc>Set a detection threshold, where the bool test operation
  1729. will return true if at or above this level, or false when below.
  1730. </p>
  1731. <p class=func>(bool)</p>
  1732. <p class=desc>By testing the object as a boolean value, you can respond
  1733. to detection of a tone.
  1734. </p>
  1735. <h3>Notes</h3>
  1736. <p>Low frequency detection has trouble with numerical precision.
  1737. Works really well for all 8 DTMF frequencies, but fails for
  1738. detecting "sub audible tones" used in some control applications.</p>
  1739. <p>The (bool) test continues to return true until the next detection
  1740. interval (the configured number of cycles). This behavior may
  1741. change in future versions, for a single true each time the signal
  1742. is detected, and then false for the remainder of that interval.</p>
  1743. </script>
  1744. <script type="text/x-red" data-template-name="AudioAnalyzeToneDetect">
  1745. <div class="form-row">
  1746. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1747. <input type="text" id="node-input-name" placeholder="Name">
  1748. </div>
  1749. </script>
  1750. <script type="text/javascript">
  1751. RED.nodes.registerType('AudioAnalyzePrint',{
  1752. shortName: "print",
  1753. inputs:1,
  1754. outputs:0,
  1755. category: 'analyze-function',
  1756. color:"#E6E0F8",
  1757. icon: "arrow-in.png"
  1758. });
  1759. </script>
  1760. <script type="text/x-red" data-help-name="AudioAnalyzePrint">
  1761. <h3>Summary</h3>
  1762. <p>Print raw audio data to the Arduino Serial Monitor. This
  1763. object creates massive output quickly, and should not normally be used.</p>
  1764. <h3>Audio Connections</h3>
  1765. <table class=doc align=center cellpadding=3>
  1766. <tr class=top><th>Port</th><th>Purpose</th></tr>
  1767. <tr class=odd><td align=center>In 0</td><td>Signal to print</td></tr>
  1768. </table>
  1769. <h3>Functions</h3>
  1770. <p class=func><span class=keyword>name</span>(string);</p>
  1771. <p class=desc>blah blah blah blah
  1772. </p>
  1773. <p class=func><span class=keyword>trigger</span>();</p>
  1774. <p class=desc>blah blah blah blah
  1775. </p>
  1776. <p class=func><span class=keyword>trigger</span>(level, edge);</p>
  1777. <p class=desc>blah blah blah blah
  1778. </p>
  1779. <p class=func><span class=keyword>delay</span>(samples);</p>
  1780. <p class=desc>blah blah blah blah
  1781. </p>
  1782. <p class=func><span class=keyword>length</span>(samples);</p>
  1783. <p class=desc>blah blah blah blah
  1784. </p>
  1785. <h3>Notes</h3>
  1786. <p>This object doesn't work very well and probably should not be used.</p>
  1787. </script>
  1788. <script type="text/x-red" data-template-name="AudioAnalyzePrint">
  1789. <div class="form-row">
  1790. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  1791. <input type="text" id="node-input-name" placeholder="Name">
  1792. </div>
  1793. </script>
  1794. <script type="text/javascript">
  1795. RED.nodes.registerType('AudioControlSGTL5000',{
  1796. shortName: "sgtl5000",
  1797. inputs:0,
  1798. outputs:0,
  1799. category: 'control-function',
  1800. color:"#E6E0F8",
  1801. icon: "arrow-in.png"
  1802. });
  1803. </script>
  1804. <script type="text/x-red" data-help-name="AudioControlSGTL5000">
  1805. <h3>Summary</h3>
  1806. <p>Control the SGTL5000 chip on the audio shield
  1807. <a href="http://www.pjrc.com/store/teensy3_audio.html" target="_blank">audio shield</a>.
  1808. SGTL5000 is always used in slave mode, where Teensy controls
  1809. all I2S timing.
  1810. </p>
  1811. <p align=center><img src="sgtl5000closeup.jpg"></p>
  1812. <h3>Audio Connections</h3>
  1813. <p>This object has no audio inputs or outputs. Separate i2s objects
  1814. are used to send and receive audio data. I2S master mode objects
  1815. must be used, because this object configures the SGTL5000 in slave
  1816. mode, where it depends on Teensy to provide all I2S clocks.
  1817. This object controls
  1818. how the SGTL5000 will use those I2S audio streams.</p>
  1819. <h3>Functions</h3>
  1820. <p>These are the most commonly used SGTL5000 functions.</p>
  1821. <p class=func><span class=keyword>enable</span>();</p>
  1822. <p class=desc>Start the SGTL5000. This function should be called first.
  1823. </p>
  1824. <p class=func><span class=keyword>volume</span>(level);</p>
  1825. <p class=desc>Set the headphone volume level. Range is 0 to 1.0, but
  1826. 0.8 corresponds to the maximum undistorted output for a full scale
  1827. signal. Usually 0.5 is a comfortable listening level. The line
  1828. level outputs are not changed by this function.
  1829. </p>
  1830. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  1831. <p class=desc>Select which input to use: AUDIO_INPUT_LINEIN or AUDIO_INPUT_MIC.
  1832. </p>
  1833. <p class=func><span class=keyword>micGain</span>(dB);</p>
  1834. <p class=desc>When using the microphone input, set the amplifier gain.
  1835. The input number is in decibels, from 0 to 63.
  1836. </p>
  1837. <h3>Signal Levels</h3>
  1838. <p>The default signal levels should be used for most applications,
  1839. but these functions allow you to customize the analog signals.</p>
  1840. <p class=func><span class=keyword>muteHeadphone</span>();</p>
  1841. <p class=desc>Silence the headphone output.
  1842. </p>
  1843. <p class=func><span class=keyword>unmuteHeadphone</span>();</p>
  1844. <p class=desc>Turn the headphone output on.
  1845. </p>
  1846. <p class=func><span class=keyword>muteLineout</span>();</p>
  1847. <p class=desc>Silence the line level outputs.
  1848. </p>
  1849. <p class=func><span class=keyword>unmuteLineout</span>();</p>
  1850. <p class=desc>Turn the line level outputs on.
  1851. </p>
  1852. <p class=func><span class=keyword>lineInLevel</span>(both);</p>
  1853. <p class=desc style="padding-bottom:0.2em;">Adjust the sensitivity of the line-level inputs.
  1854. Fifteen settings are possible:
  1855. </p>
  1856. <pre class="desc">
  1857. 0: 3.12 Volts p-p
  1858. 1: 2.63 Volts p-p
  1859. 2: 2.22 Volts p-p
  1860. 3: 1.87 Volts p-p
  1861. 4: 1.58 Volts p-p
  1862. 5: 1.33 Volts p-p (default)
  1863. 6: 1.11 Volts p-p
  1864. 7: 0.94 Volts p-p
  1865. 8: 0.79 Volts p-p
  1866. 9: 0.67 Volts p-p
  1867. 10: 0.56 Volts p-p
  1868. 11: 0.48 Volts p-p
  1869. 12: 0.40 Volts p-p
  1870. 13: 0.34 Volts p-p
  1871. 14: 0.29 Volts p-p
  1872. 15: 0.24 Volts p-p
  1873. </pre>
  1874. <p class=func><span class=keyword>lineInLevel</span>(left, right);</p>
  1875. <p class=desc>Adjust the sensitivity of the line-level inputs, with different
  1876. settings for left and right. The same 15 settings are available.
  1877. </p>
  1878. <p class=func><span class=keyword>lineOutLevel</span>(both);</p>
  1879. <p class=desc style="padding-bottom:0.2em;">Adjust the line level output
  1880. voltage range. The following settings are possible:
  1881. </p>
  1882. <pre class="desc">
  1883. 13: 3.16 Volts p-p
  1884. 14: 2.98 Volts p-p
  1885. 15: 2.83 Volts p-p
  1886. 16: 2.67 Volts p-p
  1887. 17: 2.53 Volts p-p
  1888. 18: 2.39 Volts p-p
  1889. 19: 2.26 Volts p-p
  1890. 20: 2.14 Volts p-p
  1891. 21: 2.02 Volts p-p
  1892. 22: 1.91 Volts p-p
  1893. 23: 1.80 Volts p-p
  1894. 24: 1.71 Volts p-p
  1895. 25: 1.62 Volts p-p
  1896. 26: 1.53 Volts p-p
  1897. 27: 1.44 Volts p-p
  1898. 28: 1.37 Volts p-p
  1899. 29: 1.29 Volts p-p (default)
  1900. 30: 1.22 Volts p-p
  1901. 31: 1.16 Volts p-p
  1902. </pre>
  1903. <p class=func><span class=keyword>lineOutLevel</span>(left, right);</p>
  1904. <p class=desc>Adjust the line level outout voltage range, with separate
  1905. settings for left and right. The same settings (13 to 31) are available.
  1906. </p>
  1907. <h3>Signal Conditioning</h3>
  1908. <p>Usually these digital signal conditioning features should be left at their
  1909. default settings.
  1910. </p>
  1911. <p class=func><span class=keyword>adcHighPassFilterFreeze</span>();</p>
  1912. <p class=desc>By default, the analog input (either line-level inputs or mic)
  1913. is high-pass filtered, to remove any DC component. This function
  1914. freezes the filter, so the DC component is still substracted, but
  1915. the filter stops tracking any DC or low frequency changes.
  1916. </p>
  1917. <p class=func><span class=keyword>adcHighPassFilterDisable</span>();</p>
  1918. <p class=desc>Completely disable the analog input filter. DC and sub-audible
  1919. low frequencies are allowed to enter the digital signal.
  1920. </p>
  1921. <p class=func><span class=keyword>adcHighPassFilterEnable</span>();</p>
  1922. <p class=desc>Turn the DC-blocking filter back on, if disabled, or
  1923. allows it to resume tracking DC and low frequency changes, if
  1924. previously frozen.
  1925. </p>
  1926. <p class=func><span class=keyword>dacVolume</span>(both);</p>
  1927. <p class=desc>Normally output volume should be used with volume(), which
  1928. changes the analog gain in the headphone amplifier. This function
  1929. controls digital attenuation before conversion to analog, which
  1930. reduces resolution, but allows another fine control of output
  1931. signal level. The ranges is 0 to 1.0, with the default at 1.0.
  1932. </p>
  1933. <p class=func><span class=keyword>dacVolume</span>(left, right);</p>
  1934. <p class=desc>Adjust the digital output volume separately on left and
  1935. right channels.
  1936. </p>
  1937. <h3>Audio Processor</h3>
  1938. <p>The optional digital audio processor is capable of implementing
  1939. automatic volume control, a
  1940. simple equalizer, filtering, bass enhancement and surround sound
  1941. is available.
  1942. </p>
  1943. <p>These signal processing features are implemented in the SGTL5000 chip,
  1944. so they do not consume CPU time on Teensy.
  1945. </p>
  1946. <p class=func><span class=keyword>audioPreProcessorEnable</span>();</p>
  1947. <p class=desc>Enable the audio processor to pre-process the input
  1948. (from either line-level inputs or microphone) before it's sent
  1949. to Teensy by I2S.
  1950. </p>
  1951. <p class=func><span class=keyword>audioPostProcessorEnable</span>();</p>
  1952. <p class=desc>Enable the audio processor to post-process Teensy's
  1953. I2S output before it's turned into analog signals for the
  1954. headphones and/or line level outputs.
  1955. </p>
  1956. <p class=func><span class=keyword>audioProcessorDisable</span>();</p>
  1957. <p class=desc>Disable the audio processor.
  1958. </p>
  1959. <p class=func><span class=keyword>eqFilterCount</span>(n);</p>
  1960. <p class=desc>blah blah blah blah
  1961. </p>
  1962. <p class=func><span class=keyword>eqSelect</span>(n);</p>
  1963. <p class=desc>blah blah blah blah
  1964. </p>
  1965. <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p>
  1966. <p class=desc>blah blah blah blah
  1967. </p>
  1968. <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p>
  1969. <p class=desc>blah blah blah blah
  1970. </p>
  1971. <p class=func><span class=keyword>eqBands</span>(bass, treble);</p>
  1972. <p class=desc>blah blah blah blah
  1973. </p>
  1974. <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p>
  1975. <p class=desc>blah blah blah blah
  1976. </p>
  1977. <p class=func><span class=keyword>autoVolumeControl</span>(maxGain, response, hardLimit, threshold, attack, decay);</p>
  1978. <p class=desc>blah blah blah blah
  1979. </p>
  1980. <p class=func><span class=keyword>autoVolumeEnable</span>();</p>
  1981. <p class=desc>blah blah blah blah
  1982. </p>
  1983. <p class=func><span class=keyword>autoVolumeDisable</span>();</p>
  1984. <p class=desc>blah blah blah blah
  1985. </p>
  1986. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p>
  1987. <p class=desc>blah blah blah blah
  1988. </p>
  1989. <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p>
  1990. <p class=desc>blah blah blah blah
  1991. </p>
  1992. <p class=func><span class=keyword>enhanceBassEnable</span>();</p>
  1993. <p class=desc>blah blah blah blah
  1994. </p>
  1995. <p class=func><span class=keyword>enhanceBassDisable</span>();</p>
  1996. <p class=desc>blah blah blah blah
  1997. </p>
  1998. <p class=func><span class=keyword>surroundSound</span>(width);</p>
  1999. <p class=desc>blah blah blah blah
  2000. </p>
  2001. <p class=func><span class=keyword>surroundSound</span>(width, select);</p>
  2002. <p class=desc>blah blah blah blah
  2003. </p>
  2004. <p class=func><span class=keyword>surroundSoundEnable</span>();</p>
  2005. <p class=desc>blah blah blah blah
  2006. </p>
  2007. <p class=func><span class=keyword>surroundSoundDisable</span>();</p>
  2008. <p class=desc>blah blah blah blah
  2009. </p>
  2010. <h3>Notes</h3>
  2011. <p>TODO: document the many audio processor features &amp; functions!
  2012. </p>
  2013. </script>
  2014. <script type="text/x-red" data-template-name="AudioControlSGTL5000">
  2015. <div class="form-row">
  2016. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2017. <input type="text" id="node-input-name" placeholder="Name">
  2018. </div>
  2019. </script>
  2020. <script type="text/javascript">
  2021. RED.nodes.registerType('AudioControlWM8731',{
  2022. shortName: "wm8731",
  2023. inputs:0,
  2024. outputs:0,
  2025. category: 'control-function',
  2026. color:"#E6E0F8",
  2027. icon: "arrow-in.png"
  2028. });
  2029. </script>
  2030. <script type="text/x-red" data-help-name="AudioControlWM8731">
  2031. <h3>Summary</h3>
  2032. <p>Control a WM8731 chip in slave mode, where it receives all clocks from Teensy</p>
  2033. <h3>Audio Connections</h3>
  2034. <p>This object has no audio inputs or outputs. Separate i2s objects
  2035. are used to send and receive audio data. I2S master mode objects
  2036. must be used, since this control object configures the WM8731 into
  2037. slave mode.
  2038. </p>
  2039. <h3>Functions</h3>
  2040. <p class=func><span class=keyword>enable</span>();</p>
  2041. <p class=desc>blah blah blah blah
  2042. </p>
  2043. <p class=func><span class=keyword>disable</span>();</p>
  2044. <p class=desc>not implemented
  2045. </p>
  2046. <p class=func><span class=keyword>volume</span>(level);</p>
  2047. <p class=desc>blah blah blah blah
  2048. </p>
  2049. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2050. <p class=desc>not implemented
  2051. </p>
  2052. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2053. <p class=desc>not implemented
  2054. </p>
  2055. <h3>Notes</h3>
  2056. <p></p>
  2057. </script>
  2058. <script type="text/x-red" data-template-name="AudioControlWM8731">
  2059. <div class="form-row">
  2060. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2061. <input type="text" id="node-input-name" placeholder="Name">
  2062. </div>
  2063. </script>
  2064. <script type="text/javascript">
  2065. RED.nodes.registerType('AudioControlWM8731master',{
  2066. shortName: "wm8731m",
  2067. inputs:0,
  2068. outputs:0,
  2069. category: 'control-function',
  2070. color:"#E6E0F8",
  2071. icon: "arrow-in.png"
  2072. });
  2073. </script>
  2074. <script type="text/x-red" data-help-name="AudioControlWM8731master">
  2075. <h3>Summary</h3>
  2076. <p>Control a WM8731 chip in master mode, where it controls all I2S timing.</p>
  2077. <h3>Audio Connections</h3>
  2078. <p>This object has no audio inputs or outputs. Separate i2s objects
  2079. are used to send and receive audio data. I2S slave mode objects
  2080. must be used, since this control object configures the WM8731 into
  2081. master mode.
  2082. </p>
  2083. <h3>Functions</h3>
  2084. <p class=func><span class=keyword>enable</span>();</p>
  2085. <p class=desc>blah blah blah blah
  2086. </p>
  2087. <p class=func><span class=keyword>disable</span>();</p>
  2088. <p class=desc>not implemented
  2089. </p>
  2090. <p class=func><span class=keyword>volume</span>(level);</p>
  2091. <p class=desc>blah blah blah blah
  2092. </p>
  2093. <p class=func><span class=keyword>inputLevel</span>(level);</p>
  2094. <p class=desc>not implemented
  2095. </p>
  2096. <p class=func><span class=keyword>inputSelect</span>(input);</p>
  2097. <p class=desc>not implemented
  2098. </p>
  2099. <h3>Notes</h3>
  2100. <p></p>
  2101. </script>
  2102. <script type="text/x-red" data-template-name="AudioControlWM8731master">
  2103. <div class="form-row">
  2104. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  2105. <input type="text" id="node-input-name" placeholder="Name">
  2106. </div>
  2107. </script>