To get the frequency graph, you need to keep a track of the amplitude (volume) against time and use what's called an FFT (or DFT) to get the instantaneous frequency. Frequency is defined as rate of change of amplitude vs. time.
Either you want to poll that call to get the volumes really fast (simple, but cpu intensive), or you need to get a pointer to the audio buffer (a few ms worth) when it gets delivered by the driver to the sound card (needs a change to ufmod I think - need to research that).
Jim