Limits of delay effect in audio library

aaaxon

Active member
Could someone tell me roughly how long a delay is possible with the delay effect in the audio library? I'm building a hardware delay line for music synthesis and wondering whether the Teensy 3.1 is appropriate for longer delays (2000ms). I realize that other code will also consume memory. For this application, the only extra code would be instructions necessary for reading controls for real-time parameter changes.

Thanks very much for your help,
Michael
 
Could someone tell me roughly how long a delay is possible with the delay effect in the audio library?

About half a second delay is achievable.

The delay object consumes audio memory. Each block gives 2.9 ms. So in setup(), you'll need to use something like AudioMemory(180) to allocate enough memory. When you compile in Ardiuno, there's a summary of memory usage printed. The audio memory will consume the "global variables" memory. Buffers used by USB, SD and other stuff also consume memory. That summary is your best guide to seeing how much of the memory you're using up.
 
Paul,

Thanks for the quick reply! Is there a chance that the W25Q128FV memory chip could be used to extend delay time?
 
Paul,

Thanks for the quick reply! Is there a chance that the W25Q128FV memory chip could be used to extend delay time?
No, this is flashmemory. It takes 40 secs to erase it.
But you can use RAM. The 23lc1024 is pincompatible.
?..and of course, you have to write your own delay ()
Thw RAM is more than fast enough (spi 20MHz)
Its 128K - you could add more than one.
 
Last edited:
Yeah, a delay object using a 23LC1024 would be awesome. That's enough memory for almost 1.5 seconds. In tandem with the normal delay object, that'd make 2 second delay possible!

Just a small matter of programming......
 
Yeah, a delay object using a 23LC1024 would be awesome. That's enough memory for almost 1.5 seconds. In tandem with the normal delay object, that'd make 2 second delay possible!

Just a small matter of programming......

Maybe I do it, plus a version for the memoryboard.
Another nice thing could also be to generate an echo .. in a virtual room , like a church, a hall, or in the mountains (with a small number of "reflection surfaces"). Not with complicated math, a more simple version would be ok too.
But I hesitate a little to make it , I myself do not need it, and I'm no aware of any requests.
 
Last edited:
Frank,

I'd be very grateful if you would consider doing a simple version of the code. I think it would also get a lot of interest from others who are interested in using the Audio Board for music applications.

I'll be happy to order some memory chips and do any beta testing you might need. Are you planning to sell memoryboard PC boards? This looks as if it would allow an audio delay line even longer that 1500ms. Pretty neat.

Thanks,
Michael
 
Frank,

I'd be very grateful if you would consider doing a simple version of the code. I think it would also get a lot of interest from others who are interested in using the Audio Board for music applications.

I'll be happy to order some memory chips and do any beta testing you might need. Are you planning to sell memoryboard PC boards? This looks as if it would allow an audio delay line even longer that 1500ms. Pretty neat.

Thanks,
Michael

Hi Michael,

Yes, i don't know if it would be useful, but the delay could be several seconds - depends on the number of RAMs.
I already have some code for a FIFO over several RAMS - not public yet, because it's for my private mp3-streaming project.
Do you have some time ? I don't think that i can do much before september.

At the moment, I have no plans to sell the boards. This may change...
But I have single spare board + parts (msg me!) Where are you from ?

Frank
 
I have ordered some DIL memory chips and will use them to build my initial setup for testing on a stripboard.

But having six chips on one of franks memory boards would be great though.
 
I have ordered some DIL memory chips and will use them to build my initial setup for testing on a stripboard.

But having six chips on one of franks memory boards would be great though.


If there is enough interest, I can be produced 10 or 20 boards, and ordered the other parts, possibly from China. (This will take some time, and I do not know whether the RAM are cheaper there.)
Maybe I can also assemble a few - If you promise not to look at the solder joints.

The boards are compatible to the PJRC Audio boards and the ILI display, same size as the Teensy. They should be placed under the Teensy (because of the program-button).
 
I have the same question, but might be willing to go with a different approach. Is it possible to lower the bitrate or sample rate to extend the delay time? Just found this Teensy audio library and it looks incredible, really very feature rich and accessible compared to most audio libraries, but unfortunately a longer delay time is required for the particular project where I'd be keen to use it (delay pedal for guitar). I'd be wanting more than 4 seconds which might be completely unreasonable!
 
I have the same question, but might be willing to go with a different approach. Is it possible to lower the bitrate or sample rate to extend the delay time? Just found this Teensy audio library and it looks incredible, really very feature rich and accessible compared to most audio libraries, but unfortunately a longer delay time is required for the particular project where I'd be keen to use it (delay pedal for guitar). I'd be wanting more than 4 seconds which might be completely unreasonable!

No.. But 4 secs fit into 3x 23LC1024 RAMs.. No problem.
 
Frank, how would you feel about yet another minor memory board revision?

Currently pins 8, 16, 17 are used for chip selects. Perhaps we should consider pin 4, 5, 8?

Pins 16 & 17 are the 2 special ADC inputs that can be used with ADC0 and ADC1. All the other analog pins on the edge are ADC0 only. Future library versions will probably add a stereo ADC object using those 2 pins.

Then again, maybe the extra memory board will be used only with the audio board?
 
Ok, I can do a new revision. It fun to work with eagle :)

There is a variant 23LCV1024, would it make sense to support its "Battery Backup" feature ?
 
Does anyone have any objection to pins 2,3,4 ?
Ok , obviously not.

Link to the OSH-Park shared-project:[Edit: removed]

2 layer board of 0.73x1.42 inches (18.52x36.04mm) 5.15$ for 3.

Edit:
IMPORTANT: This Revision is NOT tested. I don't have it ! I ordered it yesterday, and i can say more in a few weeks.
So, it's a bit risky to order it.
 
Last edited:
Link to the OSH-Park shared-project: https://oshpark.com/shared_projects/KZt5PaU7

2 layer board of 0.73x1.42 inches (18.52x36.04mm) 5.15$ for 3.

Can't wait to play with this! Eight seconds or so of sound to repeat/modulate is going to be great.

I can infer what the six identical chips are. Is there a parts list somewhere indicating what the other two chips and caps / resistors are so I can check my parts bins before I order?

EDIT: thanks for the parts list, Github link, and warning below. I think I'll get the parts (unlikely to change much) and wait for the verdict on the board before ordering.
 
Last edited:

Thats correct, but without LED and 1K Resistor:

Partslist:
•6 x SPI jedec Memory (e.g. 23LC1024 SOIC-8)
•1 x 74LCX126MX SOIC-14
•1 x 74LCX138MX SOIC-16
•6 x Capacitor 0.1uF
•3 x Resistor 10K

IMPORTANT: This revision is NOT tested. I don't have it ! I ordered it yesterday, and i can say more in a few weeks.
So, it's a bit risky to order it.

Pls understand: in this untested state, I don't want that too many people buy it, really.
I delete the link in a few hours.
 
Last edited:
I've started work on a delay object to support long delays with a single 23LC1024 chip and Frank's 6 chip Memoryboard.

https://github.com/PaulStoffregen/Audio/commit/df633c3b1b49afbee785735fc38486a1558fae21

Functionally, this is meant to work just like the internal delay object, where the delay can be accessed with up to 8 taps.

The object constructor allows you to specify which type of memory, and how much to use. If you omit the amount, by default it'll try to use the whole memory. Of course, the actual delays for each tap are specified when you activate each channel, so the amount of memory the object uses is the maximum possible delay.

For example, if you have a 23LC1024 chip, which can provide 1458 ms of delay, you could create 2 delay object like this:

Code:
AudioEffectDelayExternal   dly1(AUDIO_MEMORY_23LC1024, 720);
AudioEffectDelayExternal   dly2(AUDIO_MEMORY_23LC1024, 720);

If you wanted to delay both channels of a stereo signal, you would create 2 objects which each allocate half the chip's memory. You can create any number of delay objects, each providing 8 configurable taps anywhere within their delay capability. Of course if you ask for more delay than the hardware can provide, it'll truncate your request to the maximum possible with the memory available.

At least that how it's supposed to work. Right now, the code is doing a test using an array in internal RAM. The last part left to do is filling in the read(), write() and zero() functions for the actual hardware. I'm going to try doing the 23LC1024 soon. Later when Frank's board arrives, hopefully filling in those 3 functions for his hardware will be fairly simple.
 
Last edited:
Ok, I've added the 23LC1024 support code.

https://github.com/PaulStoffregen/Audio

Here's a simple test I've been using to output a couple waveforms....

file2.png file1.png

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


AudioSynthWaveformSine     sine;
AudioEffectEnvelope        env;
AudioEffectDelayExternal   dly1(AUDIO_MEMORY_23LC1024, 50);
AudioEffectDelayExternal   dly2(AUDIO_MEMORY_23LC1024, 270);
AudioMixer4                mix;
AudioOutputI2S             headphones;

AudioConnection            patchCord1(sine, env);
AudioConnection            patchCord2(env, dly1);
AudioConnection            patchCord3(env, dly2);
AudioConnection            patchCord4(dly1, 0, mix, 0);
AudioConnection            patchCord5(dly2, 0, mix, 1);
AudioConnection            patchCord6(env, 0, headphones, 0);
AudioConnection            patchCord7(mix, 0, headphones, 1);

AudioControlSGTL5000 audioShield;

// Use these with the audio adaptor board
#define SDCARD_MOSI_PIN  7
#define SDCARD_SCK_PIN   14

void setup() {
        AudioMemory(10);

        SPI.setMOSI(SDCARD_MOSI_PIN);
        SPI.setSCK(SDCARD_SCK_PIN);

        audioShield.enable();
        audioShield.volume(0.7);

        sine.amplitude(0.9);
        sine.frequency(1200);

        dly1.delay(0, 0.5);
        dly2.delay(0, 122);
}

void loop() {
        env.noteOn();
        delay(50);
        env.noteOff();
        delay(250);

        Serial.print("loop ");

        Serial.println();

}
 
Here's another one, using the full 1.48 seconds of the 23LC1024 chip.

file.png

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


AudioSynthWaveformSine     sine;
AudioEffectEnvelope        env;
AudioEffectDelayExternal   dly;
AudioOutputI2S             headphones;

AudioConnection            patchCord1(sine, env);
AudioConnection            patchCord2(env, dly);
AudioConnection            patchCord6(env, 0, headphones, 0);
AudioConnection            patchCord7(dly, 0, headphones, 1);

AudioControlSGTL5000 audioShield;

void setup() {
        AudioMemory(10);
        audioShield.enable();
        audioShield.volume(0.7);
        sine.amplitude(0.9);
        sine.frequency(800);
        dly.delay(0, 1500);
}

void loop() {
        env.noteOn();
        delay(100);
        env.noteOff();
        delay(12000);
}
 
Looks good !

Maybe its worth to try SPI-DMA. I measured speed-improvements - mainly because interrupts can be processed parallel to the dma transfer. That was with larger blocks, >1K and with my audiocodecs, which spend long time in Interrupts.
But it's helpful in every case i think, even if the profit is not so high.
 
Impressive, love it :).

There seems to still be some missing code for address wrap around when the allocated memory is not the full chip.

Do you have timings, home much time is consumed by the SPI ?
 
Back
Top