Hi,
I take it you are using a binary resistor network of some kind to generate voltage steps. I also assume that you either output 8 bits to this network from the micro controller chip or you pulse a set of binary counters up and then down, then another bit for the sign, then repeat. You then run the signal to a filter of some kind. The filter has a varied response to different frequencies, so you see a different amplitude with each new frequency. Since it is lowpass, as the frequency increases the output amplitude decreases. This will be true no matter how you do it.
The key is to combine PWM with any other technique, or just use PWM if you can get away with it.
So right now for example you output a binary code that gives you 2.5v out of the binary resistor network, and you get 2v out at 10kHz, but at 20kHz you only get 1v out (for example). What you would do then is when you output 10kHz you output that same 2v, but only for 50 percent of the time you normally would output that value, and 0v for the remainder of the 'sample' period. That will cut the average down to 1v output. At 20kHz however, you do not do this, you output that value for the entire length of time necessary. What this gives you is 1v at that point for both frequencies.
To do this for any frequency, you start from the max frequency and work down. Calculate the filter response and use that result to determine what the duty cycle for your digital outputs should be.
Unfortunately that may get a little hairy because you may not have enough bandwidth from the uC chip to do is this way, in which case you cut back the entire pattern. Instead of outputting 2v for 50 percent of the time, just output 1v for the entire sample period time. This will have a side effect of decreased resolution in the analog signal, but if the range of frequencies isnt too wide it will work.
You can also use feedback to determine the correct setting and that way you wont have to calculate the filter response and hard code the required amplitudes. This is better too if you have a variable load.
Another idea is to use a voltage controlled tuned filter.
The cleaner you can get the output of the resistor network to be the shorter the time constant of the filter has to be. This means you can use a smaller cap which will only affect the very high frequencies and wont bother the low frequency amplitude too much, provided the range isnt too very wide.
You might also consider dividing up the full range into bands, switching different resistors in for different bands, as long as you only intend to have one frequency output at a time (no mixed signals).