LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Playing wav files

I am using Snd Play Wave vi to play a wav file from a specific path.  The wav file is 1 minute long but for some reason labview stops playing it after around 17 seconds.  How do I get it to play the whole thing?
0 Kudos
Message 1 of 10
(3,765 Views)
Why don't you post your vi? Is it a built-in example?

manga
0 Kudos
Message 2 of 10
(3,750 Views)
The vi is basically a path going into the Snd Play Wave vi in the graphics and sound section of functions pallette.  Im using LV 6.1 and it only plays around 17 seconds of the wav file.
0 Kudos
Message 3 of 10
(3,744 Views)
Bump, noone else has this problem? 
0 Kudos
Message 4 of 10
(3,725 Views)
Flying,
 
Do you possibly have the "wait until finish" value set to False.  If you set it to True the expected behavior is that your entire wav file should be played.
 
Just a thought! 
gold
0 Kudos
Message 5 of 10
(3,714 Views)
Hi,

As Gold mentioned, make sure that 'Wait until Finish' is set to true.

If this doesn't fix the problem, notice that the Snd Play Wave VI is Operating System dependent. What OS are you using?
Does this only happen with that particular file?, Have you tried playing a different file that is longer than 17 seconds to make sure that the VI plays the whole thing?
If another file is played completely there might be a problem with the file you are using.

Could you post the VI and the .wav file you are using to make sure that the configuration is correct?

Thanks,

Tica Taveras
Applications Engineer
National Instruments
Message 6 of 10
(3,707 Views)
Attached is my vi.  Really simple.  But it seems to always cut the length of the wav files I play.  30 second wav files only play for about 17 seconds.  1 minute wav files only play for 26 seconds or so.  I know the wav files are good because the play in full on other media players.
 
The wait until finish should be defaulted to true.  I am using labview 6.1 with windows 200 pro. 
 
Thanks,  any help is appreciated.  This is really weird.
0 Kudos
Message 7 of 10
(3,702 Views)
I can provide the wav file too if needed.
0 Kudos
Message 8 of 10
(3,679 Views)
Hi,

I was able to reproduce the problem and even though I am still working on the issue I was able to play the whole wav file. If I set the 'wait until finish' input to false, this runs the application and it doesn't wait for the file to finish playing and even though the VI is not running, it plays the whole file.

I am currently working on the issue to see why the VI doesn't play the whole file when 'wait until finish' is set to true, and I am leaning towards the possibility that it may have a time limit that is not indicated in the documentation.
I will keep you posted on what I find out about the Snd Play Wave File VI.

On the other hand I was able to find other examples that play wav file. You can find this under Help
»Find Examples... and search for 'sound'. Try the 'Wave File Player.vi' example.

Regards,

Tica Taveras
Applications Engineer
National Instruments

Message 9 of 10
(3,674 Views)

Hi,

The Snd Play Wave File VI was created to play short wav file so when you try to play a long file, the VI times out and this is why only part of the file is played.

So if you are just interested in playing a wav file even if the VI doesn't wait for the file to finish playing, you can set the ‘wait until done’ input to false. On the other hand if you want the VI to finish playing and then keep running the rest of the code, I recommend using one of the examples in the LabVIEW example finder when you look for ‘Sound Control’.

This function has been rewritten in LabVIEW 8.0 and it allows you to specify a timeout input that if you set to -1, it allows you to play the whole song and waits until the file is completed to continue executing the rest of the code.

Tica T
Applications Engineer
National Instruments

0 Kudos
Message 10 of 10
(3,624 Views)