Surface detection and Footsteps in Quake Engine

How to detect the surface under the player and play different footstep sounds depending on material.