Example Code

Playing a Single Audio Channel from a .wav File

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example makes use of the Sound Files VIs to read a .wav sound file and selectively play only one of the channels (by default, it is set up for a 2 channel source).

 

Description
Essentially, this is based on the 'Sound File to Sound Output' shipping example, but with the functionality to select either the Left or Right channel to be played at a time.  This may be useful in applications where it is desired to test a multichannel speaker setup, or also as a starting point to send different sound output to each speaker.
Requirements

  • LabVIEW 2012 (or compatible)
  • Sound output device capable of playing at least 2 channels of audio


Steps to Implement or Execute Code

  1. Select a .wav sound file to test in the file dialog box (a sample has been included).
  2. Select a channel to mute, Left or Right.
  3. Run the VI and listen with a pair of stereo speakers or headphones to confirm that the correct channel has been removed.

 

Additional Information or References
VI Block Diagram
undefined

 

  **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.