Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
16 ratings:
 2.75 out of 5   

Can I Play a .WAV Sound File from LabVIEW?



Primary Software: LabVIEW Development Systems>>LabVIEW Base Development System
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I would like to play a sound from within LabVIEW. Can I play a .WAV file in LabVIEW?

Solution:
  • LabVIEW 8.6 and later
    The sound palette is located in the Functions Palette under Programming » Graphics and Sound » Sound. Select Output and you can use the Play Waveform Express VI or the Play Sound File.vi to play a .WAV file. The Device ID terminal is the device you access for a sound operation, which generally 0 by default. The Play Waveform Express VI has an auto-populated drop-down list that includes all available sound devices. Refer to Context Help for more information.

    For example code, select Help » Find Examples. When the NI Example Finder window opens, select the Browse tab, then navigate to Hardware Input and Output » Sound. To play a .WAV file, begin with the Sound File to Sound Output.vi.

  • LabVIEW 5.1
    Beginning in LabVIEW 5.1, a sound palette has been added to enable the use of sound cards in LabVIEW. This palette, located at Functions » Graphics and Sound » Sound, has VIs that provide the ability to play and record 8 or 16-bit sounds. In particular, the VI will play a .WAV file from a path that you supply to the wave file path terminal.

  • LabVIEW 5.0
    There is a similar version of the Sound VIs available for LabVIEW 5.0 in the Developer Zone. A link to these VIs is available in the Related Links section below.

  • LabVIEW 4.1
    LabVIEW 4.1 for Windows ships with an example, Play Sound, located in the playsnd.llb library in the <LabVIEW>\Examples\DLL\Sound folder. This VI calls a DLL that uses Windows API function calls to play .WAV files.


Related Links:
KnowledgeBase 34BJ3SFQ: How to Use the Sound Output VI's in LabVIEW to Play Wave Files
KnowledgeBase 2HU7M1U7: Clicking Sound When Looping Back a WAV File Using the Build-in Sound VIs
KnowledgeBase 2VNE7AQT: How do I Use the LabVIEW Sound VIs on a Macintosh?
Developer Zone Example: Acquiring Data and Saving the Data as a .wav File

Attachments:
Sound File to Sound Output v2015.viSound File to Sound Output v2014.viSound File to Sound Output v2013.viSound File to Sound Output v2012.vi




Report Date: 09/24/1997
Last Updated: 05/10/2016
Document ID: 11NHM905

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit