You better look up Fourier transforms:
and:
The maths is rather complex, and I must admit I don't understand it all that much.