Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

DAC (Digital-to-Analog Converter)

This device (also known as a D/A) converts binary numbers into equivalent scaled voltages. (A complimentary ADC or A/D converts analog signals into digital values, and a codec (coder-decoder) has both in a single package.)

The number of possible digital input values (and hence analog output voltages) is 2^N, where N is the number of bits of the DAC. A 16-bit DAC thus has 65536 possible output values; and 8-bit DAC only 256.

You could make a simple DAC with a bunch of weighted resistors connected to the digital outputs of any parallel port such as a printer port. The smallest resistor would connect to the most significant bit, and each adjacent bit would get twice the value of the one before it. Here is a crude 4-bit DAC:

This approach is rarely used inside real DAC chips, due to problems with the large resistor values needed as the number of bits increases, and the general difficulty in getting exact multiples. Instead, there are "ladder" schemes that use the same values over and over. The exact values don't matter as much as their relative matching, and this turns out to be much easier to integrate on a chip. A simple ladder version of the above would be:

The five 20k resistors are all matched, and are exactly twice the value of the three 10k resistors. If you actually build this circuit or the prior one, note that they assume that all of the logic 1 driving voltages match (say, 5.00 volts), and that logic 0 is really 0 volts. That's not guaranteed for typical digital port outputs, but for the simple 4-bit systems shown here it is good enough. To scale this up to 8 bits or more would require logic buffers that insure matching.

Modern sound cards typically use another approach to DAC construction, which is like the reverse of a delta-sigma ADC. The digital output data stream is digitally converted from normal sound card sample rates and encoding, up to very high rates and with a special encoding. It is then sent to a single-bit DAC, which is really just an on-off switch, and finally to a simple low-pass output filter.

Since there are no resistors to match, this approach can be made very accurate for low distortion. Also, the analog output filter can be very simple yet achieve superb performance at reconstructing the signal, since it only needs to remove very high frequency output steps, far removed from the audio range.

GO: