1
$\begingroup$

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

enter image description here

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?

Appreciate your help. Thanks

$\endgroup$
  • $\begingroup$ Depends on your signal model. You're assuming you know the pixels that belong to noise and the pixels that belong to signal. WLOG, that's usually not the case. $\endgroup$ – Marcus Müller Jul 31 '17 at 7:08
  • $\begingroup$ @MarcusMüller I've trained an AI model that separates speech from noise. Now, I want to calculate SNR from the separated spectrograms of signal and noise. Could you please let me know that what I've done (the equations above) is right or not? I'm an AI person with little knowledge in DSP and now I need help from DSP experts :) $\endgroup$ – Nejla Jul 31 '17 at 7:14
  • $\begingroup$ Well, yeah, if you've got a spectrogram that assigns certain pixels to signal, sure, then you have the signal power being the sum of these spectrogram bins, and the noise power the overall spectrogram's power (sum of all bins). Usuually, spectrograms are power, not amplitude, but that's really up to how you display that – also, conversion from amplitude to power really is just squaring linear values, or multiplying logarithmic values (if you haven't, read up on what dB is) with 2. $\endgroup$ – Marcus Müller Jul 31 '17 at 7:20
  • $\begingroup$ @MarcusMüller Thanks for the comment. In my case, pixel values are representing magnitude in dbfs. My question is, can I calculate SNR with the above 3 equations? In other words, are those 3 equations are correct? If not, what should I do? should I convert dbfs to db first? I know how to convert watt to db and vice versa but I don't know how to convert dbfs to db or watt! $\endgroup$ – Nejla Jul 31 '17 at 7:27
  • $\begingroup$ I've answered that in my last comment. $\endgroup$ – Marcus Müller Jul 31 '17 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.