[sdiy] PWM or DAC better for audio out?

Tom Wiltshire tom at electricdruid.net
Thu Jun 2 18:40:04 CEST 2011

On 2 Jun 2011, at 16:56, 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.

You're probably operating the PWM at the kind of frequencies where it doesn't make too much difference (are you?).

If the PWM frequency is so far above the audio spectrum that after a bit of filtering, all you've got left is the audio, then I don't see what is wrong with PWM as a cheap, simple DAC. The problem usually (and the reason PWM seems to have the reputation it does, I guess) is that people are trying to get full range audio whilst running the PWM frequency at 40KHz (for example; almost any PWM phaser project). Whilst Nyquist might claim this is theoretically possible, practically it seems to make sense to have *a lot* more space between the bandwidth of interest and the PWM frequency.
I assumed an upper frequency limit of 1kHz for my PIC LFO project (thinking that that would be a 0.5ms rise time - fast enough) and ran the PWM at 19.5kHz. Even that isn't enough for some people, although I never found it an issue. The 10-bit resolution and 8-bit calculations are probably more likely as the source of errors in that case, but people still blame the PWM first.

So there y'go - that's my take on it.


More information about the Synth-diy mailing list