Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
LinkBack Thread Tools Display Modes
Old 29th January 2007, 04:43 AM   (permalink)
Default Wav sound file to IC

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.
jonathan is offline  
Old 29th January 2007, 05:42 AM   (permalink)
Default

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
Gaston is offline  
Old 29th January 2007, 07:20 AM   (permalink)
Default

Quote:
Originally Posted by jonathan
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.
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...
__________________
Ibrahim Kamal
check my electronics and robotics page: http://www.ikalogic.com/
ikalogic is offline  
Old 29th January 2007, 09:51 AM   (permalink)
Default

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 29th January 2007, 02:43 PM   (permalink)
Default

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 is online now  
Old 29th January 2007, 04:07 PM   (permalink)
Default

Quote:
Originally Posted by 3v0
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?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 29th January 2007, 06:06 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
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.



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 is online now  
Old 29th January 2007, 06:09 PM   (permalink)
Default

Quote:
Originally Posted by 3v0
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 29th January 2007, 06:23 PM   (permalink)
Default

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.
__________________
I also post at the following sites:
http://www.stop-microsoft.org http://www.heated-debates.com
Screen name: Aloone_Jonez
Hero999 is online now  
Old 30th January 2007, 03:16 AM   (permalink)
Default

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?
jonathan is offline  
Old 30th January 2007, 09:10 AM   (permalink)
Default

Quote:
Originally Posted by jonathan
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 by eng1; 30th January 2007 at 10:24 AM.
eng1 is offline  
Old 30th January 2007, 09:45 AM   (permalink)
Default

The EPE project , as I said, uses a 24LC512 (64kilobytes) - this gives about 6 seconds of audio at 11,025KHz sampling.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 30th January 2007, 08:16 PM   (permalink)
Default

This should be very simple to do:

Firstly, you record the sound in mono, and make sure it is in PCM (Pulse code modulation - http://en.wikipedia.org/wiki/PCM). 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 (http://en.wikipedia.org/wiki/Digital...log_converter).

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.
johankj is offline  
Old 31st January 2007, 03:40 AM   (permalink)
Default

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.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is offline  
Old 1st June 2007, 04:18 AM   (permalink)
Default

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..
__________________
"Stick around" - Arnold Schwarzenegger in The Predator after impaling a soldier to a wood post

9vDC Guitar Pedal PSU

PIC16F84a Game Module
Peter_wadley is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Sound file abees81 Electronic Projects Design/Ideas/Reviews 11 28th August 2006 03:06 PM
Sound from a Piezo Transducer MagnumForce General Electronics Chat 5 7th October 2005 04:53 PM
negative sound Kane2oo2 Electronic Projects Design/Ideas/Reviews 14 29th September 2004 02:40 AM
how would i generate HEX file for multiple assembly files? belinda_sg Micro Controllers 2 30th March 2004 08:54 AM



All times are GMT. The time now is 09:43 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker