Pages: [1]   Go Down
Author Topic: eeprom as source of pcm or 1-bit sampled audio  (Read 1053 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im looking into using the arduino to play back sampled audio, i already know the quality won't be fantastic.

so far i've seen a couple ways of potentially storing the data, either as say 8bit 8khz pcm, or 1-bit audio http://www.romanblack.com/picsound.htm

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

1) 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.

2) 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.
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Futurlec has a 16M flash board which sounds better than your approach of using EEPROM.
http://www.futurlec.com/Mini_FLASH.shtml

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.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 http://www.uchobby.com/index.php/2007/11/11/arduino-sound-part-1/
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for the advice keep it coming smiley-grin

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."

a user solutions: http://www.arduino.cc/playground/Code/PCMAudio

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.

« Last Edit: February 06, 2008, 11:48:17 am by unsped » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm wondering if you got your circuit working?

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)


Logged

Pages: [1]   Go Up
Jump to: