03-14-2013 09:10 AM
Hi,
I am new to Labview so please bear with me. I am trying to work out the sound vibration level emitted from a compressor. I have a microphone placed next to it but it is operating in a noisy laboratory and therefore I need to filter out the background noise.
I have another microphone to record the background noise. I think I might need to use an adaptive noise cancellation filter but cannot figure out how to make one on Labview. I have tried simply inputting the two signals and subtracting them but get an error saying "Resource requested by this task has already been reserved by a different task" when trying to run it.
Basically I am looking for the simplest way to get rid of the background noise in real time or in processing the signals afterwards.
Any help would be greatly appreciated. Please ask if you need more information.
Thanks a lot,
Sam
03-14-2013 11:56 AM
Sam,
You did not say what kind of device you are using for measuring the microphone outputs. From the error message you reportrd it sounds like you need to create one analog input task with two channels rather two separate tasks.
Lynn
03-14-2013 12:12 PM
I'd need to look at your code to be sure, but it sounds like you are trying to acquire the data with two tasks. A single card's analog inputs can only run 1 task at a time. Put both of the channels into a single task and run that one task.
03-14-2013 01:50 PM
Ah ok thank you. Yes I was trying to use two DAQassistant blocks - one for each microphone so that I could then subtract one from the other afterwards. If I put them in the same DAQassistant how do I subsequently split them up?
Thanks for your time,
Sam
03-14-2013 05:04 PM
Use a large ax? I do not use the DAQ Assistant so I am not sure. I think it generates Dynamic Data Type outputs. The Express palette has a Split Signals function or something similar.
Lynn
03-14-2013 06:04 PM
Lynn, thanks for the reply. Sorry I do not know what an ax is.
Ok is that the standard/(most simple!) way of removing background noise from a signal?
My setup is a pair of microphones that are wired through an amp into an input box (can find out the make/model tomorrow if this is necessary information,) and then fed into the usb port.
Appreciate the help.
03-14-2013 06:44 PM
An ax (also spelled axe) is a tool for chopping down trees. I was trying to make a joke. Like some other experienced LabVIEW programmers, I do not like the Dynamic Data Type because it hides the structure of the data contained within it.
The subtraction technique is standard and simple. The biggest issue is phase shift. Suppose the two microphones are 1 meter apart. A sound arriving on the line through the microphones will arrive 3 milliseconds later at one than at the other. Sound arriving along a line at right angles to the line through the microphones and equidistant from both will arrive at the same time at each. At other angles the time will vary between those values. Compensating for that delay or phase shift is necessary to get good cancellation.
In addition the amplitude of the signals at each microphone will vary inversely as the square of the distance between the source and the microphone. For sources much closer to one microphone the amplitude difference can be significant.
Directional microphones will further complicate the amplitude variations. I think that two microphones are not enough to provide unambiguous determination of the direction of an unknown source, especially when there are multiple sources.
Lynn
03-15-2013 04:33 AM
Lynn,
Haha my sense of humour was a bit off.. I understand the issue with phase shift but am happy to play around with it in Labview if there is a way to do that until I get good cancellation. I also read a bit on adaptive noise cancelation (ANC) and opened the example in Labview but could not understand it. Is there a way to simply drag an ANC block onto the block diagram? The cancellation does not have to be perfect but it is quite a noisy laboratory and therefore some cancellation is necessary.
Thanks.
03-15-2013 03:39 PM
I do not have an ANC example. Maybe it comes with a toolkit I do not have. Most examples are VIs which you can open and run. You can also look at the block diagram to see how they do things so you can adapt your VI as needed.
Lynn
03-19-2013 05:01 PM
A simple approach might be to calculate an FFT for each microphone to get the magnitude spectrum (discarding the phase information), subtracting the two spectra, then doing a reverse FFT on the result. I've seen more sophisticated methods that use Singular Value Decomposition, but I don't know enough about the math to really help you. Googling "singular value decomposition noise reduction" will point you to many resources.