LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound and Vibe - Third octave calculated via FFT Spectral lines

Hey fancy folk,

 

I was wondering if anyone knew how the third octave data is calculated in the sound and vibe toolkit. From what I can tell, the octave analysis VI has a time averaging feature to give me the SPL of a specific band. I ask because I'm trying to do third octave analysis via summing the spectrum lines of the FFT.

 

I currently have a VI that will load a TDMS file and send to a queue which allows me to perform a 50% overlap on my data. Next, I window that data and send it to an FFT. After that, I search through the waveform's spectral lines and perform an RMS calculations on anything that is in the third octave bands. Finally this data is A-weighting. However, This method doesn't appear to give me the correct data, based on the data another coworker has gotten and what the third octave analysis VI has given me. I then tried using the power in band vi to calculate the band power for the third octave frequencies. From what I can tell, it is closer to what I'm expecting my data to look like. However, I am not sure how that VI calculates the band power either, so it feels like I'm chasing my tail on it.

 

Attached is a zip file with my code and the background noise to my chamber. The noise is 10 seconds long and IIRC, gives 71 FFT samples. The main code to execute is the "Forum-third-octave-FFT-based.vi". The "FFT spectrum info to octave info" is a VI that I made to attempt to transfer as much spectrum info from the FFT to octave VI's for the third octave calculations that I perform. Main reason is that after the calculations, I want to perform A-weighting on the third octave data that I have calculated via the RMS of the spectral lines. The TDMS file is the background noise to my chamber.

 

Currently, I dont think I'm doing the calculations for the higher frequencies correct. From what I can tell in documentation, the higher frequency data tends to be decimated and I am doing no decimation. I'm not sure if thats important or not, but I figured I'd throw that out there. The decimation may be for collecting data only, again, not too sure.

 

I am hoping someone can clear up how the third octave info is calculated via the third octave analysis VI's and/or take a look at my code to see if I'm doing anything wrong with calculating the third octave SPL via the FFT spectrum.

 

Thanks,
Matt

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 1 of 9
(5,101 Views)

Hi Matt_AM,

 

The following document provides extensive information on how the third octave calculations are performed:

Third Octave Analysis Toolkit

http://www.ni.com/pdf/manuals/320952a.pdf

 

Additionally, the VI performs the third octave calculations in accordance with the IEC 1260:1995 and ANSI S1.11-2004 standards.

Alex
Hardware Engineer
0 Kudos
Message 2 of 9
(5,061 Views)

Fancy Folk,

 

Looks like I've been doing my calculations wrong.  I dun goofed with the linear (Pa) vs exponential (dB) summation.  In my original code, I had the "SVFA Power Spectrum" VI's signal "dB On" set to True, meaning any value coming out would be in the dB scale.  I then performed an RMS calculation on the values that fell within the 3rd octave spectrum.  So where I goofed was that I am adding exponential values (dB) together when I should be adding the linear values (Pa) together.  I set dB On to False (meaning I'm in linear values) and then summed my the spectral lines that were in the third octave bandwidths and convert that value to dB.  Hopefully that made sense.  

 

Anyways, attached is screenshot with the modified code for the Forum-third-octave-FFT-based.vi.  Again, hope this made sense.

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 3 of 9
(5,059 Views)

Alex G,

 

Is the Third-Octave Analysis Toolkit that you have linked the same code that is used for the Sound and Vibe Toolkit's (SVT) third octave analysis?  From what I can tell, the Third-Octave Analysis Toolkit describes the third octave analysis via the frequency domain.  However, I think the SVT does analysis for third-octave info in the time domain due to the time constant you can set via the third octave VI's in the SVT.

 

Matt

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 4 of 9
(5,053 Views)

That appears correct, the link I listed was for an older archived toolkit and doesn't mention the time constant information.

Thank you for providing the in-depth explanation of the steps you took to resolve the issue.

Alex
Hardware Engineer
0 Kudos
Message 5 of 9
(5,044 Views)

Alex G,

 

I still may be wrong with my calculations though.  I was looking at the Sound and Vibe user manual and the calculation for spectrum power ∑ Power Spectrum FFT/ENBW from start frequency to stop frequency.  In other words, sum up all the spectral lines for the bandwidth you care about then divide by the ENBW (Equivalent Noise Band Width), which is a value based on the windowing function you use.  The Power Spectrum FFT should be in linear units, not engineering units.

 

Side note, Power in Band VI can also do this.  Just put in a 1D array of clusters through a for loop.  The cluster is 2 elements long where the 1st element is the low cut off frequency and the 2nd element is the high cut off frequency.  Use that to cycle through all the elements with your signal and spectrum info from the SVT FFT power function, and BAM, you got basically exactly what I was looking for with a whole lot less hassle.  

 

Matt

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 6 of 9
(5,042 Views)

Hi,

Thanks for your information.

I find this document too, it publish at 1995, I don't where to find this toolkit or vi.

How does it relate to the vibration and noise package?

Thanks

Boone

0 Kudos
Message 7 of 9
(2,512 Views)

Boone,

 

Basically it boils down to how the power in the band is calculated according to the native third octave analysis and how I wanted to calculate it.  The native calculation sums the spectral lines inside your range while what I wanted was all data in the range.  The big difference is the edge cases.  

 

Example, your spectral lines are every 5 Hz. You want to sum the power in the band 212-230 (this is a made up band for the sake of explanation).  The native code would start sum 215-230.  But what about the 212-215 Hz power?  Isn't this still part of the power in the desired range?  So my work around was to add a percentage of the 210 spectral line to the the total spectral power (3 hz of overlap/5 hz spectral line*210 band power) then divide the total by the windowing ENBW.  IMO, there is typically such a small overlap of spectral power that this doesn't really have to be considered.  I was trying to match my numbers to another group who wasn't using the SVT.

 

Edit: additionally, linear units matter because summing in dB isn't equivalent to summing in linear then converting to dB.  

 

Matt

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 8 of 9
(2,435 Views)

Hi Matt,

  You are correct in that you need to handle the parts of each fft bin that go between neighboring octaves. I wrote some matlab code to go from fft--> n octave that might be worth looking at as it contains how to handle the case you're talking about:

 

NarrowToNthOctave - File Exchange - MATLAB Central (mathworks.com)

 

Troy
 
This might help too: 
tmbouman_0-1670011071034.png

 

0 Kudos
Message 9 of 9
(1,596 Views)