Audio Delay

Hello there,
I try to make an audio delay with one teensy 1.0, a dac and an adc.

Now to test the circuit i just want that the Byte from pins B0-B7 on the teensy are given over to the PORT D (D0-D7)

To do this kind of byte bypass I tried the following code:

void setup() {
 DDRD = 0xff; // set PORTD to all outputs - digital pins 0 - 7
 DDRB = 0x00;
}

void loop() {
 PORTD = PINB; // play back sample    
}

Is there anything wrong with this code? It should just make PORTD the same as PORTB

-Flo

That looks OK to me. I tried that out and it worked.

You won't be getting much delay with < 2k of RAM though.


Rob

He would be introducing about a 250 nS delay there, maybe less.

Yep, we need to know what this is for because audio delay lines are normally in the seconds.


Rob

hello,
thank you for your answers. Well i didnt think about the memory yet.
Is it possible to use an sd card or external memory on dip chips??
even if the sd card is slow in reading and writing i have the buffer of the internal memory ...

edit : i just looked in the datasheet of the at90usb162 from atmel. it has 16kb internal flash memory.

if I just handle 8 bit data with a sample speed of 48kHz this menas i would have 16/48 (about 330ms) seconds sampletime if i think the right way.
thats something to start with i think.

-Flo

i just looked in the datasheet of the at90usb162 from atmel. it has 16kb internal flash memory.

And did the datasheet tell you what the programming speed and write/erase lifetime was?

thats all i know. i could not find anything concerning the memory speed.
the external memory thing should work if it is too slow or what is wrong with this idea?

btw: i just read that flash memory will die after about 10 000 times deleting a bit, does this mean arduinos and other micro controllers will die after being on for a while?

Well, for starters , the flash memory is program memory, and is only writable from the boot area (assuming the device supports self-programming), and secondly, it's only normally rated for 10 000 erase/write cycles.

Datasheet

well what opportunities do i have to record those samples than?

Not a lot, I suspect. A Mega with a QuadRam shield perhaps?

isnt it possible to just use a slower memory type like sd cards (how fast is it actually?) and buffer the samples in the internal memory, so there is more time to save them on the external memory.

so there is more time to save them on the external memory.

You have to read and store your input samples, and read and write out your output samples in under 21us average.
Do the arithmetic.

yeah but to do it i need to know how fast the sd write and read process it , this is what i cannot find

A further little thought-experiment.
Assume you'll need double-buffered input and output of a minimum of one sector each.
That's 2048 bytes just for the buffers.

This buys you 21 * 512 = just under 11ms.

perhaps i can use it also for the teensy : http://ruggedcircuits.com/html/quadram.html

Not.
No "perhaps".

Flub:
isnt it possible to just use a slower memory type like sd cards (how fast is it actually?) and buffer the samples in the internal memory, so there is more time to save them on the external memory.

I thought that was the theory and best approach ?!?! Or have i missed summat ?!

It might be, if you had some form of DMA to get the data to/from the SD card and not tie up the processor.
Sadly...

http://majolsurf.net/wordpress/?page_id=1001

i ll take a closer look to this