Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to play audio (wav) using PIC

Status
Not open for further replies.

pkshima

Member
I would like to be able to play audio files using a PIC. Assuming I can decode the file into the simplest possible form which I guess is wav data, ...

Are there any chips where I can write digital audio data at one end and expect to have analogue audio signals out from the other end.

Would old sound cards have such chips ?

Thanks in advance :)
 
All you need is a D2A, this can be as simple as an R2R ladder network followed by a low-pass filter. WAV is the easiest to use, as it's uncompressed, create it as mono and 8 bit on the PC, and it's very easy to do.
 
Ah. great :)

So can you suggest any particular IC or terms I can hit google with ? I dont want to build a DAC myself. ICs work fine for me :D
 
Google for "R2R ladder", there's little point in using an IC, it's really VERY simple - and both need a low-pass filter anyway.

The DAC0800 was a popular IC DAC years ago.
 
Thanks Nigel. I read about R2R. it really looks very simple.

I wonder if such a simple thing could produce good quality audio. Especially if I say this is my first step towards building a mp3 player :rolleyes: ?

so the PIC would do the mp3 decoding to WAV in SW and this thing will turn it into real audio.
 
Thanks Nigel. I read about R2R. it really looks very simple.

I wonder if such a simple thing could produce good quality audio. Especially if I say this is my first step towards building a mp3 player :rolleyes: ?

An R2R D2A is as good as anything else, dependent on the accuracy of the resistors - many IC D2A's use R2R internally.

so the PIC would do the mp3 decoding to WAV in SW and this thing will turn it into real audio.

You've never mentioned MP3 before - you aren't going to do MP3 decoding in a standard PIC - it's usual to use a specific hardware MP3 decoder.
 
You've never mentioned MP3 before.

I did that deliberately :D
If i did that, no one would have answered the question. Everyone would have said 'forget it you cant do it' :-(

you aren't going to do MP3 decoding in a standard PIC - it's usual to use a specific hardware MP3 decoder.

Is that because of the lack of RAM and processing power or the complexity of implementing a mp3 decoder in SW ?

If its just the complexity of SW involved, I would still take the challenge. But lack of RAM etc could really be a blocking issue.

I know about sta013, vs1000k etc mp3 chips but they dont sound fun + they are not available in my area + they will raise the cost of the project a lot.
 
Mainly its the lack of power plus the complexity of it. Meaby someone will manage to do it on the 32bit PICs, but probably not for the highest bit rates.

Its much easier to use a MP3 decoder chip. You just feed it the raw mp3 file in and you get audio out of it. The chips dose all the work for you.
 
I see. So you are hinting that even a PIC18F4550 wouldnt be up to the mark for this job ?

Are there any other mp3 decoder chips other than STA013 and VS1000K ? I couldnt find any other myself.
 
There is a AC3 codec for the dsPIC family. Its a much simpler way of compressing audio than mp3. It dosent compress it as good as mp3 but it much easer to encode/decoder
 
The commercial mp3 players ....
Do they use chips like STA013 etc to do mp3 or do they have just one big chip that does it all(remote control, keypads, lcd display etc) ?

Can I hope to salvage some usable component from junked mp3 players ?
 
Last edited:
Well i seen purpose built chips for those small mp3 players. Atmel makes one of them. Its a MCU with a mp3 decoder on the same chip including also a headphone amp and also a OLED display driver. So its bascialy everything such a mp3 player needs in 1 chip.

But i dont know if you will manage to hack a mp3 player to write your own code for it.
 
The commercial mp3 players ....
Do they use chips like STA013 etc to do mp3 or do they have just one big chip that does it all(remote control, keypads, lcd display etc) ?

Please put "sigmatel" in your search engine and visit their website for information on MP3 chips like stmp35xx and stmp36xx.
 
haha stupid questions but is it possible to do this with the PIC12F509 ? I'm making just a stupid character say something funny and at the moment I haven't really invested in anything better then the 509 bc im still learning ? and is there source code aval that I can see how its done ?
 
This can be done with any PIC that has both a UART and the SPI port.

Use a large EEPROM (25AA1024 for instance) for the data.

And a Cirrus D/A (CS4338) which will provide a 16 bit stereo output plus a little power amp.

For non-critical applications the 8MHz onchip oscillator may be employed as the master clock at a 15.625 KHz frame rate which will provide 2 seconds of stereo or 4 seconds mono with a single EEPROM
 
as i just wrote in another post...

but i've done some experimenting with an ISD4002 2 minute audio recorder chip.
worked quite well in conjunction with a microcontroller.
some of the ISD range go up to 16 minutes...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top