the 168 based arduino's have 16k of storage, which even on a good day lets say you had half of that ... which is roughly 1sec of 8bit/8khz audio (im assuming 1byte x 8000 = ~8k/sec)
so i'm going to try and store the audio on a spi interfaced eeprom like the arduino tutorial.
.... so i guess i have some questions on the best way to go about this.
i figure there are a few approaches
have the arduino fetch the entire eeprom sample, then play the sample ... this would run into the arduino's memory limitations. and limit it to very short clips of sound ... possibly not too bad with the 1-bit sound alternative.
play/fetch the data at the same time, im assuming only fetching what it needs to play in that time frame
... i guess i don't have a real good idea of what the arduino is capable of speedwise, and what the eeprom is capable of (at the moment i just have the eeprom that is in the arduino tutorial). lets say i do the simplest play loop, 8000 iterations a second for 8khz audio im assuming and only fetch one byte of storage then play it each iteration ... will i hit a brick wall in both the arduino's processing, and the eeprom's ability to fetch etc...?
if so, what are some of the preferred methods to get around this? fetch larger chunks ... offload tasks to other arduinos, use other chips better suited?
for our example lets say i just have some pushbuttons, an arduino168, a AT25HP512 (64k eeprom), an amplifier and a speaker. function being to play a different portion of the eeproms stored data on different button presses.
Futurlec has a 16M flash board which sounds better than your approach of using EEPROM.
8khz gives you quite a few cycles (2,000) spare when running at 16mhz.
You should be able to read in to a buffer when required without too many problems.
You can also replace the crystal with a 20mhz one for even more spare cycles.
I think you may find that performance limitations of analogWrite will severely restrict your frequency response. There is an excellent article on options for sound generation here Arduino Sound – Part 1 – uCHobby
it looks like someone has found a way around the analogwrite problems:
the article writer offered:
"I have not done the experiment yet. I plan to hijack a timer and do PWM control without the built in Arduino functions. The rate needs to be increased to well above audio, say 50KHz. I have not checked into what resolution would remain for duty cycle control. If all goes to plan this could be the best solution for high quality sound output but I don't see it being used much so there must be some problems."
i imagine bit banging the 1-bit converted waveforms through romanblack's resistor/capacitor solution will probably be best in terms of ease and storage. i will look into r2r and hardware dac's (im not against buying a seperate dac ic) ... im assuming the resistor/capacitor solution is a basic dac as well.
thanks for the storage link, if i get the eeprom stuff working ill definitely want to get one of those.
I am in the beginning stages of work on a simple Arduino-controlled drum machine. I would like to play back very short samples (each drum sample would be at most .5 seconds)