# calculating SNR from dbfs (using spectrograms)

I've the spectrogram of both noise and signal (both 5 seconds). Below image shows an example of the signal spectrogram:

The colour of the spectrogram shows the intensity in dbfs (from 0 dbfs to -120 dbfs). Now, I'd like to calculate the SNR value from these two spectograms. But, I'm not sure how to do it. What I did is:

1. dbfs_new(x) = dbfs(x) + 120 where x is the value of each pixel (between 0dbfs and -120 dbfs).

This makes sure that higher intensity has higher value and not lower value.

1. calculated RMS for both signal and noise using their spectrogram:

RMS_signal = (SUM(dbfs_new(x)^2)/m)^.5 where m is the total number of pixels RMS_noise = (SUM(dbfs_new(x)^2)/m)^.5 where m is the total number of pixels

and, finally:

1. SNR = RMS_signal - RMS_noise (in dbfs)

But, I'm not sure what I've done is correct! Can I calculate SNR from dbfs? If not what do I need to do?