Differences between soft knee and hard knee in Dynamic Range Compression (DRC)?
Regarding advantages - there is only one I can think of... The soft knee makes the compressor less noticeable. It sounds more natural, especially when you are dealing with higher compression ratios (like 4:1, etc.). 

On the other hand, if you want to participate in the "Loudness War", then you should rather use hard knee, as it allows you to squeeze out even more loudness.



Regarding implementation. Assuming the:

$T$ - threshold

$W$ - soft knee width (soft knee extends from $T-\frac{W}{2}$ up to $T+\frac{W}{2}$)

$R$ - compression ratio

The soft knee compressor is governed by the equation:

$$
y_G = \begin{cases}
x_G &amp; x_G-T&lt;\frac{-W}{2} \\
x_G+\frac{\left(\frac{1}{R}-1\right)\left( x_G - T+ \frac{W}{2}\right)^2}{2W} &amp; |x_G-T| \le \frac{W}{2} \\
T+\frac{x_G-T}{R} &amp; x_G - T &gt; \frac{W}{2}
\end{cases}
$$

Here is how the compression curve will look like:



If you want to achieve the hard knee, then just drop the middle equation:

$$
y_G = \begin{cases}
x_G &amp; x_G &lt; T \\
T+\frac{x_G-T}{R} &amp; x_G &gt; T
\end{cases}
$$

Obviously then you will get the following compression characteristic:





Whenever you have to do something about Dynamic Range Compression, I suggest you to take a look at the article below. Those guys did a great job of putting together all the info. Nonetheless I highly recommend reading the articles in references. 


  Giannoulis D. et al. - Digital Dynamic Range Compressor Design - A
  Tutorial and
  Analysis