[Lui's homepage].[DSP homepage]
Luisito L. Agustin
Contents
1. Introduction
2. Names and Filenames
3. Format
4. Examples
The purpose of this document is to define a text based file format for representing quantized, fixed point, one dimensional, multichannel, discrete-time data from synchronous channels with a common bit rate and operating frequency.
One might think of a set of 12 analog to digital converters (ADCs) each with 10 bits of precision and each one operating at 8KHz. At each sampling of their analog inputs, the ADCs each produce 10 bits representing the analog voltage level sampled. The 8KHz sampling rate means that each ADC produces 10 bits of data every 125 microseconds. Since there are 12 ADCs, the set of ADCs is a 12-channel source. Each sample is 10 bits and may be represented in binary form as, for example, 1001100101. The same data may be written in hexadecimal as 265. Since the most significant hexadecimal digit is only used for the two most significant bits of actual data, its only possible values are 0, 1, 2 and 3 in this example. Note that it isn's important for each ADC to be sampling the same range of analog voltages, since their individual reference voltages might vary. It is important that each one produces the same number of bits of output at the same sampling rate.
[top]
The text files described shall be called "fixed point multichannel files". The extensions .xmcs and .xmc shall be used to indicate that a file is a fixed point multichannel file. The extension is not required. A file may be recognized as a fixed point multichannel file if it is of the proper text format, regardless of the extension in its filename. The text files shall also be called "XMCS files" regardless of the actual extension used in their filenames, and regardless of whether their filenames have extensions.
[top]
XMCS files are text files. Lines of text in these files shall have lengths of at most 256. Characters beyond the 256th, if any, up to the end of line, shall be ignored and discarded.
In the absence of comments, the format for an XMCS file is as follows:
channels [N1] bits [N2] radix [N3] format <format string> formatend <data sequence>"channels", "bits", "radix", "format", and "formatend" are keywords.
N1 is a positive integer indicating the number of channels.
N2 is a positive integer indicating the number of bits of information generated by each channel at each sampling.
N3 is either 2 or 16, depending on whether the data sequence shall be in bits or in hexadecimal digits.
<format string> is an optional freeform string containing any additional information that might be needed depending on the specific application for which the XMCS file is used. The keyword "formatend" marks the end of <format string>.
<data sequence> is the data sequence and lasts till end of file. <data sequence> is a sequence of tokens, with each token consisting only of 0's and 1's if N3 is 2, and consisting only of hexadecimal digits if N3 is 16.
Any unexpected text initiates a comment lasting up to the end of the current line of text.
If N3 is 2, each set of N2 bits read from valid tokens in <data sequence> shall comprise one sample regardless of any white space and or comments between the bits read. If N3 is 16, enough hexadecimal digits are accumulated to correspond to N2 bits, again disregarding any white space and comments in between valid tokens. If N2 is 10 and N3 is 16, then each set of 3 hexadeximal digits from valid tokens is one sample. More formally, if N3 is 16 then each set of CEIL( N2 / 4 ) hexadecimal digits is one sample.
There is no limit to how large XMCS files may be.
[top]
The following are all valid XMCS files.
xmcs1.txt | xmcs2.txt | xmcs3.txt | xmcs4.txt
Note that their extensions are all .txt, and that the .xmcs extension is not required.
Each of these files represents exactly the same multichannel data.
[top]
[Lui's homepage].[DSP homepage]
This page has been accessed
times since December 1, 2003.