Many languages systematically replace voiceless stops by voiced stops when the immediately preceding sound is nasal. This is estimated to occur in 7% of all languages, and thus is likely to reflect preferences of the speech production mechanism. Post-nasal voicing can be explained by two factors. Coarticulation with an adjacent nasal induces nasal leak during a stop, which vents oral pressure and tends to maintain the transglottal pressure drop needed to sustain voicing. Coarticulation also causes the velum to rise or fall during the stop while the velar port is closed. This creates a pumping effect (rarefaction in post-nasal stops, compression in pre-nasal), which facilitates voicing for post-nasal stops and inhibits voicing for pre-nasal stops. The cross-linguistic pattern of post-nasal voicing reflects the combined effects of nasal leak and rarefactive velar pumping; the absence of pre-nasal voicing reflects the antagonistic effects of nasal leak and compressive velar pumping. To test this hypothesis, an aerodynamic vocal tract model [J. Westbury and P. Keating, J. Linguist. 22, 145--166 (1986)] was used. Over a range of estimated values for nasal leak and velar pumping, the model output a strong preference for extra voicing post-nasally, and no preference for pre-nasal voicing.