Arduino uno audio delay project

Hi everyone!

i want to make an audio delay tool, and i have never worked with ad and da converters. i learned quite a bit from PCF8591 datasheet, but i still have many questions.

my idea is to take two PCF8591 chips, one to do the a to d and other one from d to a conversion and a ram memory to store the digital audio signal for a short time... i'm thinking from 0 to 1 sec.

here comes in the arduino uno. i need it to drive both chips, and i heaven't done research on RAM chips, but i'm guessing that too
so i was wondering what frequency do i need to run those chips to achieve listenable audio signal, and is the 4 MHz frequency (from attiny) enough?
has anyone done this before?
how do i calculate the max delay i can get? (im guessing it would have to be the amount of memory i have devided by the frequency times the amount of bytes i send)

o i was wondering what frequency do i need to run those chips to achieve listenable audio signal, and is the 4 MHz frequency (from attiny) enough?

4MHz is overkill for audio (Typical bandwidth of audio is 20kHz)

However, assuming you plan on using the Tiny's own ADC to sample the audio, you won't be able to achieve much better than telephony quality (3kHz bandwidth)

Also have a look at dual port RAM, it will allow you to write data to it from the ADC, and read it out to the DAC at different rates.

4MHz is overkill for audio (Typical bandwidth of audio is 20kHz)

However, assuming you plan on using the Tiny's own ADC to sample the audio, you won't be able to achieve much better than telephony quality (3kHz bandwidth)

well i was going to use PCF8591 for conversion. http://www.nxp.com/documents/data_sheet/PCF8591.pdf
does that mean that i can get the 20kHZ frequency?

8 bit audio will sound awful whatever the sample rate.

Kitax:
does that mean that i can get the 20kHZ frequency?

No, see attached below (from PCF8591).
Plus, where are you going to store the samples?
The Arduinos don't have much RAM.

EDIT:

Since the max sample rate is 11KHz, it means your max input frequency is just over 5KHz, couple this with the 8 bit resolution and it will sound pretty dreadful.

ConvSpecs.jpg

well i want it to delay human voice, so the 5 kHz max frequency isnt bad i guess.

as for the 8-bit sound, i think i just need to make it understandable, so i think that will work as well

i am going to use a RAM chip because i know that arduino doesnt have much RAM

(have you ever tried to talk while hearing your voice with a delay? it is really hard, and that is what i am trying to make, headphones that delays your voice and plays it back, so i guess the 8-bit sound would do just fine)

I think there's a smartphone app for just that purpose - it is supposed to help stammerers.
Wiring RAM is going to gobble up pins.

well i have to make a school project, and im considering this one

i heavent actually looked into ram yet, but i will. i think, that the one attiny 2313 can drive all 3 of the chips, but if it cant i guess i can just get another one, i guess...

18 IO pins:
reset
serial in for debug
serial out for debug
xtal 1 need to use external crystal for 16 or 20MHz operation
xtal 2
leaves 13 pins
SCK, MISO, MOSI - needed for high speed transfers to ADC, DAC, SRAM
ADC chip select
DAC chip select
SRAM chip select
down to 7 pins

So IO wise you would seem to be okay.
However, look at these numbers for 2313:
– 2K Bytes of In-System Self Programmable Flash
– 128 Bytes In-System Programmable EEPROM
– 128 Bytes Internal SRAM

I think you will really struggle to get your code working with that few resources.

i think one of these would be a good ram for this project, but i dont really know... im gonna have to do research on them and on ram chips... i heavent really used them before. maybe you could introduce me or give some links to where i could read about them?

https://www1.elfa.se/data1/wwwroot/assets/datasheets/fm24c64b_eng_ds.pdf
https://www1.elfa.se/data1/wwwroot/assets/datasheets/zsLyontek_SRAM-LY6264_EN.pdf

Admittedly I haven't looked in detail at the chips you provided links for, but one thing to keep in mind, whenever you use a chip that may be a bit more specialized, always first check availability and price before committing any time or effort to a design that uses the part.

UnoDueTre:
Admittedly I haven't looked in detail at the chips you provided links for, but one thing to keep in mind, whenever you use a chip that may be a bit more specialized, always first check availability and price before committing any time or effort to a design that uses the part.

already did it... i chose these chips because they are available for a reasonable price, and i picked 2 different ones of which i think at least one would work for me, and this time i guess it will be

https://www1.elfa.se/data1/wwwroot/assets/datasheets/fm24c64b_eng_ds.pdf

That would be a good RAM for Storing data.
Your code will not execute from that RAM tho - only from the internal SRAM, the 128 bytes in a '2313 that are used for registers and stuff.

CrossRoads:
That would be a good RAM for Storing data.
Your code will not execute from that RAM tho - only from the internal SRAM, the 128 bytes in a '2313 that are used for registers and stuff.

i know that... preveously i said about storing the 8 bit audio i converted to play it a bit later (a few microseconds or so, preferably up to second, but i know it is quite a bit of data and i dont know exactly how much delay i can get from it) the whole point of the conversion is to get that delay. i just wanted to play around with DAC and ADC and data storage to get better knowlage of how they work.

user named UnoDueTre, posted a picture of exactly what i wanted to make from the beginning

Dual port RAM not really needed, Arduino can only read or only write at 1 time.
So read ADC, write to RAM, at later time read from RAM and write to DAC.
If you had parallel address/data, then data could be present on ADC output and used as RAM data input while Arduino provided address lines. Then same for reading the RAM - Arduino provides the address while data from RAM was latched directly in to the DAC.
Serially, things will be slower of course. For best results use SPI capable parts.

CrossRoads:
Dual port RAM not really needed, Arduino can only read or only write at 1 time.

True, but makes it much easier if one wants to have a ring buffer where the sampled audio from the ADC is fed to one port of the RAM and it's available at the other port for playback so would minimize code overhead especially if the OP was using parallel ADC and DAC.

Agreed. Took a look at Dual port SRAM tho - ridicuoulsy expensive, even for small chips
http://www.digikey.com/product-search/en/integrated-circuits-ics/memory/2556980/page/3?k=dual%20port%20ram&stock=1&ColumnSort=1000011
Large parallel SRAM much cheaper - couple of x8 chips, couple of shift registers loaded via SPI, or maybe counters that are incremented to hold the address, kind of a roll your own dual-port SRAM at much less cost.

One pair to hold the write address, one pair to hold the read address.

Wow, they are like 30 bucks each on average.
I used some dual port RAM several years back and expected them to be around the 5 or 10 buck mark by now.

I like the idea of rolling your own.

EDIT:

Found some as low as 4 bucks at Future Electronics

http://www.futureelectronics.com/en/Search.aspx?dsNav=Ntk:PlainTextSearch|dual+port|3|,Ny:True,Nea:True,N:749

Here is one at 12 bucks which is 8K X 8 which would give the OP about 1 sec worth of sampling (as he original asked for) at a rate of 8KHz.

Although once we get to the $12 mark, it's probably easier to just get one of these:

http://ruggedcircuits.com/html/megaram.html