LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SVT fractional-octave analysis

Hi all

 I used SVT fractional-octave analysis.vi to generated 1/3,1/6,1/12 octave from 20Hz to 200Hz,but only 1/3 octave is right as standard,others are different,detailed as attachments,what problem for that or miss someone to setup,thanks!!

0 Kudos
Message 1 of 11
(3,059 Views)

I don't know what SVT fractional-octave analysis is, nor do I have this VI.  But (having some musical training) I know the definition of an "octave", namely two frequencies differing by a factor of 2.0 (so 20 and 40 are an Octave; 256 Hz is "middle C", and 512 is C, an octave higher, the Orchestra tunes to the oboe's "A" at 440 Hz, which the Violins match to their A string, while the celli (or "cellos") match their A string to 220 Hz, an octave lower).

 

An Octave defines a geometric series, where you get to the next number by multiplying by a constant.  To divide up the (musical) scale into 12 equally-separated tones, you multiply the preceding frequency by 2^(1/12).  To get a 1/3 or 1/6 tuning, you'd multiply by 2^(1/3) or 2^(1/6).

 

Note that 200 will not appear on an equi-tempered scale that starts at 20 Hz -- the value closest to 200 is 201.587.  It is an almost trivial exercise (which I leave to you) to write a VI that takes a Starting Frequency, an Ending Frequency, and the number of Steps/Octave (3, 6, or 12) and provides the "scale" you need (use Dbls, of course, not integers, to avoid truncation errors).  If you have trouble creating this, post your code (do not post a "picture" of a Block Diagram!) and someone will help (I'll save my result, "just in case").

 

Bob Schor

0 Kudos
Message 2 of 11
(3,001 Views)

Thanks a lot for you help,I desired to get when select 1/3 octave output freq bands in array,and 1/6,1/12,I have uploaed vi for your refer,thanks!!

0 Kudos
Message 3 of 11
(2,985 Views)

My previous post gave you the algorithm!  You made it a bit more complicated, but you can still do it.

 

When I took what was called "Algebra II" in high school, we learned about "series", both "arithmetic series" (where you got the next number by adding or subtracting a constant) and "geometric series" (where you got the next number by multiplying or dividing by a constant).

 

You are generating a Geometric Series.  The use of the term "Octave" means that the number "2" is an important part of the "multiplier".  Please write LabVIEW code that will start with the number 20 and generate a series of 20 and numbers 1, 2, ... octaves higher, stopping when you output a number > 200.  Here's a hint to get you started -- one octave higher than 20 is 40.  Here's another "check that you did the right thing" -- your series should have 5 numbers in it, with the 4th being the one closest in value to 200.

 

Now go back and read what I wrote about what a fractional octave means.  I notice that you have specified bandwidth by an e-num of the form "<numerator>/<denominator> octave".  I like enumerators for things like this, so I'm going to show you how to turn an expression of the form "<numerator>/<denominator> octave" into a "useful number".  

 

There is a very useful String function called "Format into String" which takes many LabVIEW quantities and turns them into strings.  You can then parse the string and turn it into numbers.  Here, however, it gets a little tricky, as you have numbers written in two formats:  most are written as fractions, "1/3", but you also have an "exception", the string "1 octave", where the numeric part is just the string "1".  I'm going to show you how to handle the fractions, and leave dealing with the "exception" for you to learn (there are several ways to handle this and I'll give you a hint).

Parse Fractional Octaves.png

This takes your Enum, bandwidth, which consists of elements named "1 octave", "1/3 octave", "1/6 octave", etc.  The first function is "Format into String", which changes the Enum into an string having one of two forms" -- "<number> octave" and

"<number1>/<number2> octave".  The second function is "Scan from String" which parses strings.  Here I specify a String (delimited by a space) and the specific string "octave" -- this basically strips " octave" off the "numeric" part of the String, leaving either one integer or two integers of the form "<int 1>/<int 2>".  The last Scan from String parses this second form, saying the input String is of the form "integer"/"integer" (%d means Decimal integer), and outputs Numerator and Denominator, which I divide to get the fraction "x/y" that I want.  But what do you think would happen if I only gave it a single integer?  [Read the Help for Scan from String, and adjust your code appropriately].

 

So now you have a fraction (or the number 1).  You have to use this fraction and the concept of "Octave", explained in my earlier response.  Then just generate your series!

 

Bob Schor

0 Kudos
Message 4 of 11
(2,964 Views)

Your question was addressed in answer to your post at 

https://forums.ni.com/t5/Dynamic-Signal-Acquisition/SVT-Octave-calculated-1-3-1-6-1-12-1-24/m-p/4064...

Doug
NI Sound and Vibration
0 Kudos
Message 5 of 11
(2,920 Views)

Hopefully, all of the information that Bob has provided gives you a more intuitive understanding of octaves and how to generate a list of frequencies that is evenly spaced (in a geometric sense). Bob also provided some LabVIEW tips that will make you a stronger G programmer.

 

Standard octave analysis is clearly defined in standards such as IEC 61260. The Sound and Vibration Toolkit implementation of octave is documented, and I recommend checking out the following pages:

https://www.ni.com/en-us/support/documentation/supplemental/06/acoustic-and-vibration-standards-comp...

http://www.ni.com/pdf/manuals/372416m.zip

Also, refer to the concepts documentation that is installed with the Sound and Vibration Toolkit.

 

Using those documents will reinforce the ideas of octave spacing and provide additional details as to the standard-compliant implementation. For instance, fractional-octave analysis analysis for audio always uses a reference frequency of 1000 Hz. The base in all current international standards is 10^0.3 (rather than 2.00000). Additionally, the geometric series, using the appropriate frequency reference and base will yield exact midband frequencies. The standards go on to specify what the preferred/nominal frequencies are for full and 1/3 octave analysis and rounding to use when specifying nominal frequencies for narrower bandwidths (1/6, 1/12, 1/24). 

Doug
NI Sound and Vibration
Message 6 of 11
(2,918 Views)

Perhaps, one idea that I did not make clear. Fractional octave analysis with SVT supports specification of a custom frequency range. A custom range is mapped to standard bands defined by IEC 61260. 

 

Specifying a frequency range of 20 Hz to 200 Hz maps to the exact same 'standard' bands as 19.9 to 199 Hz.

Doug
NI Sound and Vibration
0 Kudos
Message 7 of 11
(2,890 Views)

Hi Doug
Thanks for replying for this topic,as you statement and fetch from SVT-Fractional analysis.vi sub vi modify calculated 1/6 Octave as below,but still have some different with standard,somewhere need to change it,please help me point out it,It's appreciated for you in the issue.

 

sageliuliu_0-1594395491073.png

 

 

 

Download All
0 Kudos
Message 8 of 11
(2,876 Views)

You edited the code pulled from SVT subVIs. You replaced the implementation that complies with the standard by changing a constant to get a band centered at 20 Hz.

 

There is no standard 1/6, 1/12, nor 1/24 octave band centered at 20 Hz. 

 

For any standard 1/3 octave band, two standard 1/6 octave bands are defined. 

1_3 and 1_6 octave bands.png

Forgive the crudeness of the figure as it is intended to illustrate a specific point. Notice that the blue 1/3 octave band has a center that is not shared by either of the 1/6 octave bands that comprise the same frequency range. In fact, if you were to put a tone into 1/6 fractional octave analysis at the exact center frequency of the 1/3 octave filter (blue), you would observe that half the power is measured in the orange 1/6 octave band and half the power is measured in the green 1/6 octave band. The same is true for 1/12 and 1/24 octave filters.

 

 

 

Doug
NI Sound and Vibration
0 Kudos
Message 9 of 11
(2,853 Views)

And just to be very explicit, when you enter a value of 20 Hz for start frequency in 1/6 fractional octave analysis, the VI will calculate the first standard 1/6 octave band with f_c greater than or equal to 20 Hz. This is the green band in the figure above. This 1/6 octave band is not centered at 20 Hz. This 1/6 octave band is centered at 21.1 Hz.

 

This is a very similar situation to specifying a start frequency of 18 Hz for 1/3 octave analysis. The VI does not center the lowest 1/3 octave band at 18 Hz. It finds the lowest standard 1/3 octave band with f_c greater than or equal to 18 Hz, and in this case that would be the band at nominal frequency of 20 Hz.

Doug
NI Sound and Vibration
0 Kudos
Message 10 of 11
(2,852 Views)