Cracks instead of delay

Status
Not open for further replies.

feklee

Active member
I have a Teensy 3.6 with the Audio Shield and RAM (23LC1024T-I/SN 全新芯片SOIC8IC SRAM 1M SPI 20MHZ 8SOIC):

setup.jpg
RAM.jpg

When I delay the microphone input, I hear cracks if the delay is greater than about 10. Is this is a hardware issue, or am I missing something?

The sketch:

delay.png

Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=194.00004196166992,333.00004959106445
AudioEffectDelay         delay1;         //xy=454,324
AudioOutputI2S           i2s2;           //xy=639.000020980835,284.00000953674316
AudioConnection          patchCord1(i2s1, 0, delay1, 0);
AudioConnection          patchCord2(delay1, 0, i2s2, 0);
// GUItool: end automatically generated code

AudioControlSGTL5000 audioShield;

const int myInput = AUDIO_INPUT_MIC;

void setup() {
  AudioMemory(10);
  audioShield.enable();
  audioShield.volume(0.7);
  delay(1000);
  audioShield.inputSelect(myInput);
  audioShield.micGain(24);
}

void loop() {
  delay1.delay(0, 100); // with delay up to ~10, the sound is clean
  delay(500);
}
 
From the notes in the GUI tool:

"Memory for the delayed signal is take from the memory pool allocated by AudioMemory(). Each block allows about 2.9 milliseconds of delay, so AudioMemory should be increased to allow for the longest delay tap."

Also if you are wanting to use the SRAM for the delay, you need to use the delayExt object.
 
From the notes in the GUI tool:

"Memory for the delayed signal is take from the memory pool allocated by AudioMemory(). Each block allows about 2.9 milliseconds of delay, so AudioMemory should be increased to allow for the longest delay tap."

Thanks, that's it! Sorry for not reading the documentation thoroughly. I was following Paul's video Teensy Audio Library, Delay Line Demo with (0:27):
Code:
AudioMemory(10);

Also if you are wanting to use the SRAM for the delay, you need to use the delayExt object.
What RAM is my sketch then using? Also, what is the advantage of using SRAM?
 
Each audio object by default uses the processor's internal RAM. The audio objects have to be specially hand-coded to take advantage of external SRAM. The large external SRAM would allow for longer delay times than the internal RAM could support.
 
Thank you! Well I only need 500 ms of delay, and the sketch is small, so I guess getting the RAM was superfluous.

Anyhow, I added a comment to the aforementioned YouTube video, which may be helpful for others.
 
Status
Not open for further replies.
Back
Top