# How to calculate SNR with sample noise and noisy signal only

I want to calculate the SNR for a speech signal recorded within a noisy environment. I also sampled purely the noise within the environment.

The SNR is based on the ratio of power of clean signal and the power of noise signal. So my naive attempt to get SNR is:

$$\frac{P_{signal+noise}}{P_{noise}} = \frac{P_{signal} + P_{noise}}{P_{noise}} = \frac{P_{signal}}{P_{noise}} + \frac{P_{noise}}{P_{noise}}= SNR + 1$$

$$SNR = \frac{P_{signal + noise}}{P_{noise}} - 1$$

However I realized that: $$P_{signal+noise} \propto (A_{signal} + A_{noise})^2 = A_{signal}^2 + A_{noise}^2 + A_{signal}A_{noise}$$ $$P_{signal+noise} = P_{signal} + P_{noise} + avg(A_{signal}A_{noise}) \neq P_{signal} + P_{noise}$$

$$E\{(x+y)^2\} = E\{x^2+2xy+y^2\} = E\{x^2\}+E\{y^2\}+2E\{xy\}$$
If the two variables are uncorrelated, then $$E\{(x+y)^2\}=E\{x^2\}+E\{y^2\}$$ In other words, the power of the combined signal and noise is the sum of the signal power and the the noise power if the signal and noise are uncorrelated and zero-mean. If this assumption is valid - as if often the case in practice - then the approach you outlined would work. It would also mean that $$P_{signal+noise}=A_{signal}^2+A_{noise}^2$$. If the signal and noise are correlated, then the approach would not work.