# Best DSP algoritms for ultrasonic background noise cancellation

I am looking into detection of pressurized gas leaks by means of the broadband hissing sound (white noise) generated from pressurized leaking gas. The instrument will have a broadband microphone followed by a high pass filter to filter away all low frequency audible noise below 15-20 kHz, but when broadband noise from leaks occure, they will pass the filter and activate an alarm. The problem is that in noisy industrial environments, machines (compressors), and other equipment will also have some ultrasound components above 15-20 kHz, and it will do false activation. Is it possible to recomend optimal DSP algoritms to be used, after the raw 15-20 kHz filtering to do a efficient suppression of machine made background noise, without affecting the sensitivity for the leak noise? I cannot tolerate varible gain for the leak noise (white noise) because then it will affect the sensitivity to detect leaks in a predefined distance, so the system must automatically suppress unwanted industrial background noise, but not affect the sensitivity to the leak noise (white noise in frequency range 20 kHz to 50 kHz).?

I would say that the main difference between leak noise i want to detect (the broadband white noise) and the machine noise is that the leak noise is just plain white noise, while very often the machine noise will have some components of high frequency reprocicating noise pattern in it from highspeed running compressors which the white noise leak noise do not have, but the high frequency reprocicating background noise can vary in frequenct from machine to machine so I do noy want to use some kind of fixed notch filter, so I am locked to one machine, at one rotation speed. Actually the problem is that the machines main noise frequency will be belos the 15-20 kHz, but it is the harmonics that repeat itself up above 15-20 kHz, and it is those I need to have filtered away. Seen from a more practical point of view, my own ears will be able to hear the difference, so I woundered if that could be realized in a electronic filter too.

• Well there's no way to filter out everything from 15-20 kHz while also keeping everything from 15-20 kHz. You have to be more specific about the characteristics of each signal. Is the machine noise only at certain frequencies that you can notch out? Do those frequencies change over time? If the machine noise is also wideband, can you measure it with a nearby microphone and then remove that signal from the far microphone? etc. – endolith Apr 15 '16 at 19:04
• Do you need to detect just the onset of a leak, or do you need a continuous output that says "leak sound at volume X." – JRE Apr 18 '16 at 14:34
• Well, basically I just need to indicate leak/no leak. In the meantime I want my device to cover a certain area for leaks, a radius around my device, and the greater distance between leak and device, the lower sound level recived by my device, and thereby, the worse signal/noise ratio for the DSP to handle. In other words, I do not need to indicate dB level from the leak sound, I just need to indicate leak/no leak, in the longest distance between leak and device i can get. – mtolesen Apr 20 '16 at 10:16
• You could get a high gain microphone and pointed in the direction where you expect leaks to come from. Simultaneously collect ambient noise with a microphone with a more isotropic directivity. At this point you could use some very basic adaptive cancellation techniques. – dsgrnt Sep 30 '17 at 20:18

One way to do this is to look at modeling your signal: $$x[n] = x_h[n] + x_n[n]$$ where $x_h$ is the hissing sound and $x_n$ is the noise.
If you can say that $x_n$ is modeled as: $$x_n[n] = \sum_{k=K_1}^{K_2} a_k \sin(k\omega_0 n + \phi_k)$$ where $K_1$ is the lowest harmonic of frequency $\omega_0$ that makes it through your high pass filter, $K_2$ is the highest harmonic, $a_k$ is the amplitude of the $k^{\rm th}$ harmonic, $\omega_0$ is the fundamental frequency and $\phi_k$ is the absolute phase of the $k^{\rm th}$ harmoninc.
Then you can estimate $(a_k,\omega_0, \phi_k)$ by minimizing $$\left| x[n] - \sum_{k=K_1}^{K_2} a_k \sin(k\omega_0 n + \phi_k) \right|^2$$ to find $(\hat{a}_k,\hat{\omega}_0, \hat{\phi}_k)$ and then look at the residual: $$\hat{x}_h[n] = x[n] - \sum_{k=K_1}^{K_2} \hat{a}_k \sin(k\hat{\omega}_0 n + \hat{\phi}_k)$$