DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS save as WAV file, not always working

Solved!
Go to solution

I have some waveforms saved in .tdms files.  I want to convert them to .wav audio files.  In DIAdem, I'd did 'Save As' then chose 'Audio .wav'. When I open the .wav file up in an audio player/editor, it is silent; it's just an empty line.

 

Now, my original .tdms waveform data goes from ~[-2,2]. When I scale the waveform in DIAdem down to ~.30, the .wav file then behaves properly.  Is there a different way for me to avoid this issue?  Is this due to some sort of specifications of the .wav file format?  I attached some pictures.

0 Kudos
Message 1 of 3
(4,943 Views)

Note: I think what I am doing is part of the Audio Dataplugin

0 Kudos
Message 2 of 3
(4,889 Views)
Solution
Accepted by topic author sjgsjgsjg5509

Hi sj,

 

You either have to scale the waveform channels to the I32 data values yourself or happen to be in a valid scaling range for the WAV file format.  I find the former approach easier to remember:

 

Volume = 0.5 ' 0.0 - 1.0
FOR Each Channel In Data.GetChannels("*")
  Amplitude = MaxV(Abs(CMin(Channel)), CMax(Channel))
  Call ChnLinScale(Channel, Channel, Volume*2^31/Amplitude, 0)
  Call ChnCharacter(Channel)
NEXT
Call DataFileSave(WavFilePath, "Audio")

 

Brad Turpin

DIAdem Product Support Engineer

National Instrument

Message 3 of 3
(4,885 Views)