discrete DAC chip versus PWM to generate audio signal

Status
Not open for further replies.
I started a thread about 12 hours ago asking for some help getting started with using a microprocessor and a seperate DAC chip to drive a small speaker. A few people mentioned to me that I could use my microprocessor's onboard PWM generator to generate an audio signal instead of a discrete DAC chip. What are the pros and cons of these two methods?

Thanks.
 
Followed from the other thread, interesting topic. 🙂

DAC Pros: You can buy something that right out of the box can talk to your micro and do hifi. Cons: Can be pricey and difficult to get. As a hobbyist, they don't want to talk to you if you aren't ordering in the thousands. You end up with devices that are already obsolete. You still need an amp.

PWM Pros: *IF* your micro is capable of doing it at a fast enough rate, the audio generation is analogous to PWM of a DC motor! You just change the duty cycle of the pulse much faster then the audio sampling rate. Since there are only two states, on and off, the output stage can just be cheap power FETs and maybe some smoothing passive components. Cons: Heavily software intensive and processor will be spending most of its time generating audio.

Just an example if what is touted as a 1 bit sound with software PWM. Tritona Explodarium (1-bit) - moviemovies1's music - Music - ChipMusic.org It's in Polish but you can figure out where to click. Similar demos for the PC speaker and Atari computer are around.

How good you can get with PWM will depend on your micro rather then its stated resolution *IF* you are willing to do the programming. For instance, you say 10 bit sound. Let's say you are able to modify the PWM two times during the output of a 44 kHz sample. You could do a combination of 256 and 257 to get resolution of 256.5. Likewise combine 256 and 259 to get 257.5. As the speed of your micro is increased, you can get further refinements in output quality. With something like 10 changes per sample you could send one 1 and ten 0s for .1 output level.

I think most commercially available class D amps like to run at >400 kHz but I have only been looking at them for about 4 years. Saw some crazy stuff when I was looking for an example.
http://www.ti.com/lit/sg/slyt312/slyt312.pdf

Just a TI sales blurb. Looks like they sell a i2s two chip solution. It essentially goes back to your original design but with a class D amp as the output vs. chip amp. So many choices! I still get a buzz from development choices. Build whatever makes you happy. I am sure you will come up with something interesting.
 
Using the PWM off an MCU will most likely result in poor audio quality. What you're essentially doing is modulating a carrier wave with audio data and then filtering out frequencies >22khz.

Even if the MCU has enough juice to perform all those calculations, it still won't beat out the performance of a typical audio DAC.
 
Status
Not open for further replies.