Convert Triangle Wave to Sine Wave I have this triangle wave as input:



and I want to derive a sine wave out of it. How do I go about it?

PS: I am doing this in Lua, so any piece of code close to that language would be appreciated.
Assuming $x(t)$ swings between -1 and 1, $\sin \frac{\pi}{2} x(t)$ might do the trick.