Q10034 Saving DAP-captured data as audio files
I want to import the data collected by a DAP into a software program for audio analysis. Can a DAP to save data in the form of audio files?
It is possible, but probably easier and better to let a PC host application perform this conversion for you.
The simplest audio format, and one that is almost universally
accepted, is the uncompressed WAVE
file format with linear
pulse code modulation (LPCM). It is marked with the
WAVE_FORMAT_PCM
audio type (0x0001
). This
encoding format expects exactly the binary format that a DAP board
produces when it records sample data in an ordinary log file. In
concept, all you have to do is attach an appropriate file header section
in front of the logged data, and you get a WAVE
file.
A typical WAVE
LPCM file consists of three sections.
- A file header. This header contains an ASCII "magic number" and an overall file length field.
- A configuration block defining channels, precision, and timing.
- A data block containing all of the sample values, one value for each channel at each sampling instant.
Constructing an appropriate file header section could be done on a DAP using custom command programming in C++, but it is much simpler to post-process an ordinary binary logged data file using software such as Octave, Python, or Matlab. These packages and many others provide functions to read in the logged data file and add the required file header.
L17248
A description of the WAVE file format (.WAV
) is available at
Microsoft MSDN.