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.

93 lines
4.8KB

  1. <h3>Summary</h3>
  2. <div>
  3. <p>Delay a signal, using external memory for longer delay times! Up to 8 separate delay taps can be used.</p>
  4. <p align=center><img src="img/delay.png"><br><small>1 kHz burst, delayed 5.2 ms.</small></p>
  5. </div>
  6. <h3>Audio Connections</h3>
  7. <table class=doc align=center cellpadding=3>
  8. <tr class=top><th>Port</th><th>Purpose</th></tr>
  9. <tr class=odd><td align=center>In 0</td><td>Signal Input</td></tr>
  10. <tr class=odd><td align=center>Out 0</td><td>Delay Tap #1</td></tr>
  11. <tr class=odd><td align=center>Out 1</td><td>Delay Tap #2</td></tr>
  12. <tr class=odd><td align=center>Out 2</td><td>Delay Tap #3</td></tr>
  13. <tr class=odd><td align=center>Out 3</td><td>Delay Tap #4</td></tr>
  14. <tr class=odd><td align=center>Out 4</td><td>Delay Tap #5</td></tr>
  15. <tr class=odd><td align=center>Out 5</td><td>Delay Tap #6</td></tr>
  16. <tr class=odd><td align=center>Out 6</td><td>Delay Tap #7</td></tr>
  17. <tr class=odd><td align=center>Out 7</td><td>Delay Tap #8</td></tr>
  18. </table>
  19. <h3>Functions</h3>
  20. <p class=func><span class=keyword>delay</span>(channel, milliseconds);</p>
  21. <p class=desc>Set output channel (0 to 7) to delay the signals by
  22. milliseconds. The maximum delay is approx 333 ms. The actual delay
  23. is rounded to the nearest sample. Each channel can be configured for
  24. any delay. There is no requirement to configure the "taps" in increasing
  25. delay order.
  26. </p>
  27. <p class=func><span class=keyword>disable</span>(channel);</p>
  28. <p class=desc>Disable a channel. The output of this channel becomes
  29. silent. If this channel is the longest delay, memory usage is
  30. automatically reduced to accomodate only the remaining channels used.
  31. </p>
  32. <h3>Hardware</h3>
  33. <p>By default, or when <span class=literal>AUDIO_MEMORY_23LC1024</span> is used (see below),
  34. a single 23LC1024 RAM chip is used, with these pins:
  35. <table class=doc align=center cellpadding=3>
  36. <tr class=top><th>Pin</th><th>Signal</th></tr>
  37. <tr class=odd><td align=center>6</td><td>CS</td></tr>
  38. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  39. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  40. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  41. </table>
  42. </p>
  43. <p>When <span class=literal>AUDIO_MEMORY_MEMORYBOARD</span> is used, up to six
  44. 23LC1024 chips are used.
  45. </p>
  46. <p align=center><img src="img/memoryboard.jpg"><br><small><a href="https://oshpark.com/shared_projects/KZt5PaU7" target="_blank">Memoryboard 4</a></small></p>
  47. <p>
  48. <table class=doc align=center cellpadding=3>
  49. <tr class=top><th>Pin</th><th>Signal</th></tr>
  50. <tr class=odd><td align=center>2</td><td>CS0 (encoded)</td></tr>
  51. <tr class=odd><td align=center>3</td><td>CS1 (encoded)</td></tr>
  52. <tr class=odd><td align=center>4</td><td>CS2 (encoded)</td></tr>
  53. <tr class=odd><td align=center>7</td><td>MOSI</td></tr>
  54. <tr class=odd><td align=center>12</td><td>MISO</td></tr>
  55. <tr class=odd><td align=center>14</td><td>SCK</td></tr>
  56. </table>
  57. </p>
  58. <p>
  59. If fewer than 6 chips are soldered, the optional parameter for maximum delay
  60. must be used. See below for details. Each chip provides 1485 ms of delay
  61. memory, so the total of all objects using AUDIO_MEMORY_MEMORYBOARD must not
  62. exceed the amount of memory physically present.
  63. </p>
  64. <h3>Examples</h3>
  65. <p>
  66. <a href="https://www.youtube.com/watch?v=d80d1HWy5_s" target="_blank">Demo Video</a> (YouTube)
  67. </p>
  68. <!-- <p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Delay
  69. </p> -->
  70. <p>
  71. <a href="https://forum.pjrc.com/threads/29276-Limits-of-delay-effect-in-audio-library?p=79436&viewfull=1#post79436" target="_blank">Forum Conversaton</a> (with sample code)
  72. </p>
  73. <h3>Notes</h3>
  74. <p>External RAM allows for longer delays without consuming
  75. limited internal RAM. However, SPI communication is required,
  76. which consumes much more CPU time. The
  77. <a href="http://www.pjrc.com/teensy/td_libs_AudioProcessorUsage.html">AudioProcessorUsageMax</a>
  78. function may be used to monitor how much CPU time is consumed.
  79. </p>
  80. <p>You may specify the type of hardware to be used by editing the code. AUDIO_MEMORY_23LC1024
  81. specifies a single 23LC1024 chip. AUDIO_MEMORY_MEMORYBOARD allows using up to 6 of these
  82. chips.
  83. </p>
  84. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>);
  85. </p>
  86. <p>You may also create more than one delay using the same hardware, where the memory is partitioned
  87. by specifying a maximum delay in milliseconds. This can be useful if you wish to delay both
  88. channels of a stereo signal.
  89. <p class=desc><span class=keyword>AudioEffectDelayExternal</span> delayExt1(<span class=literal>AUDIO_MEMORY_23LC1024</span>, 700);<br><span class=keyword>AudioEffectDelayExternal</span> delayExt2(<span class=literal>AUDIO_MEMORY_23LC1024</span>, 700);
  90. </p>