07-05-2011 04:16 PM
Hello there ! I am new inn using labview and I need help in writing a VI that can compare the amplitude detected by a microphone when a speaker is used to generate different frequencies and I want to use that VI plot the frequencies generated by the speaker against the amplitude detected by the microphone. Thus far, I have created 2 VIs that control the generation of frequencies by the speaker and the detection of the emiitted frrequency by the microphone, but I don't know how I can use those to compare the detected amplitude and the emitted frequency.
Thjank you for your time !
07-05-2011 05:46 PM
If you are wanting to perform simple comparisons it's fairly easy as long as both data sets are the same data type. You can compare for equality using the equal operator and wiring in both data sets. If they are arrays then it will automatically do a point by point comparison. If you right click on the primitive you can have the option to compare aggregate (one answer for all) or leave the default setting which returns a comparison answer for each pair of points. Most of the comparison primitives work the same way and the basic math operators (+,-,*,/) do too. For more information I suggest you use the Example Finder (Find Examples... under the Help menu pull down) and do a search on "compare". This will show several examples and likely one that is a close match to your needs.
For more complex, parmeter style comparison you may want to look at some of the sound and vibration toolkit VIs assuming you have that option. It's an add-on toolkit but has many excellent signal processing features that might be what you are looking for.
Good Luck
Jason
07-05-2011 05:55 PM
Thank you very much for a quick reply ! I want to compare the two signals but I want to plot the amplitude of the frequency which is detected by the microphone against the the frequency emitted by the speaker ! I want this in order to see if I am getting some sound band gap. And the other problem that I have is that what I am getting from the microphone is the frequency detected by the microphone not the amplitude do u have any idea of how I can fix this ? Thank you very much for ur time !
07-06-2011 10:32 PM - edited 07-06-2011 10:42 PM
It sounds like what you're looking for is a frequency plot. This can be obtained by doing an FFT on your waveform. As far as the concern that you're measuring the frequency rather than amplitude, this depends on how your DAQmx task is set up. Is the task set to measure frequency or amplitude?
07-07-2011 12:00 PM
hello !
Thanks Thor ! the task is set to measure the frequency! in fact I want to plot the frequency emitted by my speaker against the amplitude of the frequency detected by the microphone, I think I am about to get it right but the problem now I have is that I am getting time domain data instead of getting frequency domain data any help is gereatly appreciated !
07-08-2011 02:25 PM
Ah I see. There's an example in the NI Example finder that goes through how to convert a time-domain signal into what you're looking for. In LabVIEW, go to Help>>Find Examples and do a search for "FFT." The example titled "FFT and power spectrum units.vi" has a number of time-domain analysis examples. If you look at the case structure subdiagram with the title "FFT," it shows how to hook up the FFT function to turn time-domain units into frequency-domain units. Hope this helps.