Export a Signal as a WAV File in DIAdem

Updated Apr 3, 2024

Environment

Software

  • DIAdem Advanced
  • DIAdem Professional

This article will show you how to export a single waveform channel in DIAdem as a .wav audio file. DIAdem 2010 or newer and the already with DIAdem preinstalled Audio DataPlugin are required to perform this task.

  1. As prerequisite you will need one single waveform channel in the first group in DIAdem dataportal
  2. Once the data is loaded go to the Script tab in DIAdem
  3. Copy the following code into a new vbs script and save it or load the attached script in the attachment section.
 
'-------------------------------------------------------------------------------
' This vbs script exports the first channel in the dataportal as .wav file.
'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.

'variables decalaration
dim Bits
dim Rate
dim Amplitude

Bits = 32 'bits value could be also 16 or 24
Rate = "" 'set Rate to empty

IF Rate <> "" OR NOT IsNumeric(Rate) THEN Rate = 1/ChnPropValGet(1, "wf_increment") 'calculation of the sampling rate of channel 1
Call GroupPropValSet(1, "Bits_Per_Sample", CLng(Bits))' adding bitrate property to channel group 1
Call GroupPropValSet(1, "Sampling_Rate", CLng(Rate))' adding sampling rate property to channel group 1
Amplitude = MaxV(Abs(CMin(1)), Abs(CMax(1)))' calculation of maximal amplitude of original waveform
Call ChnLinScale(1,1,2^(Bits-1)/Amplitude,0) 'scaling of the orginal waveformcahnell to new bitness
Call DataFileSave(AutoActPath & "Diadem Wave " & Bits & " - " & Rate & ".wav", "Audio") ' save .wav next to this script location
  1. Run the Script

After running the script, you will find the exported.wav file in the folder where you saved your script.