LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound .wav help

I need a little help.
 I want to open a .wav file and play it repeatedly.
Attached is a .vi.
What is happening is it will not play 1 time wait for a specific amount of time and play again, it plays 2.5 times give or take when repeating.



LV 8.2.1
Win XP pro (sp2)
0 Kudos
Message 1 of 11
(4,756 Views)

Hello RRRRSSSS,

Have you gotten a chance to look at the shipping examples that come with LabVIEW?  There are some from the Example Finder that I think may work in this situation (trying to play a file continuously).

Look at Play Sound.vi, which plays a sound using the sndPlaySound Windows API. This demonstrates how to use the Call Library Function to call a DLL.

Sound File to Sound Output.vi also illustrates how to play a sound file continuously, reading the sound file in pieces, and playing each piece at a time.

Good luck!

Janell R | applications engineer

0 Kudos
Message 2 of 11
(4,723 Views)

"Sound file to sound output "is what my vi is made from, the example only play's  once.

 I made an attempt to modify it and cannot get it to play once and repeat.

0 Kudos
Message 3 of 11
(4,713 Views)
Have you tried simply using the "Play Sound File" function instead of all the code you're currently using? I set up a simple loop to do that and it played repeatedly. Got kind of annoying to hear "TADA!" every few seconds.
Message 4 of 11
(4,701 Views)

I did not find a " Play sound file' , I found a 'Play sound" example.

In addition to what I have I need to be able to set the volume, which does not seem possible in "play sound".

I have a working program with the older LV 6.1 sound files, but I was wanting to use the 8.2 vi 's , figured just replace them and it would be good to go but this has not been the case. 

 

0 Kudos
Message 5 of 11
(4,688 Views)

Hi RRRRSSSS,

See attached image. The idea is to read the WAV file and then run the sound data in a loop. You could keep loop delay to 1ms. In my case 10ms worked fine.

I could get my sound data to play as long as I hit the 'Stop' button.

Hope this helps.

- Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
Message 6 of 11
(4,685 Views)
The "Play Sound File" function is in the "Graphics & Sound -> Output" palette. It's the function in the lower right-hand corner. It's labeled "Play Sound", but the actual name is "Play Sound File". Since you need to set the volume as well then this won't work for you, as it plays the sound at max value.

Regardless, in your VI if you delete the "Sound Output Start" and "Sound Output Stop" then the VI works as expected. At least it did on my machine.

Side-note: You can use the "Time Delay" express VI (in the Timing palette) to get a wait function that has error in/out clusters to help you eliminate that sequence frame.
Message 7 of 11
(4,677 Views)

The soundOutput.vi file is exactly what I wanted done except I need to add something to the code which would search for a wav file in a folder and then play it.

 Any help would be appreciated. I am new to Labview and I have no idea how to start it.

 

Thanks

0 Kudos
Message 8 of 11
(3,967 Views)
Continued here...
0 Kudos
Message 9 of 11
(3,945 Views)

I leave an example which can contribute

0 Kudos
Message 10 of 11
(3,282 Views)