LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot amplitudes of frequencies from an FFT

For a project I am working on I have a vi that can read and plot wav files on a waveform graph as well as the FFT. I also have a vi that can read all the wave files in a given folder. The next step in this project is to make it so the vi will plot the amplitude of the first harmonic of the FFT (I am working with instruments) ex. if I play an A it will plot the amplitude at 440htz. I also have excel sheets saved with the data of the FFT of each of these wave files. Anyways, I am stuck trying to take the amplitudes of these frequencies and plot them. I hope this all made sense, I am a high schooler and I am new to LabVIEW and programming in general so I hope you guys can help me. I have attached the vi that reads the wave files and plots them and the vi that that reads all of them at once. 

Download All
0 Kudos
Message 1 of 5
(2,773 Views)

Hi user,

 


@user9485 wrote:

The next step in this project is to make it so the vi will plot the amplitude of the first harmonic of the FFT (I am working with instruments) … Anyways, I am stuck trying to take the amplitudes of these frequencies and plot them.


You already calculate the sprectrum and plot it in a graph.

What exactly is your problem when you already get the FFT result plotted?

 

Btw. don't use that local variable in your VI: use wire instead!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,711 Views)

I need to be able to find a spefic point on the FFT (the amplitude at a certain frequency).

0 Kudos
Message 3 of 5
(2,703 Views)

The FFT graph is a datatype similar to a waveform.

 

A waveform is an array of values, a T0 and a dT.

An FFT cluster is an array of amplitudes, an F0 (probably 0), and a dF.

 

So index N in the array has an amplitude value, and a frequency of N time dF.

0 Kudos
Message 4 of 5
(2,697 Views)

As has been said, you abuse of local variables introduces a glaring race condition in that the FFT will work on the data from the previous call. So fix that first!

 

altenbach_0-1601305915728.png

 

 


@user9485 wrote:

 if I play an A it will plot the amplitude at 440htz. I also have excel sheets saved with the data of the FFT of each of these wave files. 


Can you explain how the data from the excel file correlates with the data from the wav files? Do you have independent information of what the sound should be or do you need to find the predominant frequency in each file? Depending on the data sampling (N, dt) there might not even be a point at exactly 440Hz. Is each wav file a pure sample or does the sound change with time (JTFA). How do you know there is only one dominant frequency (+harmonics). For example in DTMF sounds, you have two.

 


@user9485 wrote:

 I have attached the vi that reads the wave files and plots them and the vi that that reads all of them at once. 


Disk access is a sequential operation, so while you can automate reading and analyzing all files in sequence, it cannot happen all at once in parallel.

 

You might get better help if you would also attach a set of typical data files (wav, xlsx) so we have a better idea what's this all about. How long are the recordings?

0 Kudos
Message 5 of 5
(2,682 Views)