PCM

From MultimediaWiki
Jump to navigation Jump to search

PCM stands for pulse code modulation. In the context of audio coding PCM encodes an audio waveform in the time domain as a series of amplitudes.

PCM Parameters

PCM audio is coded using a combination of various parameters.

Resolution/Sample Size

This parameter specifies the amount of data used to represent each discrete amplitude sample. The most common values are 8 bits (1 byte), which gives a range of 256 amplitude steps, or 16 bits (2 bytes), which gives a range of 65536 amplitude steps. Other sizes, such as 12, 20, and 24 bits, are occasionally seen. Some king-sized formats even opt for 32 and 64 bits per sample.

Byte Order

When more than one byte is used to represent a PCM sample, the byte order (big endian vs. little endian) must be known. Due to the widespread use of little-endian Intel CPUs, little-endian PCM tends to be the most common byte orientation.

Sign

It is not enough to know that a PCM sample is, for example, 8 bits wide. Whether the sample is signed or unsigned is needed to understand the range. If the sample is unsigned, the sample range is 0..255 with a centerpoint of 128. If the sample is signed, the sample range is -128..127 with a centerpoint of 0. If a PCM type is signed, the sign encoding is almost always 2's complement. In very rare cases, signed PCM audio is represented as a series of sign/magnitude coded numbers.

Channels And Interleaving

If the PCM type is monaural, each sample will belong to that one channel. If there is more than one channel, the channels will almost always be interleaved: Left sample, right sample, left, right, etc., in the case of stereo interleaved data. In some rare cases, usually when optimized for special playback hardware, chunks of audio destined for different channels will not be interleaved.

Frequency And Sample Rate

This parameter measures how many samples/channel are played each second. Frequency is measured in samples/second (Hz). Common frequency values include 8000, 11025, 16000, 22050, 32000, 44100, and 48000 Hz.

Integer And Floating Point

Most PCM formats encode samples using integers. However, some applications which demand higher precision will store and process PCM samples using floating point numbers.

PCM Types

Linear PCM

Logarithmic PCM

Platform-Specific PCM Identifiers And Characteristics

DOS/Windows

Microsoft WAV/AVI/ASF Identifiers

Apple Macintosh

Apple QuickTime Identifiers

Redbook CD Audio

Sega CD

Identifying PCM Data