Export a Signal as a WAV File in DIAdem

Updated Nov 3, 2020

This process will show you how to load a file in DIAdem with a single numeric channel and export it as a .wav audio file. You will start by loading in a file into the DIAdem data portal that you needs to be converted to an audio .wav file. The intermediate steps include performing scaling on the file and adding a timebase for the file if not already done. Last you will export and save the file as an audio .wav file. DIAdem 2010 or newer and the Audio DataPlugin are required to perform this task. Prior knowledge with DIAdem DataPlugins and scripting are helpful to be most successful.

  1. Launch DIAdem and go to the Navigator tab
  2. Browse for the file to convert and drag and drop it in the Data Portal
  3. Once the data loads go to the Script tab in DIAdem
  4. The first step will be to add a time base to the data channel before you export it. This can be calculated from the sampling rate of the signal. An example section of VB Script Code is included below:
                                    Rate = "" '44100
                                    Rate = 1/ChnPropValGet(1, "wf_increment")
                                    Call GroupPropValSet(1, "Sampling_Rate", CLng(Rate))

  1. The next step will be to scale the amplitude of the signal to the bit range of a WAV file (typically 32 bits but can also be 16 or 24) An example section of VB Script code to accomplish the scaling is included below:
                                 Bits = 16
                                 Call GroupPropValSet(1, "Bits_Per_Sample", CLng(Bits))
                                Amplitude = MaxV(Abs(CMin(1)), Abs(CMax(1)))
                                Call ChnLinScale(1, 1, 2^(Bits-1)/Amplitude, 0)

  1. Last save the file as .wav audio file as shown in the example line of VB Script code below:
                                  Call DataFileSave(AutoActPath & "Diadem Wave " & Bits & " - " & Rate & ".wav", "Audio")
  1. Run the Script

After running the script, it will generate a .wav file with the name and path specified in step 6. The .wav file is now generated and  can be listened to.  A full VB script screenshot including the lines above is included below: