A sample rate of 1024 Hz is very low. You will need to filter the output of your DAC with a low-pass reconstruction filter that has very little response (at least 30dB of attenuation) above 500 Hz in order to eliminate the "image" frequencies created by the sampling process.
Suppose you were trying to generate tones at 100 Hz and 150 Hz. The raw output of your DAC will also have frequency components at
- 1024 - 150 = 874 Hz
- 1024 - 100 = 924 Hz
- 1024 + 100 = 1124 Hz
- 1024 + 150 = 1174 Hz
in additional to higher-order components. These additional components are not harmonically related to your original tones, so you perceive them as "noise".
Normally, a DAC for audio applications would have a sampling rate about 10x to 100x the rate you're using, with a matching output filter. Commonly used sample rates include:
- 8 kHz (audio up to 3400 Hz) - called "voice grade" because this is used for telephone circuits.
- 16 kHz (audio up to 7500 Hz) - AM radio grade
- 32 kHz (audio up to 15 kHz) - FM radio grade
- 44.1 kHz (audio up to 20 kHz) - "CD quality"
- 48 to 192 kHz - professional audio rates
To perform level shifting I think I need to generate a negative 5 volts to supply to a dual supply op amp, but I'm not sure if this is correct.
It's much simpler than that. Just add a DC blocking capacitor in series with the output. We'll calculate the value in a moment.
It looks like the macbook pro puts out -2 to 2 volts, so I think this is where my target output voltage should be.
See Wikipedia's Line leve for more on this but that will be plenty.
How many milliamps do I need to be able to source for line level?
Use Ohm's law. You'll need to find the input impedance of what you are driving but it's usually > 10k so current drain won't be a problem.
Given that I am going to be outputting square waves (which can sometimes damage speakers), is there anything I should keep in mind? I am planning on matching my amplifiers RMS wattage rating with the speakers RMS rating. Do square waves produce higher current than RMS?
You're getting mixed up. An RMS measurement allows comparison between different waveforms. If they have the same RMS value then they will have the same heating effect or power as each other or a DC current of the same value.
The problem with squarewaves is that they are high in harmonic content and, theoretically, these continue up to infinity. You can get an understanding of this from the Fourier transform of a squarish wave.
Figure 1. Fourier transform from time domain to frequency domain. Source: unknown to me.
Can anyone recommend a schematic or components I can use to accomplish the signal conditioning needed to do this safely/without damaging audio equipment?
simulate this circuit – Schematic created using CircuitLab
The capacitor and amplifier input will form a high-pass filter. (Think: it blocks DC which is 0 Hz.) The cut-off value is determined by \$ f_c = \frac {1}{2 \pi RC} \$. You can read more and find a calculator on Learning Electronics.
Best Answer
The output impedance of your DAC is very high. Not a desirable trait if you want to get any speed out of it. Decrease all your resistors by a factor of 10 and you will get more speed out of it.
Also (the edge of the stair steps become grounded) I assume you meant rounded.