Searching \ for '[EE] Recreating Audio from a uP' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/audio.htm?key=audio
Search entire site for: 'Recreating Audio from a uP'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Recreating Audio from a uP'
2007\07\17@143619 by Matthew Mucker

flavicon
face
Let me start by saying I'm a self-taught electronics hobbyist, so something
that may be abudnantly clear to a formally schooled engineer could be
totally lost on me.

With that preface....

I'm dabbling with my next PIC project and would eventually like to recreate
audio using a PIC chip. I figure I can use Windows to take an .mp3 file and
create an audio file with a stupid-simple codec, I can put the file on an
MMC card and insert the card into my PIC circuit, and read the file from the
PIC chip, but getting the data from there to a speaker is something I don't
know how to do.

(I wouldn't attempt decoding an mp3 file in PIC code. I'd make sure to use a
very simple codec.)

Would I just use a DAC, or is there a better way? Would Microchip's
MCP4821/4822 parts be suitable? What am I looking for in a part for this
purpose?

Thanks!

-Matt

2007\07\17@150107 by Marcel Birthelmer

picon face
> I'm dabbling with my next PIC project and would eventually like to recreate
> audio using a PIC chip. I figure I can use Windows to take an .mp3 file and
> create an audio file with a stupid-simple codec, I can put the file on an
> MMC card and insert the card into my PIC circuit, and read the file from the
> PIC chip, but getting the data from there to a speaker is something I don't
> know how to do.
>
> (I wouldn't attempt decoding an mp3 file in PIC code. I'd make sure to use a
> very simple codec.)
>
> Would I just use a DAC, or is there a better way? Would Microchip's
> MCP4821/4822 parts be suitable? What am I looking for in a part for this
> purpose?

Matt,

there are a few options here. You mentioned DACs, which would be one
way to go. These generally take some serial data that the PIC could
easily spit out.

For a more direct approach, you can use the PIC's PWM unit and a
low-pass filter to generate some passable audio. Basically, you
generate a square wave where the duty cycle of each period is somewhat
proportional to the analog level that you want. Then you use an analog
filter to average out the values, and you can get something
representing a sound wave.
In this case, the frequency ranges get a bit difficult. You'd have to
check the data sheet for the PIC you're thinking of using and
determine the maximal PWM frequency where you still have full duty
cycle accuracy. This in turn will affect the maximal sound frequency
you can represent after filtering out the square wave parts.

In any case, you might also want to look at amplifier ICs - the PIC's
output drive capability will not make for a very loud sound, and
depending on how big a speaker you want to drive, you might want to
amplify things a bit.

Hope this helps.
Regards,
- Marcel

2007\07\17@152436 by Dario Greggio

face picon face
>>Would I just use a DAC, or is there a better way? Would Microchip's
>>MCP4821/4822 parts be suitable? What am I looking for in a part for this
>>purpose?

For some basic "toys" or alike, you can use the Voltage Reference out
(available for example on 18F2620/2520) as a rough 4 bit DAC.
It has a high output impedance, so an OpAmp is mandatory (or an audio
amplifier, in your case).
Or, consider also a R-2R ladder if you feel like...

Reading WAV files is very easy, to begin with in your project. You can
sure use other codecs, but most of them won't perform good with HiFi audio.

--
Ciao, Dario

2007\07\17@155938 by Matthew Mucker

flavicon
face
Thanks, Marcel!

I think I'm going to investigate the PWM solution. It sounds like it'll be
easier to implement, and my SPI bus may be busy enough that not having a DAC
hanging off it (needing new samples at 8kHz) will be a bonus.

And yeah, I do know I'll need an amplifier. :)

Thanks again!

{Quote hidden}

> --

2007\07\17@190948 by Harold Hallikainen

face
flavicon
face
Also see Roman Black's 1 bit and 1.5 bit PIC audio at
http://www.romanblack.com/

Harold


--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!

2007\07\18@040956 by Alan B. Pearce

face picon face
>I'm dabbling with my next PIC project and would eventually like to
>recreate audio using a PIC chip. I figure I can use Windows to take
>an .mp3 file and create an audio file with a stupid-simple codec, I
>can put the file on an MMC card and insert the card into my PIC circuit,
>and read the file from the PIC chip, but getting the data from there
>to a speaker is something I don't know how to do.
>
>(I wouldn't attempt decoding an mp3 file in PIC code. I'd make sure
>to use a very simple codec.)
>
>Would I just use a DAC, or is there a better way? Would Microchip's
>MCP4821/4822 parts be suitable? What am I looking for in a part for
>this purpose?

Depending on the quality of audio you want, it may be sufficient to use the
PWM generator in the PIC to do a Class D style audio drive. Olin has an
example of doing this in his development environment at
http://www.embedinc.com/pic/ and look for his 'HAL' example project. If you
go this route, take not of his instructions on order of install of the files
he has. He also has some PC applications for converting WAV files into a
downloadable format that suits his audio driver.

2007\07\18@132233 by Carlos Marcano

picon face
Matthew,

  I don´t know what method are you using to store and reproduce the
audio but I suggest you take a look to this link:

<http://www.romanblack.com/picsound.htm>

 This is a very cleaver way to achieve good results in this matter.

Regards,

*Carlos Marcano*
- Guri, Venezuela -


On 17/07/07, Matthew Mucker <spam_OUTmatthewTakeThisOuTspammucker.net> wrote:
{Quote hidden}

>

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...