LDicomWaveformGroup::SaveAudio

Summary

Creates an audio (wave) file from the channels in the waveform group.

Syntax

#include "Ltdic.h"

L_UINT16 LDicomWaveformGroup::SaveAudio(pszFilename, uFlags = 0)

Parameters

L_TCHAR* pszFilename

Name of the audio file to be created.

L_UINT16 uFlags

Reserved for future use. Pass 0.

Returns

Value Meaning
0 The function was successful.
> 0 An error occurred. Refer to Return Codes.

Comments

This function is very useful for extracting audio (wave) data from a DICOM object of type "Basic Voice Audio" (1.2.840.10008.5.1.4.1.1.9.4.1), which is typically used for report dictation.

The resulting wave file has the following characteristics:

  1. Number of channels: will either be 1 or 2, based on the value of the number of channels for this multiplex group. You can call LDicomWaveformGroup::GetNumberOfChannels to get the number of channels in a multiplex group.
  2. Bits per sample (sample size) will always be 8.
  3. Samples per second (sampling rate): This will be the same as the sampling frequency for the waveform group, call LDicomWaveformGroup::GetSamplingFrequency to get this value.
  4. Format category: PCM, mu-Law or a-Law, based on the value of the waveform sample interpretation which can be retrieved by calling LDicomWaveformGroup::GetSampleInterpretation.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

This sample shows how to extract a wave stream from a dataset.

L_INT LDicomWaveformGroup_SaveAudioExample(LDicomDS &InputDS, L_TCHAR * pszInputWaveFileName, L_TCHAR * pszResultingWaveFileName)  
{ 
   L_INT                nRet; 
   LDicomWaveformGroup  AudioWaveformGroup;  
 
   // Do we have any waveforms in the dataset?  
   if(InputDS.GetWaveformGroupCount() <1)  
   { 
      return -1; 
   } 
 
   // Load an audio file into the waveform group.  
   nRet = AudioWaveformGroup.LoadAudio(pszInputWaveFileName,0); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   // Extract the wave stream from the waveform group and save it to disk 
   nRet = AudioWaveformGroup.SaveAudio(pszResultingWaveFileName,0); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
 
   return DICOM_SUCCESS; 
} 

Help Version 23.0.2024.7.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.