I tried to tweak a trigonometric function in Wolframalpha to kinda transform the sin function into a rounded square function. Please see screenshot here: Wolframaplpha graph.
First function looks good for y=1, but I'd prefer to have a higher slope for y=0, just as the second function is.
Is there an elegant formula to achieve that with a periodic function , like sin?
Cheers!

Here's the Fourier synthesis of an unnormalized square wave, cut off at term $n$. Adjust $n$ to your needs.
$f(x) = \sum\limits_{i=1, 3, 5 \ldots}^n {1 \over i} \sin (i x)$