[SciPy-User] scipy.signal.spectrogram level in DB

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] scipy.signal.spectrogram level in DB

FredT
Hi, does anyone how to convert the power level in DB out of
scipy.signal.spectrogram? I'm trying to match what I see in audacity in
term of spectral power at various frequency.

Thanks
FredT
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: scipy.signal.spectrogram level in DB

David Nicholson
I think at a very high level to convert to dB you would do:

20 * np.log10 ( your_spectrogram / np.max(your_spectrogram))

Apparently Audacity uses dBFS so to get the exact same thing as Audacity, you would need to know what Audacity thinks the maximum peak value of amplitude is and then put that in place of np.max(your_spectrogram)

That's my best guess but someone who knows more digital signal processing might be able to give you a better answer


On Tue, Dec 12, 2017 at 8:33 PM, <[hidden email]> wrote:
Hi, does anyone how to convert the power level in DB out of scipy.signal.spectrogram? I'm trying to match what I see in audacity in term of spectral power at various frequency.

Thanks
FredT
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



--

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: scipy.signal.spectrogram level in DB

FredT
Thanks for your input. However, I should have been more clear, I meant
the spectrum view like here:
http://manual.audacityteam.org/man/plot_spectrum.html

If I do a spectrogram and look at a time interval, I should be able to
get the same view however, getting the same scale seems to be a
challenge. Perhaps the solution is in what you provided but in this case
the np.max would be a static number?

On 2017-12-12 19:52, David Nicholson wrote:

> I think at a very high level to convert to dB you would do:
>
> 20 * np.log10 ( your_spectrogram / np.max(your_spectrogram))
>
> Apparently Audacity uses dBFS so to get the exact same thing as
> Audacity, you would need to know what Audacity thinks the maximum peak
> value of amplitude is and then put that in place of
> np.max(your_spectrogram)
>
> http://wiki.audacityteam.org/wiki/HowAudacityWorks [2]
>
> https://en.wikipedia.org/wiki/DBFS [3]
>
> That's my best guess but someone who knows more digital signal
> processing might be able to give you a better answer
>
> On Tue, Dec 12, 2017 at 8:33 PM, <[hidden email]> wrote:
>
>> Hi, does anyone how to convert the power level in DB out of
>> scipy.signal.spectrogram? I'm trying to match what I see in audacity
>> in term of spectral power at various frequency.
>>
>> Thanks
>> FredT
>> _______________________________________________
>> SciPy-User mailing list
>> [hidden email]
>> https://mail.python.org/mailman/listinfo/scipy-user [1]
>
> --
>
> David Nicholson, Ph.D.
> Sober Lab [4], Emory Neuroscience Program. [5]
>
> www.nicholdav.info; [6]https://github.com/NickleDave [7]
>
>
> Links:
> ------
> [1] https://mail.python.org/mailman/listinfo/scipy-user
> [2] http://wiki.audacityteam.org/wiki/HowAudacityWorks
> [3] https://en.wikipedia.org/wiki/DBFS
> [4] http://www.biology.emory.edu/research/Sober/Home.html
> [5] http://www.emory.edu/NEUROSCIENCE/
> [6] http://www.nicholdav.info
> [7] https://github.com/NickleDave
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user