LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time mismatch with Sound Input Read VI

Hi Folk,

I am acquiring the signal of the PC sound card with the "Sound Input Read VI" and I have noticed that between subsequent waveform data packets there are time mismatch, both overlap and gap.

 

To point out the observed behavior, I have posted a modified example, the "Continuous Sound Input.vi". In the example, I have computed the time difference between the t0 of the actual waveform packet and t0 expected on the basis of the previous waveform packet.

Consistently, in the indicator "Time series" (Waveform Charts), each time there is a time overlap or gap the Charts resets it self or presents a gap.

 

By reading 1 second of data the time mismatch is about 0.015625 or 0.03125 sec. (both positive and negative).

The repetition frequency of the time mismatch decreases as the acquisition sample rate increases.

The amount of the time mismatch seems to be sample rate invariant.

 

Do you have any idea from where this problem is coming out and how to solve it?

 

Thanks for your help,
Asper

0 Kudos
Message 1 of 5
(3,124 Views)

Hmmm.  that is an interesting one.  Click here to see the online help for Sound Input Read VI.

 

You'll notice it says this about t0:

 

     t0 is the start time for the first sample read. LabVIEW approximates the initial time that the first sample was read because the sound file does not contain this data.

 

Try double-clicking on Sound Input Read VI.  Maybe you can see the diagram and see how it calculates t0 internally.  My guess is that that the timestamp that is being returned is basically useless if used in a loop.  If you want the "real time", just use the t0 from the first iteration and then maintain your own t0 using shift registers.

http://www.medicollector.com
0 Kudos
Message 2 of 5
(3,107 Views)

Dear josborne,

thanks for your note!

 

I guess that you are right, the time mismatch that I have observed can be the approximation done by LabVIEW to estimate the initial time t0.

I can not investigate how "Sound Input Read VI" calculates t0 internally because it calls a DLL by using a "Call Library Function Node".

I suggest to NI to better clarify, on help and examples, this point for future users.

 

My initial intention was to use the time stamp to verify the temporal continuity of the acquired data by the sound card, obviously if t0 is an approximation my method is inappropriate.

 

Regards,

Asper

0 Kudos
Message 3 of 5
(3,095 Views)

Pre made Labview functions are not some holly grails that is newer to be touched and modified. In fact many included functions in Labview has what I will name as "high flimflam factor" That will say a lot of functions you do not really need. Express VIs are grim examples of this.

Anyway I have made some modifications and removed some babyfat in the sound input VI. Take a look at it. The top level VI is the "time fixed sound.vi" It could be that you will get an error because Labview will not find a DLL. If a DLL is reported missing you will find it in C:\Program files\National Instruments\LabVIEW 2010\resource\lvsound2.dll

Remember to save the modified VIs in a separate folder, and not in the vi.lib folder at all. Be careful so you do not overwrite any Labview function



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Download All
0 Kudos
Message 4 of 5
(3,054 Views)

Hi Coq Rouge,
thanks for your example.


Sorry, as I did the reply to josborne I did not have LabVIEW and I have remembered only the DLL.


As already josborne has noted, in the "Sound Input Read VI" the t0 is estimated in site (after the DLL call). Your code represents the good work around that josborne already has suggested to me.

Thanks again to both,
Asper

0 Kudos
Message 5 of 5
(3,039 Views)