ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound Detection

Solved!
Go to solution

Does anyone know if there is a VI to do this

I would like to leave a microphone connected to the computer and if there is a noise in the room make a boolean true.

any help is appreciated

0 Kudos
Message 1 of 5
(5,664 Views)

see the attached VI

 

the concept is that first use the convert from dynamic data type to a 1d array of samples points to get the min max values when the mic is silent. now use this values as reference , if there is noise it will be out of these values . and a simple comparision to make the boolean true

 

 

with regards 

Regards
0 Kudos
Message 2 of 5
(5,657 Views)

Thanks for the quick response and the example VI

 

when silence, i get values -0.00408936 or -0.0041198

 

and i get -0.003967 or -0.003936 when the noise event happend

 

do you think the mic is working OK

 

thanks

0 Kudos
Message 3 of 5
(5,649 Views)
Solution
Accepted by topic author Carlos_Gonzalez

That example is only pulling a single value out of essentially a periodic array.  That will give very inconsistent results.  Attached is a VI that may work better for you.  Run it with no sound and a threshold of a couple hundred to get the normal background of your room.  Multiply your background by about 10% or 20% to add a little padding, then set this for the threshold.  Run and it should work.  Since you are looking for an impulse, the analysis is a simple peak-to-peak measurement.  If your background noise lasts very long, you may want to replace this with an RMS measurement to give you more noise immunity.

Message 4 of 5
(5,624 Views)

thanks for the response.

I did not have time to try your VI, i will test it tomorrow.

What i am trying to do is to trigger a photo flash when a noise is captured by the mic. i hope your vi works

thank you

0 Kudos
Message 5 of 5
(5,598 Views)