Jump to content

"DIY" Octave Band Levels VI


Recommended Posts

Hello,

I am working on code that will read a waveform of a sound pressure measurement and calculate the octave band levels. I would be incredibly grateful if someone could take a glance at my code to see what I have wired incorrectly...

The issue I think I'm having: The output of the "Basic Averaged DC-RMS" output wont index when I put it into the for loop. I tried to get around this problem by building arrays for each RMS output and then indexing into the for loop. Doing this doesn't allow me to graph the output... Any ideas as to why the "Basic Averaged DC-RMS" wont index directly?

 

The code (inspired by new NXG example) is attached, both VI's must be downloaded in order to run the "Octave Band Levels" VI. Also, I'm aware that LV has a toolkit for sound analysis & octave band analysis... but I do not have access to this toolkit, which is why i'm trying to write my own VI. 

Thanks in advance!

Octave Band Levels.vi

Waveform Butterworth Filter.vi

rmswont index.png

Edited by cpipkin
trying to be more specific with problem...
Link to comment

Well did you read the description of the error, or look at the data types of the terminals and indicators?  Your output is a 2D array of a cluster, and in that cluster is a 1D array of doubles.  The Waveform graph can accept multiple data types, but not this.  If you read the help on the waveform graph you'll see for a single plot you can either provide a waveform data type, or a cluster with the x0, deltaX, and Y values.  You can also have multiple plots by providing a 1D array of these values.

But honestly after all of this descriptions of what is what, the simple fix is to right click the for loop tunnel and select Tunnel Mode >> Concatenating.  This makes sure the 1D array going in, doesn't get indexed into a 2D array but instead concatenates them.  This can be wired to the graph on its own.  Also there is a bunch of inefficiencies in that code that can be fixed with some for loops.  Is this is how it is presented in the NXG example?  Like that for loop will only ever run once.

Link to comment

Nice. Thanks, Hooovahh. This certainly simplifies the code & makes it easier to look at. It also solved the graphing issue i was having.

Now that the graphing problem is fixed, I'm finding that this still isn't working... Perhaps it's because i'm bundling the band center frequencies instead of creating an XY? I will work on it.

Octave Band Levels_Simplified.vi

Waveform Butterworth Filter.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.