LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to include a sound file (or other non-LabVIEW files) into a built executable?

I need to include a .wav file to be played as part of a build, but I'm not sure how to do this automatically through the executable builder. In my VI I reference the .wav file by relative file location (application_directory/data/filename.wav). The builder includes a data folder and a file called lvsound2.dll, but since I'm looking for a file named filename.wav this doesn't work. I gather from other posts about this that this is expected, and referencing things by relative path is not guaranteed to work for an executable. I have found a workaround by manually adding the filename.wav file into the data folder after the build is finished, but this is a bit of a pain and I'd like to know a better solution that uses the build options.

 

I know you can specify some files to be always included in the build, but in the build options - source files option list I can only see or add .VI files. Does anyone know the proper way to do this?

0 Kudos
Message 1 of 2
(635 Views)

One method is to include the wav file in the project itself, which can then be included in the build specification under Always Include. It will then default to the Data folder output. You can also define custom output directories for files, and place the wav file in there.

 

MichaelBalzer_2-1605057858144.png

 

MichaelBalzer_0-1605057536730.png

 

MichaelBalzer_1-1605057612100.png

 

If the sound file never changes, another approach would be to include the wav file inside a VI as a constant waveform array. First load the sound file into a waveform array indicator, then change the indicator to a constant.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 2 of 2
(602 Views)