LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot spectrogram from waveform produced by Sound Input Read.vi

Hi all,

 

I am trying to plot a spectrogram from a sound waveform. I based my sound input on the Finite Sound Input.vi example, and am trying to produce the spectrogram from the 1-D waveform produced at the Sound Input Read.vi output. The attached file, using STFT Spectrogram.vi is the only method I've tried which doesn't give me outright errors, but it doesn't plot the spectrogram.

 

One other method I have tried is using Get Waveform Components to get the t0, dt, Y data from the 1-D waveform from the Sound Input Read to try for a more sophisticated solution, but when I wire them together I get the error that I am connecting the wrong datatypes (1-D Waveform(DBL) with Waveform(DBL)).  How does 1-D Waveform(DBL) differ from Waveform(DBL, and how do I get Get Waveform Components to work?

 

Best regards from a LabView newbie,

Kathryn

0 Kudos
Message 1 of 6
(6,597 Views)

hi

 

to convert 1-D waveform (DBL) to waveform (DBL)...all you need to do is to use index array .

as the name suggest one is an array of dimension 1 and other is a simple waveform (t0, dt ,y) as is its componets.

 

 

Regards
0 Kudos
Message 2 of 6
(6,593 Views)
0 Kudos
Message 3 of 6
(6,584 Views)
sorry please consider this VI
Regards
0 Kudos
Message 4 of 6
(6,576 Views)

Thanks nolsqn for the replies to that part of my post. Further to that question, the part I don't understand is why Sound Input Read is producing a 1-D array, why is there not just one simple waveform? Does the 1-D array only contain one simple waveform, just packed up as a 1-D array? (Or is it a 1-D array of waveforms where each element somehow represents a waveform in itself? This doesn't make sense to me as it implies a 2-D array)

 

The core of my post is really about plotting the spectrogram from the sound waveform. Given that the spectrogram is frequency vs. time, I had assumed I could use the STFT spectrogram to do the FT of the waveform across the time of the waveform but nothing I have tried so far has worked.  Thanks for your mod, but it just plots one time channel of the sound waveform - it seems to be the final time bin . I'd like to be able to get time bins from t=0 to t=end.

 

thanks again,

Kathryn

0 Kudos
Message 5 of 6
(6,575 Views)
Hi KathrynLV, Sound Input Read does return a Waveform, which in LabVIEW is t0 (starting timestamp), dt (time between samples), and Y (the array of amplitudes read in). In the example posted by nolsqn, he extracts the Y (amplitudes) with Get Waveform Components. If you want to get all the data and process it at once, you need to put the Spectograph stuff outside the loop and build a large Waveform of data (or at least the array) using a shift register.
Jeff | LabVIEW Software Engineer
0 Kudos
Message 6 of 6
(6,550 Views)