How Do We Import Audio Files Into NI DIAdem?

Updated Sep 15, 2023

Environment

Software

  • DIAdem

How do we import audio files into NI DIAdem?

To be able to import audio data into NI DIAdem

  1. You have to add a time base to the data channel before you export it.
  2. You have to rescale the amplitude of the signal to the bit range (+/- 2^31) of a WAV file. 

 

Here's a quick VB Script that does that:

Channel = 1

WavFilePath = ChnPropValGet(Channel, "sourcedatafilepath") & ChnPropValGet(Channel, "sourceparentname") & ".wav"

Call ChnWfPropSet(Channel, "Time", "s", 0, 1/41000)Amplitude = MaxV(Abs(CMin(Channel)), CMax(Channel))

Call ChnLinScale(Channel, Channel, 2^31/Amplitude, 0)

Call ChnCharacter(Channel)

IF FilEx(WavFilePath) THEN Call FileDelete(WavFilePath)

Call DataFileSave(WavFilePath, "Audio")