Go Down

Topic: Audio Delay (Read 4 times) previous topic - next topic

Flub

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:
Code: [Select]

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

Nick Gammon

That looks OK to me. I tried that out and it worked.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Graynomad

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

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Nick Gammon

He would be introducing about a 250 nS delay there, maybe less.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Graynomad

#4
Apr 27, 2012, 05:25 am Last Edit: Apr 27, 2012, 02:00 pm by Graynomad Reason: 1
Yep, we need to know what this is for because audio delay lines are normally in the seconds.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Flub

#5
Apr 27, 2012, 12:40 pm Last Edit: Apr 27, 2012, 12:46 pm by Flub Reason: 1
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

AWOL

Quote
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?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Flub

#7
Apr 27, 2012, 03:51 pm Last Edit: Apr 27, 2012, 03:56 pm by Flub Reason: 1
http://www.atmel.com/devices/at90usb162.aspx?tab=parameters

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?

AWOL

#8
Apr 27, 2012, 03:53 pm Last Edit: Apr 27, 2012, 03:55 pm by AWOL Reason: 1
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
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Flub

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

dxw00d

Not a lot, I suspect. A Mega with a QuadRam shield 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.

AWOL

Quote
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.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Flub

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

AWOL

#14
Apr 27, 2012, 04:27 pm Last Edit: Apr 27, 2012, 04:29 pm by AWOL Reason: 1
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.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up