Overview
This VI programatically creates anywhere from one to eight (7.1) channels of audio data for a WAV file at a specified frequency, sampling rate, bit rate and duration. An example application could be to use to create test tones.
Description
This VI leverages the built-in Sine Waveform.vi to generate one or more waveforms at a specified frequency, phase and duration. It then uses another built-in function, Sound File Write Simple.vi to generate a WAV file. Also included is some extra coding to generate a descriptive filename based on the settings chosen by the user. Additionally, it performs a check of that file name to help prevent accidentally overwriting it. Note that values provided in the configuration controls are based off industry standards, but you could also modify the code to work with other settings. Although the Channel Configuration control has all 8 channels exposed, only the number of channels specified by the 'Audio Channels' control will actually be written. Finally, this VI simply produces a fixed frequency and phase for each channel, but you could use similar techniques to build up a multi-channel WAV file with other data.
Steps to Implement or Execute Code
Requirements
Software
LabVIEW 2011 or later
Hardware
(optional) Sound card to listen to WAV file
Additional Images or Video
VI Snippet
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.