LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to get a time stamp in LV from a wav file as it plays?

I need my graphics to sychronize to the playing wav file. So, I need to be able to query the current time of the wav file as it plays. I found an example that shows that this could be done by breaking the file into small segments and loading them one at a time but don't think I can afford the overhead. I'm sure I could do this with WinSDK. Can I do it with lvsound.dll?
0 Kudos
Message 1 of 2
(2,627 Views)
There is no easy way to get a timestamp on the wav file while using the sound VIs. They are designed to simply write the data to the sound output device and then start the output of that data.

An easy way to play a wav file while monitoring how long it has been playing is to use ActiveX to play the file using Windows Media Player. I have attached an example program that allows you to play a sound or movie file using Windows Media Player in LabVIEW. I have also modified the program slightly to see how long the file has been playing. To do this, I added a property node and selected the 'Current Position' property. This outputs a double giving the time the file has been playing in seconds. You will need to redirect the file path to a wav file on your compu
ter. Hopefully you can use this to synchronize your sound and graphics.

JohnM
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,627 Views)