10-17-2018 02:34 PM
Dear LabViewers,
I made a project which plays sound from a wav file. I inserted the file using a path.
I need to send the project to my programming teacher, but the path which works on my computer naturally does not work on his computer.
How can I solve this problem?
Thanks already!
Flip
Solved! Go to Solution.
10-17-2018 02:48 PM
The easiest way might be to put both the VI you wrote and the .wav file in the same folder. There is a VI in the File I/O Palette under File Constants called Current VI's Path. If you put this into the Strip Path function, you'll get out the path to the Folder of the Current VI (in the top Path output), which is the same as the path to the Folder of the .wav file. Wire this to Build Path, wiring the Filename of the Wave file (with extension) into the bottom input. This give you the full path to the Wave file, regardless of where the Folder holding both your VI and the Wave file are located.
Bob Schor
10-18-2018 06:02 AM
Even better is if you are using a project with your VI, you can use Application Directory, which will give you the path of the folder containing the project file. You can use Build Path from there to create the path for the sound file. This method is better for files like this since it will still work when you build it into an executable.
10-18-2018 01:50 PM
Thanks for your help!
I have one more question, how can I put the filename into the build path?
I tried using a constant, but it did not work....
10-18-2018 02:14 PM - edited 10-18-2018 02:17 PM
@Zippelaar wrote:
I have one more question, how can I put the filename into the build path?
I tried using a constant, but it did not work....
You might want to show what you did. Based on your description, it should have worked.
10-20-2018 12:02 AM
Thanks for your help guys,
it turned out that the specs of the .wav file where not correct. I changed it and now it works.
Again, thanks!