To do this you would:
- Block the DC component of a signal with a capacitor with adequate reactance as to not cause an undesired amplitude/phase shift at the lowest frequency of interest. This would depend heavily in the input impedance of the converter block you intend to use.
- You would, as necessary, scale this signal so that its absolute voltage range best-matched the converter that you plan to use. This could be an upward scaling (amplification) to make maximum use of the A/D converter's dynamic range - leaving enough "headroom" for excursions of the signal that might occur (e.g. fluctuations, noise spikes, etc.) or a downward scaling (attenuation) to prevent clipping/damage.
- Apply a DC offset to the signal so that, under no-signal conditions, the input rested at "mid scale" of the converter. For a converter with an "unsigned" output, this would be at half of its range (e.g. around 32768 for a 16 bit converter) or for a converter the spat out signed numbers, something around "zero." (One may easily be converted to the other in software.)
In your case, I can't quite figure out your signal specifications, but let's take it this way:
- Assume that the signal has 2 volts pk/pk and that its source impedance is quite low (e.g. the output of an op amp.)
- Run it through a blocking capacitor, and because we are doing this, the DC present becomes irrelevant. A 1uF would be adequate for 20 kHz unless the loading impedance if the A/D is really low.
- Use a resistive divider to set the voltage on the A/D converter side of that blocking capacitor to a voltage equal to ONE HALF of your A/D reference for a "centering" voltage.
You would then have a 2 volt pk/pk signal that was centered on the A/D's range.
Now, if your 2 volt pk/pk is the absolute maximum that can possibly occur due to clipping that can occur elsewhere, and the A/D reference is set to say, 2.5 volts - which implies a 0-5 volt A/D range, you are short-changing your dynamic range by well over 6dB, so a bit of amplification would be in order to bring the signal up a bit. If it is possible that there are even occasional excursions that might take that 2 volt pk-pk signal higher than that you might consider leaving it alone so that there is plenty of headroom for dealing with these transients.
As for the derivation of the A/D voltage reference for biasing: In the example above a simple resistive divider might be used - say, a pair of 1k resistors from a 5 volt supply to give 2.5 volts if your A/D was run (and referenced) from that. If you had an inverting amplifier in the front of the A/D converter to amplify this, you'd apply that "centering" voltage to the non-inverting input that you would normally "ground" which would then "steer" the output to the centering voltage, regardless of the input signal/gain.
Now, some A/D-D/A codec chips have built in reference voltage generators that are brought out externally that represent the ""Mid" supply voltage, already divided-by-two. These cannot be used directly as they are typically high impedance, but a unity-gain follower op amp may be used to buffer these and provide a replica (plus/minus the op amp's offset voltage!) of that and this may be fed to the input via a resistor - or to the noninverting input of an op amp as noted above. Other A/D converters have a separate A/D reference block, separate from the power supply voltage, that represents the full-scale voltage, that is brought out as well and this, too, could be fed into an op-amp unity-gain follower, but it then have to be divided-in-half to get that "centering" voltage.
Finally, you made no mention of it, but be sure that your input signal has no spectral content above 350-400 kHz (and absolutely NOTHING above 500 kHz) or else Nyquist will bite you! If it does, you'll need to consider the implementation of a low-pass filter and/or an increase of the sample rate! (If your signal of interest is always guaranteed to be the same, narrow frequency band in that 20-500 kHz frequency range, you may be able to sample at a LOWER rate and save a lot of processing horsepower!)
I hope that this helps!