LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Spectrogram from Acquire Sound VI

Solved!
Go to solution

Hello,

 

I have just recently begun to delve into LabView, and I have what I imagine to be a pretty basic question here. I am using LabVIEW 8.5.

 

I am using the Acquire Sound VI to get data from an external microphone, and I can convert the dynamic data to a waveform, display that waveform on a basic waveform chart, and also perform and display the FFT frequency spectrum.

 

What I cannot figure out, however, is how to feed this waveform data into the STFT Spectrogram VI (and then into an Intensity Graph) so that I can see the time/frequency amplitude behavior.

 

Ideally, I would like a real-time spectrogram that takes data over at least 5 seconds, but just as well would be a spectrogram that is created after the program is run and then stopped. Please help out a newbie here. I appreciate it.

 

I have attached the basic sound input VI that I'm trying to make the spectrogram from.

0 Kudos
Message 1 of 10
(8,014 Views)
Solution
Accepted by Zed8

Hi Zed8,

 

The function that you will have to use is the Get Waveform Components and from there, you will be able to wire the Y component to the STFT Spectrogram VI and then into an intensity chart.  Here is a screen shot with red squares around what I modified in your code and attached the modified code.  I added timing since this is just a good programming practice. I hope this helps!

 

Spectrumimage.png

 

Kim W.

Applications Engineer
National Instruments
Message 2 of 10
(7,986 Views)

Thanks Kim. That is pretty close to what I wanted. I ended up finding a simpler way to get waht I wanted (an accurate spectrogram over a period of as many seconds as the program runs) without using the STFT at all.

 

Spectrogram2.gif

0 Kudos
Message 3 of 10
(7,975 Views)

Hi Zed8,

 

I am new to Labview and I am on a project to measure sound.  I tried to practice on your last block diagram but I seems to stumbled on an issue.  The vrms output is a single dimensional array whereas the intensity chart is expecting a double dimension array.  I have attach the vi for clarification.  Will appreciate if you could kindly show me where did I go wrong. 

 

Thanks

 

Abu

0 Kudos
Message 4 of 10
(7,572 Views)

Hi Crawling,

 

You need to enable auto-indexing on the output tunnel of your data to the spectrogram.

 

DylanC

0 Kudos
Message 5 of 10
(7,554 Views)

Dear DylanC,

 

By having auto-indexing on which is set off at default in a while loop, each iteration will add the time dimension, converting the single dimension array (Vrms) into a two dimensional array (vrms, t).  Now I can continue my crawl to my next stop. 

 

Thanks DylanC.

 

Crawling.

0 Kudos
Message 6 of 10
(7,538 Views)

Guys,

This was very supporting and efficient.

I am doing a range measurement in meters with the STFT. I would like to change the frequency axis of the STFT according to a certain frequency resolution.

For example each 100 Hz equals to 1 meter, so that the Frequency component is shifted accordingly and the values are in the Y-Axis.

How do I do  that?

Is there a way to set markers on the Frequency plot as well as on the STFT plot and read them out as Indicators?

 

Many thanks in advance

Y3G

0 Kudos
Message 7 of 10
(7,223 Views)

What is the specific VI that you're using when you refer to STFT? And how are you plotting it?

TimC
National Instruments
Applications Engineer
0 Kudos
Message 8 of 10
(7,204 Views)

Hello to All,

I have continued and have added some STFT charts and some more questions, attached is my code and a picture.

1) How  do I modify the X-Axis of the POwer spectrum according to my input Frequency. I am doing this with a Function Generator and getting wrong Results.

2) Why  do you put the FFT PropertNode XScale.Multiplier the value 1.33? 

3) The Time Waveform starts with an offset, How can I change it?

4)  ...and as mentioned before I would like to use the STFT but have difficilties to get the correct values even when wanting to show the correct Frequency as in the FFT Power spectrum. Can anyone explain tome what I am doing wrong?

 

 

 

 

Many thanks in advance

Y3G

 

Download All
0 Kudos
Message 9 of 10
(7,190 Views)

Hey Y3G,

 

Can't you just use a property node with the Xscale.maximum for the x axis?

 

Also here a link on how to change the offset of a waveform 

http://labview.ni.com/docs/proposals/6.1/HTMLHelpProposal/HTML%20Conference/WebHelp/LvwaveWaveform_S...

 

Hope that helps

TimC
National Instruments
Applications Engineer
0 Kudos
Message 10 of 10
(7,171 Views)