Sounds Logical
Send Page To a Friend

Table Of ContentsPrevious PageNext Page

5.2-- Scaling laws associated with integer (fixed-point) PCM WAV format

5.2.1--- Floating-point to integer conversion

When converting from floating-point to fixed-point representation (e.g. for transmission over a digital line, or for storage in a PCM format WAV file), the floating-point data is (re)-quantized on to the integer range of the given fixed-point representation. For linear PCM quantization, the original signal (considered continuous) is mapped on to a set of evenly-spaced discrete values, or "steps", as depicted in the following sketch:

The "height" , Q , of each step (i.e. the quantization step size) is given by the total input range divided by the number of (vertical) steps:

with the symbols defined as follows:

Symbol

Definition

quantization bit depth (i.e. "valid bits" used in the WAV file)

quantization step size, often called LSB since a change in input level of Q corresponds to a change in the LSB (Least Significant Bit) of binary coded output

amplitude range of data sent to the quantizer

According to convention, digital audio samples are mapped over the floating-point range -1:1. Hence, the quantization step size becomes:

For example, 16-bit quantization (of floating-point data over the range -1:+1), will have a quantization step size of 1/32767.5.

There are numerous approaches to performing the conversion from floating-point to integer (e.g. algorithms based on rounding, truncation, etc). However, the most natural method for creating a signed integer is to use the floor operation since this directly maps the data on to the required range:

with the symbols defined as follows:

Symbol

Definition

(pre-quantized) floating-point sample (within nominal range:-1:+1)

signed integer represention of the (quantized) sample


whereby the nominal floating-point range maps on to the appropriate signed-integer range as follows:

For example, the range mapping for 16 bit quantization is given by:

ReSample's WAV writer implements this floor mapping. In the case where the container size is the same as the bit-depth, the signed integer values from the floor operation are written directly to the WAV file (except for the 8-bit case, where 128 is added to each value to produce an unsigned integer, as required by the standard; and the 24-bit case, where each value is converted to three unsigned 8-bit words). In the case where the container size is larger than the bit-depth, each integer sample must be shifted to the left within its container , according to the left-justification WAV standard. This is achieved by multiplying each sample by the appropriate factor:

with the symbols defined as follows:

Symbol

Definition

container size in bits (always an integer multiple of 8, equal to or greater than the quantization bit depth)

left-justified signed integer representing the quantized sample within its container (where the container size is larger than the quantization bit depth)

ReSample's WAV writer implements this left-justification whenever the user-specified container size is larger than the bit depth.
5.2.2--- Integer to floating-point conversion

The converison going the other way from signed-integer to floating-point (nominal range -1:1) is summarized as follows:

where y represents the quantized data re-scaled as a floating-point number in the range -1:+1.

ReSample's WAV reader implements this mapping .The conversion reduces to the following when the container size is equal to the bit depth:

5.2.3--- Simplified integer to floating-point conversion

The conversion presented above (as implemented in ReSample) requires an addition as well as a multiplication, per sample. This is unavoidable if the signed integer range is to be mapped identically on to the -1:+1 output range. However, a common approximation is to use only a multiplication:

where the floating-point range is slightly reduced, as follows:

Successive uses of this simplification can lead to a build-up of dc offset (i.e. non-zero average value). To avoid this potential problem, ReSample does not make use of this simplification, albeit at the cost of increased execution time.

Top Of PageTable Of ContentsPrevious PageNext Page

Send Page To a Friend

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement