LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stft from sound input VI dat to plot spectrogram, whats wrong?

Hi everybody,

I listen continously via a microphone and sound card to 25ms long pulses in the range of 9kHz to 12kHz. I get 10000 samples from my Sound Input VI and use the STFT Spectogram to plot a spectrogram(frequency versus time). Using the default settings or any other window lengths results into the error message:"...possible reasons: invalid windows length".

What's wrong?

Thank you very much,
Martin
0 Kudos
Message 1 of 7
(4,457 Views)
I use LV 8.2.

Thanks,
Martin
0 Kudos
Message 2 of 7
(4,455 Views)
Martin:
 
I have done something similar before and did not into any issues. What kind of sampling rate are you specifying in your application?. Have you also tried to acquire data for a longer period of time?. Please let me know if you have been able to uncover anything else.
 
Regards,
 
Rudi N.
 
Message 3 of 7
(4,443 Views)
Hi Rudi,

sorry for the late reply.

I use the attached VI with the following settings:

sample rate = 22050Hz
number of samples = 10000

Another issue is that I cannot record sounds continiously. There are small, for example, 100ms gaps between the the 1000samples datasets. My Desktop PC with P4 processor should be actually capable to do that job.

Thank you,
Martin
0 Kudos
Message 4 of 7
(4,415 Views)

Martin,

I am a little confused as to what your VI is actually doing.  I am not seeing the same error that you were earlier.  You are getting multiple channels of data from your sound card, but in parts it looks like you are treating these multiple channels as a single channel.  You are taking an array of waveforms into a from dynamic data type, but an array of waveforms is not a dynamic data type.  You can convert it to a DDT, then back to a 1D array of doubles, or you can convert all of the samples on all of the channels to a 1D array of doubles.  This would give the proper input to the STFT VI.

What is is you are expecting this conversion to do?  It appears that it is producing a 2D array of data, though I don't know what is to be expected from this measurement. 

Also, why are you taking multiple sample sets?  Are you wanting to take samples continuously over a long period of time?  I will have to look into this more, but I'm not sure that the sound input VIs work like DAQmx does, where the samples are acquired and stored on a hardware buffer and the read simply reads the samples from this buffer.  It may just acquire the samples it needs, then stop until the read is called again.  However, I'm not sure, I will have to look into this more.

Regards,

Message Edited by Coal Man on 05-15-2007 01:25 PM

Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 5 of 7
(4,406 Views)
Hey Brian,

I would like to listen to 25ms long pulses in the range of 9kHz up to 14kHz

+by using a
microphone and a standard PC sound card
+
continuously up to 1.5 hours.

The VI should display a real-time spectrogram(frequency versus time) like in the example VI "Moving STFT PtByPt.vi". It is important that the spectrogram always shows the last 5 minutes and the current frequencies. It is not necessary that the spectrogram is very real-timed(up to 600ms delay is ok), BUT it has to be 100% CONTINUOUSLY to not miss any of the short 25ms long pulses.

In addition I also would like to determine the frequencies of the received pulses, which are somewhere between 9kHz and 14kHz and I need to count the amount of received pulses.

My issues are:

1. missing some 25ms pulses due to problems with continuous sampling of SI Read VI in a while loop(I guess there is a small break between the 1000 samplesets)
2.
How connect SI Read VI output to STFT VI or STFT PtByPt VI to perfom moving spectrogram?
3. Why doesn't show my spectogram no frequenciues at all?

I hope this helps to understand what I try to achieve and in what problems I have run.

Here is a corrected and more use-friendlier version of my VI.


Thank you very much,
Martin
0 Kudos
Message 6 of 7
(4,398 Views)
Hello Martin,
 
I actually wrote out my own VI for the spectrograph that you are trying to do.  I am not sure why you are seeing gaps in the data, because when I run it it seems to be continuous.  What type of sound card are you using to get the signal from?
 
I have attached the VI that does everything that I think you want to do.  I just converted the 1D array of waveforms to an array of doubles for the STFT VI and I can see results on the spectrograph, though it is only when I have a consistent signal and not silence on the line.  Take a look at it and let me know if it is about what you want to do.
 
Regards,
Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 7 of 7
(4,379 Views)