Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decibel conversion to acoustic data. #92

Open
CFlaniganMide opened this issue Oct 15, 2021 · 2 comments
Open

Add decibel conversion to acoustic data. #92

CFlaniganMide opened this issue Oct 15, 2021 · 2 comments
Labels
calibration Related to the generation or application of `Transform` function enhancement New feature or request

Comments

@CFlaniganMide
Copy link
Contributor

Work done in endaq-python-calc has done the math for converting the units, and in IDELib it'd be easier to utilize the on-board pressure sensors to find the actual ambient pressure.

Adding a new non-linear transform to idelib/unit_conversion.py would be fairly straightforward and add value to us and customers.

@CFlaniganMide CFlaniganMide added calibration Related to the generation or application of `Transform` function enhancement New feature or request labels Oct 15, 2021
@CrepeGoat
Copy link
Contributor

CrepeGoat commented Oct 15, 2021

I do want to emphasize a couple things.

First, the calculation canNOT generate a single dB-scale data sample from a single pressure-scale audio sample. It's not a one-to-one conversion in that way.

A dB-scale sample needs to instead be calculated from some RMS quantity; this could be a scalar RMS over the whole time series, samples from a rolling RMS, or samples from a PSD (which relates to the time-domain RMS via Parseval's Theorem). Additionally, the data should likely also be zero-mean'd before calculating the RMS (this is equivalent to calculating the standard deviation of the samples). The reason for calculating the RMS first is because this is indicative of the energy content of the signal, which is what our ears are detecting when we hear sound.

The second thing is, there are two different dB scales for sound pressure:

  1. sound pressure level (SPL) - this uses 20 log10, and uses a reference of 2e-5 N/m^2 (Pascal)
  2. sound intensity level - this uses 10 log10, depends on air density and the speed of sound as parameters (you can calculate these from ambient pressure/temp & relative humidity), and uses a reference of 1e-12 W/m^2

While these appear to be effectively identical at STP, they diverge under other conditions, so it should be noted which one we're calculating.

I'm basing ^this on the handful of articles I've been using as references:

@CFlaniganMide
Copy link
Contributor Author

This is a very good clarification. I expect we'll want both, so as you say we should just be very clear about which is which.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calibration Related to the generation or application of `Transform` function enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants