How to remove 50 Hz frequency noise from a PCM file?
You should just use a notch filter.

Below shows two sinusoids added together (top) and the result of filtering the lower frequency one (bottom).

The filter is just:
$$
H(z) = \frac{1 - 2 \cos(2\pi \omega_{b}) z^{-1} + z^{-2}}
{1 - 2 \alpha \cos(2\pi \omega_{b}) z^{-1} + \alpha^2z^{-2}}
$$
where $\omega_b$ is the bad frequency and $\alpha&lt;1.0$ is related to the notch width / depth.





R Code Below

#29936

fs &lt;- 8000
fbad &lt;- 50
phibad &lt;- 2*pi*runif(1,0,1)
fgood &lt;- 101.98340234
phigood &lt;- 2*pi*runif(1,0,1)

T &lt;- 1000
t &lt;- seq(1,T)

x_noisy &lt;-  sin(2*pi*fgood/fs*t + phigood) + sin(2*pi*fbad/fs*t + phibad) 

num &lt;- c(1, -2*cos(2*pi*fbad/fs), 1)
alpha &lt;- 0.99
den &lt;- c(1, -2*alpha*cos(2*pi*fbad/fs), alpha*alpha)

x_filtered &lt;- filter(num, den, x_noisy)

par(mfrow = c(2,1))
plot(t,x_noisy, type="l")

plot(t,x_filtered, type="l")