Difference Between RMS Value of Acquired Signal and Signal Saved in .wav File

Updated Sep 14, 2023

Reported In

Hardware

  • NI-9233

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

I am acquiring a signal from accelerometer using DAQmx Read.vi and presenting it as analog waveform 1 channel N samples and I am also calculating RMS value of the acquired signal. After that I am saving the signal as a .wav file using Sound File Write Simple.vi. If I open saved the .wav file using Sound File Open.vi and Sound File Read.vi and make RMS calculation the values of RMS are different. How is it possible?

Solution

The problem is in different resolutions of those two signals. The used module has a 24-bit resolution of acquired signal, but Sound File Write Simple.vi has only 8 or 16-bit resolution. It is expected that if you compare RMS of 24-bit signal that it is going to differ from the same but 16-bit signal.

More information could be found on Sound Data help reference.

If there is a need of saving a raw signal in full 24-bit resolution as a .wav file the Sound File Write.vi could be used in Sound File Write (I32) mode with a resolution of 32-bit signed integer and also in combination of tasks:
  1. Sound File Open.vi
  2. Sound File Write.vi in Sound File Write (I32) mode
  3. Sound File Close.vi

It is suggested to use TDMS file formatting instead. See the TDMS file creating tutorial.