From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-27-2009 03:44 PM
Solved! Go to Solution.
07-27-2009 04:16 PM
07-28-2009 12:10 PM - edited 07-28-2009 12:10 PM
The task ID comes from previous sound output functions.
Here's what the general sequence of sound output functions would look like.
Process:
1) Configure the output device.
2) Set the volume for the device (you can move this step inside the loop if you will be changing the volume during run time)
3) Write data to the output device. You should include some timing logic in this loop as well.
4) When you are finished, stop writing to the device.
07-28-2009 01:23 PM
07-28-2009 02:38 PM
I understand. I had initially looked at that example, but I had hoped that there would be a more simplistic answer to the problem. I've attached a VI of my progress and I have two questions.
1. The VI "works", but only once, and then the program will neither end, nor play the file again.
2. One of the .wav files I frequently use plays just fine in another program when I use the 'Play Sound File' VI, but won't work in this program when I use the 'Sound File Read' VI. But I have another .wav file that works fine for both programs.
07-28-2009 03:07 PM
rmhughes wrote:1. The VI "works", but only once, and then the program will neither end, nor play the file again.
That's because you need to reset where the Sound File Read starts reading the file. This is explained in the Help for that function. By default it reads starting where it left off. Once it gets to the end of the file, there's nothing more to read. You have to reset the counter in your code, and explicitly tell the function to read at an absolute position.
2. One of the .wav files I frequently use plays just fine in another program when I use the 'Play Sound File' VI, but won't work in this program when I use the 'Sound File Read' VI. But I have another .wav file that works fine for both programs.
The most likely reason is that you are not wiring the sound format output from Sound File Info to Sound Output Configure. There's a reason why it's connected in the example. Did you leave it unconnected for a reason?
You also should be wiring the error cluster.
See attached modification, which actually is a copy of the example I pointed out with the modification for the restart of the playing.
07-28-2009 03:19 PM - edited 07-28-2009 03:20 PM
07-29-2009 03:06 PM
Thank you for all your help! I've gotten it working, although I still have the issue of one .wav file being able to play and the other cannot.
I've attached the two sound files I use frequently. The snare drum works on every program I've tried it on, but the Hank Hill .wav file only works when I use 'Play Sound File' VI. I'm not sure how I could wire it differently since it works for one, but not the other.
07-29-2009 03:35 PM
07-29-2009 03:41 PM