CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PCM??? WAV files use it??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Spiffy



Joined: 21 Jan 2004
Posts: 12

View user's profile Send private message Send e-mail MSN Messenger

PCM??? WAV files use it??
PostPosted: Thu Jan 29, 2004 1:03 pm     Reply with quote

First off thanx for clicking on my topic Cool
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!! Smile

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

View user's profile Send private message

idea
PostPosted: Thu Jan 29, 2004 2:18 pm     Reply with quote

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!!!!!" Laughing

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

View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Re: PCM??? WAV files use it??
PostPosted: Fri Jan 30, 2004 3:50 am     Reply with quote

Spiffy wrote:
First off thanx for clicking on my topic Cool
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!! Smile

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

View user's profile Send private message

another link
PostPosted: Fri Jan 30, 2004 11:28 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group