Well my guess would be to look for a fourier series, of a general term:

a_n cos(nx), where a_n equals your sine function, then I need to solve:

0=\int_{-\pi}^{\pi} sin(nx) f(x) dx

and a_n= \int_{-\pi}^{\pi} cos(nx)f(x) dx/N where N is the normalization constant, you could try using fourier transform as in:

g(n)=\int f(x) exp(-inx)dx (normalization factor is missing) from the above you can find what is g(n) and by inverse fourier transform you can find what is f. cause f(x)=\int g(n)exp(inx)dn...

This is theoretical, and maybe wrong approach, but that's what came to my mind, didn't do the calculations myself.