We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
Just after some help with the ARM LPC2378. Any help would be great. What i'm trying to do is take a .wav file, strip the data out of it then feed it in the DAC.
I've succeeded in stripping the .wav file into hexadecimal format. Each sample is 8 hex values. For example one construct might look like this.
const int soundStream[] = { 0xffffffcb,0xfffffffd,0x4c,0xffffffc4};
There is a lot more samples than above, that's just an example of what i'm trying to feed into the DAC.
Then I take these values to an interrupt handler set to 8khz. (8000 ticks per second I believe that equates too). Each value in the array is feed into the DAC one at a time after a bit of bit-shifting is used.
//i is incremented every time the ISR is fired DA_val = ((soundStream[i] >> 15) + 0x8000) & 0xFFFF;
Then I feed this value into the dac register.
I was hoping this would mean it would work. However all i get are a series of clicks. I'm wondering why this is. I've taken a look at the ARM voiceplayer example provided by Keil and they seem to feed the values all at once, which doesn't make sense when recreating a PCM(pulse code modulation) sine wave?...
Perhaps i'm getting confused and need to be pointed in the right direction. Maybe the DAC reads the values all at once? I've tried this and I get that my constant which holds the raw values is too large! I'm not sure what I'm doing wrong and could really do with a helping hand.
The fact that I'm getting clicks seems to be mean that I'm on the right track. (The DAC is understanding the values i'm putting into it). It seems to be my "feeding" mechanism which is wrong.
I can't use the ARM itself for ripping the files data as my overall system will not permit this. (The stripping of the .wav file cannot be done on the ARM).
Cheers for any help,
Slev
Yes, the sample rate is 8000/second. I've created an external program that reads the header file. It seems to be correct. I think my problem is that I'm not reading the values in chunks, instead i'm reading them value by value, this might explain why i'm getting just a constant tone, instead of varied noises?
I've been looking at the specification for the .wave files again and it seems to mention bits per sample. Does it matter that i'm filtering the values through at 8 bits when the header files says it is 16bits per sample? (values ranging from -127 to 127), (or 0xFFFF instead of 0xFF)
Also could this bring up a constraint seeming the DAC is a 10 bit DAC?...Could it be a question of converting the file or trying to find a .wav file that is under 10 bits per sample?
Anyone out there with some algorithms or suggestions would be awesome!
I think I would go a little crazy if this was the reason it wasn't working!!
Cheers