Wav sound file to IC

Status
Not open for further replies.

jonathan

New Member
I am looking for a way to record sounds from my PC to a Wav file and get them to a flash memory IC. I think I can get the data there, but I'm not sure how to play the sound after its on the IC. I don't want to use MP3 because the decoders are expensive and since I wont change the sound very often for my applciation it will be mroe cost effective to use a flash memory chip in place of an MP3 decoder. More memory is much cheaper than the decoder.

My plan was to use the standard sound recording tool from the start menu to save a wave file. The data would then be sent to a flash memory IC by USB or serial. A PIC would then play the data when I wanted to play it.

Here are the things I'm having trouble with:

1) The data will be in a digital format but I need to change it to analog to connect it to a speaker. Is there a special D/A converter I need for converting a wave file?

2) I read that mono uses a single channel and stero uses multiple channels. Is a channel a seaprate wire between the D/A and the speaker? I would thing this would be done by frquency. I only need the quality of a telephone so I was thinking of using 8-bit mono. Would this be a good choice?

3) Any recommendations for a good D/A converter for stndard audio.

4) Is it vital to use filters? If so, why and what should be filtered?

I'm just looking to play back messages similar to the quality of an answering machine so this doesn't have to be anything spectacular as far as sound quality goes.
 
isd make a chip for this. i have used them before. you need to make a fairly simple peice of hardware to program it though. you just send an analoge signal out of you pc into it and hold down a button while it records then you flip a switch and it plays it back out as an analoge signal. you can make it loop and have differant adressable masseages and stuff too
 

this should be doable, but you'll have to use very fast flash memory and PIC. use the maximum oscillator the PIC support..

for the DAC, an R/2R D/A can do the trick.. without any filter, but depensding on the size of your speaker you may need an LM386 audio AMP...
 
EPE did just such a project the other year, using a PC to write a WAV file to an EEPROM, and a PIC to play it back - it was called 'Halloween Howler' as it was done for a halloween gag.
 
Look into 1 bit audio. It is simple to do. You have to do a bit of tweaking to get a reasonable sound. Perhaps this is what Nigel was talking about, not sure.

See RomanBlack's page. He has a system that allows you to record the sound on the PC and play it back on a PIC.
 
3v0 said:
Look into 1 bit audio. It is simple to do. You have to do a bit of tweaking to get a reasonable sound. Perhaps this is what Nigel was talking about, not sure.

The EPE project used an 8 bit R2R ladder D2A for the conversion, which is a lot faster than 1 bit audio - if I remember correctly it used 11KHz mono samples from the PC.

I've actually built the EPE project, but not got it finished yet as I haven't sourced the EEPROM yet - I think it was a 24LC512?.
 

Now that EPE has a downloadable (read as affordable in US) version I may get a subscription.

I picked up a pair of these chips (24LC512) to use with the 1 bit audio. Maybe when I get that breadboarded I will try to see if I can get the howler code to run or maybe not. Just found a pic of the HH which is in the Oct 2005 issue. If you want to build this thing ordering a back issue would be the way to go.

**broken link removed**

In regards to Jonathan app I am sure that the HH would produce better sound.

I want to try the 1 bit stuff. Execpt for the eeprom ($2.40 US at mouser) it is free. Could be interesting to have controllers that speak.

3v0
 
3v0 said:
In regards to Jonathan app I am sure that the HH would produce better sound.

Yes, I bought the PCB from EPE, but left out the HH sensor section - I only want it as a sound playback device - if you only want very short samples you can store and playback more than one.
 
How long is the sound sample?

Gaston is right ISD make an IC do do this and it's probably the easiest way to do it. There are also cheap recording devices available form electronics stores, you could have a go at taking one to pieces and integrating it into your project.
 
The sound sample will be of variable length. If possible, I would like to get it to be at least 5 minutes but maybe up to 20 if possible. The flash memory is pretty cheap and I'll be using low quality audio since it just needs to be the same quality as an answering machine. If I need 64 MB of flash so be it. The sound won't be changed very often so its ok if it takes a long time to download.

For the D/A IC I was looking into the analog devices AD7303 8-bit serial converter. It takes data in and outputs it as analog. It looks to me like it will work.

I recorded a wav file from the windows recorder tool in the start menu. I selected the option for "telephone quality" and it gave these settings:

11.025 kHz sampling rate
8-bit mono
10 kbs bit rate
PCM format

So ideally, all I have to do is send the data from the wave file to the d/a converter at a rate of 10kb/s? It seems straight forward but where does the sampling rate come into play? Am I missing something?
 

In my opinion the bit rate is 88.2 kbs. Did you try to right-click on the file icon and watch the file properties?
You have to send data to the DAC at a rate of 11025 Hz (sampling rate). As each sample consists of 8 bits, you'll be sending 88200 bits per second.
Another point: you have to save raw data on the extern memory (without the header of the wav format)
If the sound is 5 minutes long, you need about 3.3 Megabytes
 
Last edited:
The EPE project , as I said, uses a 24LC512 (64kilobytes) - this gives about 6 seconds of audio at 11,025KHz sampling.
 
This should be very simple to do:

Firstly, you record the sound in mono, and make sure it is in PCM (Pulse code modulation - **broken link removed**. You don't need to strip the header, just save the file to an (E)EPROM. The header is so short, It won't be audible. You can get quite big (E)EPROMs.

Make a clock source with timing equal to your sampleling rate.

Feed the clock to a binary counter. Make sure it matches the address-space in the EEPROM. You can cascade counters easily, a neat little trick.

Feed the counter to the (E)EPROM.

Feed to output from the (E)EPROM to an 8-bit DAC (linear). But make sure then that you also record with 8-bits. 16-bit DAC you can use with 16-bit recordings.

Then amplify the output from the DAC.

To reset the playback, simply reset the counter, or kill power to the counter. This will work because of the way PCM works, and the way linears DACs work (**broken link removed**.

If your interested, you should also have a look at sampling theory.

If you need a better sound quality, you need to put in a low-pass filter. Cap at 11250kHz or lower, or what ever you sample at.
 
8khz is fine for (answering machine quality) and you can use u-law instead of PCM samples for a major increase in fidelity. Basically u-law uses a log volume scale instead of a linear one like PCM because human ears work on a log scale anyways. Difference encoding can save more space as well, only storing the 4 bit difference between each sample and the last.
 
Bump

Im trying to use RomanBlack's program to make a PIC produce sound..

Does anyone know how you implement the code produced by his program??

The code comes out in 9bits.. but my PICs are all 8bit..
 
Try playing with the software off his site, I think you just have to read the bits out one at a time - try it and see!.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…