I tried doing this using low pass filters but didn't manage for it to work properly, so I found out that I could use a microcontroller to track the square wave period and output a sine wave with the same period. My question is, would I still need to use a flip flop, dividing the frequency for it to track easier, or can I connect the sine wave diretly? Is arduino fit for this? Or is there a better microcontroller for this?