View previous topic :: View next topic |
Author |
Message |
Spiffy
Joined: 21 Jan 2004 Posts: 12
|
PCM??? WAV files use it?? |
Posted: Thu Jan 29, 2004 1:03 pm |
|
|
First off thanx for clicking on my topic
Good mourning, Good afternoon and good evening,
I'm in the process of making an electronic drum and I need to know how I can write a WAV file in a EEPROM memory. I know how to write on my memory but is it any different if I wannna write a WAV file?? Do I need to use PCM builder or is it doable with CCS only??? I need some information on it cuz I don'T what the hell I'm doing!!
Thanx a bunch to the person who has the common descency of sharing his knowledge with a fellow programmer *pat on the back* |
|
|
neil
Joined: 08 Sep 2003 Posts: 128
|
idea |
Posted: Thu Jan 29, 2004 2:18 pm |
|
|
Ha! your compliments have persuaded me to try and (attempt) to answer this one!!
Last year I designed a piece of equipment which uploads data to a 64Kx16bit SRAM which is then clocked through a 16-bit DAC. This was to produce a periodic waveform. I had a crazy (time wasting) idea of putting some raw PCM audio into it and connecting a speaker to one of its buffered outputs! I chose Electric 6's "Danger High Voltage", seemed quite fitting!
I searched on the net for info on the structure of a WAV file and worked out how to strip off the file header and extract the raw data.
I created a 16-bit mono pcm WAV, at 11.025KHz. This gave 65536/11025 = approx 6 seconds of audio in my RAM size. I wrote a C program for the PC which opened the file, searched for the end of the header and wrote the raw data to a new file. I had to swap the byte order around because intel use little endian format (low byte 1st) and my system used big endian. I used a structure and union to manipulate the data bytes and words. I then uploaded the data to my RAM via RS232 and hey presto... "Danger Danger... high voltage!!!!!"
I lost the PC program when my hard drive died. I had not backed it up, but it was a simple program to write. I will try to find the website with the WAV file information.
I am telling you this as a method, rather than a solution. There may be a much easier way of doing this, but this is how I did it.
bonne chance!
Neil. |
|
|
Pete Smith
Joined: 17 Sep 2003 Posts: 55 Location: Chester, UK
|
Re: PCM??? WAV files use it?? |
Posted: Fri Jan 30, 2004 3:50 am |
|
|
Spiffy wrote: | First off thanx for clicking on my topic
Good mourning, Good afternoon and good evening,
I'm in the process of making an electronic drum and I need to know how I can write a WAV file in a EEPROM memory. I know how to write on my memory but is it any different if I wannna write a WAV file?? Do I need to use PCM builder or is it doable with CCS only??? I need some information on it cuz I don'T what the hell I'm doing!!
Thanx a bunch to the person who has the common descency of sharing his knowledge with a fellow programmer *pat on the back* |
You could try this page
http://centauri.ezy.net.au/~fastvid/picsound.htm
HTH
Pete. |
|
|
neil
Joined: 08 Sep 2003 Posts: 128
|
another link |
Posted: Fri Jan 30, 2004 11:28 am |
|
|
That 1-bit audio looks cool, I'm working on getting some sound out now!
For my original idea, I got my raw data into the PIC over RS232. The PIC could be used with say XON/XOFF handshaking to get raw data into an EČPROM using this little gem I found.... Download 'Sendfile' from: http://www.taltech.com/TALtech_web/freesoftware/fs_sw.htm#otherThis took a lot of finding, but it is a great little no-nonsense app.
I didn't need handshaking as I was loading into SRAM which can operate much faster than RS232, but you will need it for the slow write times of EČ.
A word of advice... NEVER use hyperterminal to send raw data (as text file) it has big problems driving the PC's serial port properly, it misses data, has buffer underruns and generally operates very slowly. (I have seen very large gaps between frames. This Sendfile app sends at maximum speed and I have never seen it miss data!
For viewing data, I personally like CCS's 'siow' given with the compiler!
Neil. |
|
|
|