I cheated. Spectrum works... randomly, not with the music

I've been playing a bit with this and i think that FFT is needed, that wouldn't be the problem in principle. To implement this formula we need to know samples, i guess that samples per second. I believe that we can retrieve this information from mci using "status" with a string like this:
status mymci audio samplespersec notify
But i'm not sure, the prooves that i made give me values such as 16,776,960. Would we need to divide it by 1000?
FFT seems to be a bit slow, and when i have used it every second, the program crashed after a while. Maybe would be needed creating a thread to calculate this, and maybe not every second... ?
Any idea?
Thank you