Creating a .wav from a Waveform Using the Sound File Write VI in LabVIEW

Updated May 3, 2018

Reported In

Software

  • LabVIEW

Issue Details

I have waveform data and I'm trying to use the Sound File Write VI to write it to a sound file. I've verified that the waveform itself is correct, but when I listen to the .wav file or read it back in to LabVIEW, it does sound right and the waveform looks flat.

Solution

Depending on the datatype used for the Y value of waveform, there are different ranges that are acceptable. Anything outside the range will be coerced without scaling. This is documented in the Help file for sound data.

Additional Information

As mentioned in the Help file:

The Y array of the waveform contains Pulse Code Modulated (PCM) data. In PCM data, each element in the Y array is proportional to the amplitude of the signal.

If the Y array data type is a 16-bit signed or 32-bit signed integer, the values range from the minimum to the maximum value for the data type and are centered at zero. A buffer of elements each with the value of zero represents silence.

If the Y array data type is a 8-bit unsigned integer, the values range from 0–255 and are centered at 127. A buffer of elements each with the value of 127 represents silence rather than a buffer of elements each with the value of zero. This might cause an initial clicking sound with 8-bit unsigned integers.

For floating-point data, the values range from -1.0 to 1.0, inclusively. The data is coerced into that range. There is no scaling.

WAS THIS ARTICLE HELPFUL?

Not Helpful