When storing analog data using the integer C3D format, the analog sample value is stored in its raw form as a sequence of 16-bit integer words. By default, signed integer values are expected but unsigned integers may be used if the parameter ANALOG:FORMAT is set appropriately. Note that the C3D format expects that the analog samples will be signed integers; it does not specify the resolution of the analog samples. While 12-bit resolution samples are common, other resolutions (i.e. 16-bit) may be used to store analog data – the resolution of the data values may be indicated by the ANALOG:BITS parameter. Both 12-bit and 16-bit analog sample resolutions are common.
To convert the analog sample data into real world units, regardless of the actual sample resolution:
real world value = (data value - zero offset) * channel scale * general scale
Where:
‘zero offset’ is in the “ANALOG: OFFSET” parameters (integer)
‘channel scale’ is in the “ANALOG: SCALE” parameters (floating-point)
‘general scale’ is the “ANALOG: GEN_SCALE” parameter (floating-point)
The raw analog data samples are stored as signed integers by default. However, many analog to digital converters (ADCs) actually generate unsigned binary values, which may be stored within the range of values supported by the signed-integer format. As an example of this, consider a typical 12-bit ADC – this generates numbers in the range of 0 through 4095 (a total of 212 unique values). These values may be written to the C3D file as –2048 through +2047 or simply recorded as 0 through 4095. The first range is signed (it contains both positive and negative numbers), while the second range is unsigned. In this case, the use of signed or unsigned integers to store the analog sample is immaterial as both values fall within the range of a signed integer. However, this is not the case when 16-bit ADC samples are stored; in this case the 16-bit data samples must be stored as signed integer numbers (the default) unless the optional parameter ANALOG:FORMAT is set to “UNSIGNED”.
In the absence of the ANALOG:FORMAT parameter, the format of the analog data can be deduced from the value of the ANALOG:OFFSET parameter. 12-bit unsigned binary values require an OFFSET of 2047 (although many programs use 2048), while signed binary data will have an OFFSET of 0000. 16-bit unsigned binary data will require an OFFSET of 32767 while 16-bit signed binary data will use the same offset value of 0000.
It is very important to note that when a C3D file contains integer analog data then any corresponding 3D points must also be stored in integer format as the choice of format is specified by the parameter POINT:SCALE for the entire C3D file. Setting this parameter to a negative value flags the use of floating point data within the entire file, making it impossible to mix floating-point and integer data formats in the data block.
More:
Notes for Programmers - Integer Analog Data