LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I am inputting my guitar tunes(.wav files) and I am trying to do an FFT on this. Wen I do, the FFT signals are very small and are not on the right frequency scale. However I am able to simulate a sine wave and get an accurate FFT plotted as a cluster.


My .wav file has about 8100 samples and has a sample rate of 11050. I pass the samples into FFT. The output I devide by the size of the array(8100??). This I seperate into 'real' and 'polar'. The 'real' I use to plot. My plot has a starting value of '0' on the X axis. My problem is with the other value for the cluster, i.e; To plot this I need 1. 'real' part of the FFT output. 2. the 'x' axis starting value(0) and 3. how do i get this value? I tried deviding the sampling rate by the size of the samples, but
the FFT plot is really wrong. Anybody has an example vi to convert .wav files to FFT? Thanks alot!!!
0 Kudos
Message 1 of 7
(3,771 Views)
Open the VI called Labview\examples\measure\maxmpl.llb\power spectrum example.vi. Then, delete the portion which simulates the data for the FFT. In its place, put the Graphics & Sound\Sound\Sound File\Snd Read Wave File.VI. Select the wave to get. If it is a stereo wave file, an array of points is output from this VI. Strip off one channel, and input that into a Build Waveform, along with a t0 of 0 and a delta T of 1/11050.

If you run the VI, it should perform the way you are wanting.

Mark
0 Kudos
Message 2 of 7
(3,771 Views)
Mark! Thanks for the reply. However I am unable to find that example you mentioned. I am using Labvew5.1. In the examples I see: Labview/examples/analysis/measure/measxmpl.llb. This has 'amp spectrum analyzer", "dynamic sig analyzer" and "simple spectrum analyzer".
Is this the LLB you refered to? And none of these show an "FFT" vi, but do show digrams with Power/spectrum analyzers. Thanks alot!!!
0 Kudos
Message 3 of 7
(3,771 Views)
Okay, I was using LV6i. In LV5.1, there's a VI called labview\examples\daq\solution\benchtop.llb\benchtop spectrum analyzer.vi. If you look at the diagram, there is a vi that is in the Acquire, Process and Average loop. If you look at that VI's diagram, remove the portion that gets the data from the data acquisition card. (You'll get it from your file.)

Replace that the same way I explained before, except for the part that says to put it into the "build waveform" part. That only exists in LV6i.

Mark
0 Kudos
Message 4 of 7
(3,771 Views)
That solution was for LV6i. For LV5.1, see the VIs attached. Run the Benchtop Spectrum Analyzer mod.vi. It calls the other vi.

Mark
0 Kudos
Message 5 of 7
(3,771 Views)
Mark! Thanks again for the extended answer!!! I have learned alot from that example you gave me. Here is a simple VI which I am trying to plot as an FFT plot. I have also included a 0.5 sec .WAV file. If you have the time, I will appreciate it if you can tell me how to plot the FFT. This vi is very simple. You can open the included .wav file on the included VI, and you will understand why I am unable to plot an FFT. I am doing this to process my music. Appreciate it!!!
Download All
0 Kudos
Message 6 of 7
(3,771 Views)
Well, I noticed a couple of things. First, you need to strip off the last part of your FFT array before displaying it to the graph, because you can only effectively see frequencies to 1/2 your scan rate, or 11025 Hz. Second, you used the wrong VI to get the real portion of your FFT--you chose the "complex to polar", when you really wanted "complex to Re/Im". Try that, and your results will be different. Also, for future reference, you may want to "window" your time array with a Hanning or Hamming window to smooth transition points. LabVIEW has a whole article devoted to these concepts in the help menu.

Mark
0 Kudos
Message 7 of 7
(3,771 Views)