Example Code

Write .WAV File Data to a .txt File with Header Information using LabVIEW

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

Given a valid file path to a .wav file, this code is an example of how to read sound data and write it to a text file. This example will also include information about the wave read as a header in the text file.

 

Description

The VI operates by first opening the sound file to be read using the specified path. The sound file is read and output as Waveform data. Information about the sound itself is extracted from the .wav file, which is then closed. After that, the Y components of all the Waveform samples are unbundled, and sound information is converted into a string. The final step is to write sound information to the output file specified by the output file path and append the Y component array to the output file.

 

Steps to Implement or Execute Code

  1. Enter a valid path to the .wav file you would like to read in the Input .wav File Path section.
  2.  Enter a path to the output text file you would like to write to. If the file does not exist it will be created and if it does exist it will be overwritten.
  3. Run the example.

Requirements

  •  LabVIEW 2012 (or compatible) 

Additional Information or References

Front panel

FP.JPG

 VI snippet

BD.png

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

National Instruments
Product Marketer

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

Comments
djacob
Member
Member
on

thanks for the info.is there any way to remove header information from a file and then save it as text

Electronics and Instrumentation Engineer
Freelance LabVIEW and Arduino programmer.
For projects contact me ; djac791@gmail.com