# How do I remove outliers in measured sound pressure levels data?

I have measured sound pressure levels (24 h sampling at 25600 Hz) data for many days. The focus of measurements was on road noise, which is a dominant source of noise in the measurement setting. However, there were occasional "disturbances", such as nearby construction sounds (machine operating) due to meteorology, lawnmower, etc.

How do I detect such outliers in the measured data and, possibly remove them? Any (or all) suggestion(s) are highly welcome and appreciated.

• You need to clarify and give a example of the data. For example, 24h sampling rateto me means that you are taking a sample once every day, which I doubt is the case. Oct 5, 2021 at 9:16
• Possibility - search on the DSP stack - someone may have asked a question similar to yours Oct 5, 2021 at 12:05
• @NMech: My bad, I have clarified about the sampling period and rate. There were continuous (24h) measurements for many days, at the sampling frequency of 25600 Hz, the processed spectra averaged over 10 seconds. Oct 5, 2021 at 13:32

## 2 Answers

What you are asking is not trivial. As PeteW said, you probably will find something in DSP, although this might be a bit too basic for them.

The problem with sound measurements is that the amplitude can be significantly different.

One way is that you can differentiate is though frequency. So what I'd do is:

• break up the signal is a fixed time period (more that 1 sec and less that 10 min). a packet

• calculate different statistics on each packet. e.g.:

• perform an fft and find the dominant frequency
• find the power content in the signal (integral of fft)
• (you can add more but then you'd need multi-variate approach).
• when you plot the data (x the dominant frequency, y the power content) , you should have clusters of similar measurements, which you can identify using k-means clustering or other methods.

Those hopefully, you could use to identify "packets" in your recording that are different that the basic road level. (you might even be able to classify them using AI methods.).

What I'd do then, is that I would listen to representatives of the different clusters and see if they fit a pattern (lawnmower, or construction vehicle).

regarding the multivariate approach, you could even use libraries like librosa to fingerprint the different packets, with different statistics and then calculate the different clusters (although this would not be an afternoon's work) .

• Yep, that's what I would do. An envelope or peak-detector might be sufficient for the first step. A simple one is (band-pass filter, optional) -> (absolute-value or root-mean-square) -> (low-pass-filter). Then apply a baseline extraction algorithm to that, which can be as simple as windowing like described above, and a trimmed mean to eliminate outliers, if the signal is baseline most of the time. There are other baseline algorithms when the signal is mostly not baseline. Oct 5, 2021 at 14:28

If the data is over a 24h period and you have the times of these "other" sources causing the outliers then you can exclude those times from the general analysis.

Deleting those time entries is one possibility, setting a constraint to exclude those, depending on how the analysis software works is another.

But you should evaluate how that affects the results.