Characteristics of Audio Files

The audio signal in a file represents a series of samples that capture the amplitude of the sound over time. The sample rate is the number of discrete samples taken per second and given in hertz. The precision of the samples, measured by the bit depth (number of bits per sample), depends on the available audio hardware.

MATLAB® audio functions read and store single-channel (mono) audio data in an m-by-1 column vector, and stereo data in an m-by-2 matrix. In either case, m is the number of samples. For stereo data, the first column contains the left channel, and the second column contains the right channel.

Typically, each sample is a double-precision value between -1 and 1. In some cases, particularly when the audio hardware does not support high bit depths, audio files store the values as 8-bit or 16-bit integers. The range of the sample values depends on the available number of bits. For example, samples stored as uint8 values can range from 0 to 255 (28 – 1). The MATLAB sound and soundsc functions support only single- or double-precision values between -1 and 1. Other audio functions support multiple data types, as indicated on the function reference pages.