[sdiy] PWM or DAC better for audio out?

Scott Gravenhorst music.maker at gte.net
Thu Jun 2 18:48:42 CEST 2011


johnspeth at yahoo.com wrote:
>Can anyone give a good practical tradeoff analysis for choosing PWM vs DAC for 
>digital audio output?
>
>When considering how to output audio from an FPGA synth, PWM is so simple and 
>cheap compared to a DAC.  I personally can't think of any reason to use a DAC 
>over PWM but my hunch is that I'm missing something obvious.

The following is my opinion:

As you probably know, PWM is accomplished by outputting a rectangular pulse wave and varying
the duty cycle (or pulse width).  This is used to charge a capacitor which then ought to
produce a given voltage with respect to the pulse width.  If a high frequency is used for
this pulse train, it is easier to get a decent signal out of it.  PWM at lower frequencies
can require a filter on the output.  Response time (slew rate of the output may also be
limited by lower frequency pulse trains.  I would think that using a high frequency pulse
train implies that your sample rate is also high which limits what you can do with DSP in
terms of voice count and/or complexity.  I'm not sure - but linearity may also be a problem
at the low and high ends of the pulse width range.

I use DAC hardware as low as 12 bits wide and I get some rather nice sounds even at low
sample rates (44.1 KHz).  A DAC requires no output filter regardless of it's sample rate.  I
also use 24 bit DACs and of course, high quality is easy to get.

If you're targetting high quality sound and using low sample rates (such as 44.1 KHz) you
also want high voice count in polysynts with good complex voice structure, I would recommend
DAC hardware.

Remember that an FPGA has the advantage of being able to do whatever you want whenever you
want just by sending a new bit file.  If you use a DAC, you can do anything.

-- ScottG
________________________________________________________________________
-- Scott Gravenhorst
-- FPGA MIDI Synthesizer Information: home1.gte.net/res0658s/FPGA_synth/
-- FatMan: home1.gte.net/res0658s/fatman/
-- NonFatMan: home1.gte.net/res0658s/electronics/
-- When the going gets tough, the tough use the command line.




More information about the Synth-diy mailing list