LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound noise cancelation with two microphones

Hi,

 

yes, i totally agree with you. This is what i'm going to.

 

But even if mic1 hear the sound and mic2 doesn't, that doesn't mean that is proper sound.

Manipulation around mic1, produce different sounds which are not click (what i search for),

so VI should be able to make the difference, is it click or something else.

That's why i need qualitative FFT analysis, to differ click from sound which could be present only around mic1.

So i create basic VI, to make AD conversion, trigger and FFT, so i could see freq of my click. And now problem pops-up, because couple clicks have different spectral diagram.

So i need to solve this first. 

Can you advise something about this?

 

Thanks a lot.

 

0 Kudos
Message 21 of 36
(1,086 Views)

I am interested in your problem, but I am a bit confused with the example images for your post today. On them your "click" signal is way above the noise. It seems to me that it shouldn't be too difficult to detect. Also, active noise cancellation with a second microphone will be (in my opinion, I'm no expert on it) very difficult to achieve. I think there are easier ways to improve the detection with just one microphone.

 

Anyway, here are a couple thoughts that cross my mind:

- detecting signals in noisy environments can be very hard, and the better you know your signal the easier it will be

- you can try to characterize your signal ("clicks") as best as possible by sampling them better, both in time and amplitude. Make sure their length is fully contained in the waveform you save, and that they are well sampled horizontally and vertically, without being clipped. Then you can focus on windowing and FFT of the signal.

- you can do a similar characterization with the noise by recording long stretches of background noise without clicks, then use Power Spectrum Density or something similar.

- once you have both signal and noise well characterized, you can filter you waveform fairly aggressively in order to keep only the bandwidth of interest where your click lies.

- you can also look into comparing a potential click to one (or more) reference waveforms containing the click, either in the time or frequency domain.

Best of luck!

0 Kudos
Message 22 of 36
(1,067 Views)

Replying to the FFT issue - for VISUALISATION purposes (so that YOU learn about the signal), the direct FFT provides just little insight. Two improvements I suggest:

  1. Linear FFT plot is good for viewing pretty much just the HIGHEST peak. Try running the FFT through decadic logarithm, moving to dB. You will see much more details in a single image, without zooming.
  2. Instead of simple FFT, try making spectrogram. There is an example for that in NI Example Finder. It divides the signal into windows and FFT is computed for each window. It also uses a perfect presentation for the user, the Intensity Graph, which is 2D image that uses color map (I recommend rainbow color map) and is super handy. You'll also distinguish FFT of noise from FFT of signal easily.
  3. Again, try running the spectrogram through decadic logarithm and BOOM!

I am a little afraid that for making reliable spectrogram, you need pretty high sampling rate wrt click length.

0 Kudos
Message 23 of 36
(1,046 Views)

In attachment there is VI where you can find captured waveform values in block diagram as constants.

milan87_0-1674812646917.png

Additional there is a anaise.pdf whit screenshots of 5 clicks.

 

I tried spectrogram, but i don't have much better results. And to be honest, not sure if i applied spectrogram correctly at all, and how to use it correctly. Anyway you will see in block diagram.

 

@blum22,

better sampling signal is not possible because max. sampling is 50000. Which is already set.

So i think this is top quality i can get, at least regarding sampling.

 

I also made version LV2018, please try and tell if something doesn't work.

 

Thanks

 

0 Kudos
Message 24 of 36
(1,035 Views)

@NIquist wrote:

What you are trying to do is collect two signals of the same source and then try to subtract them thinking that since one mic is closer to an offensive sound it will go away but you will probably just reverse its polarity and still hear it.  Along with a ton of processing crap.

🤓


That sounds a lot like Independent component analysis (Wikipedia)..

 

Basically, the theory (in my layman terms) is that n signals can be separated from each other if you have n+1 samplers (of course there are restrictions). ICA is a way to do this, based on difference in amplitude, although delays can be used as well (but that gets way more complicated).

 

I have the book the wiki refers to: "Amazon.com: Independent Component Analysis: A Tutorial Introduction (A Bradford Book): Stone, by Jam...". You can get most of the complex matter without hardly any background. It's explained really well, which is quite rare. You'd learn a lot more than ICA, it also explains principle component analysis, and a few other algorithms, in a way it's actually clear.

0 Kudos
Message 25 of 36
(1,037 Views)

Thanks for advice.

I will check the book.

 

Furthermore, i believe that my FFT analysis is different because sometimes trigger is capture at the middle and sometimes at the end of the sample array.

milan87_0-1674817803454.png

And because this HW doesnt have internal trigger, i don't see how i can capture signal at the middle of the array.

0 Kudos
Message 26 of 36
(1,035 Views)

You can try to acquire the trigger with the signal(s).

 

Then you can truncate the data based on the trigger data.

0 Kudos
Message 27 of 36
(1,018 Views)

I have some old code for an LMS filter I used it to filter out MRI noise from vocal responses during some clinical trials.  If you send me some files recorded from both microphones, I can see if it works for your application.  About 30 seconds should be all I need.

Randall Pursley
0 Kudos
Message 28 of 36
(1,013 Views)

If your click signals are similar but not at the same position in the full acquisition, it will only affect the phase of the frequency content but not the magnitude. However the problem I see is with your second signal that is cut at the end before going back to background noise. That could cause an issue with the FFT analysis, and to minimize it you need to apply a window, but even then you don't capture the full "click".

 

If you don't have an internal trigger, you can instead try to do a continuous acquisition with a buffer and set a threshold to trigger a save. That way you can ensure that you have your click in the middle of your saved waveform. This link describes what I have in mind, and this one describes how to implement it with DAQmx (example D).

0 Kudos
Message 29 of 36
(996 Views)

You need to pre-process this signal and use a threshold to determine when the signal actually begins and ends.  Then, slice the array with those indexes to leave just the signal.  Even then, it will probably be best to use a window to avoid artifacts in your resulting spectra.  Play around with a few but the Exponential and Force windows are designed for times where the signal is generated from an impact (like a clap) and then gradually fades out.  

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 30 of 36
(998 Views)